Promptles
Errors & Proof

Make Tests Repeatable

If a result depends on the clock, randomness, or the network, ask for a test that holds it still so every run matches.

A test that depends on the current time, a random number, or the network can pass today and fail tomorrow with no code change. When the thing you're testing depends on something that moves, say so. Ask for a test that holds it still (a fixed clock, a fixed sample), so every run sees the same world. Vague: "Write a test for the 'just now' label." Specific: "Write a test for the 'just now' label. It depends on the current time, and our last time-based test failed about once a week, so fix the clock to one moment in the test. Show me it passing three runs in a row."

Where you'll practice this

One Promptles scenario teaches this principle directly.

  • Run One TDD Cycle

    Billbird's invoice list is getting labels like 'sent just now' and 'sent 5 minutes ago'. You're adding `formatRelativeTime(date)`: under a minute it returns 'just now', then minutes, hours, and days ago, and after a week the plain date. The team's `/tdd` skill runs one…

Other principles in Errors & Proof