Prefer Deterministic Tests
TEST-PREFER-DETERMINISTIC-TESTS
Summary
Prefer tests controlled by fixed inputs, clocks, ordering, and local state. Deterministic failures are reproducible, while real integration checks should be isolated by cost.
Rule
Prefer deterministic tests over timing or external-state tests.
Why
Tests that depend on timing, network state, random ordering, real clocks, or external services fail for reasons unrelated to the code under review. Deterministic tests give agents and maintainers failures they can reproduce and fix.
Helps
- Reduces flaky CI and makes failures actionable.
Limits
Some behavior needs real integration or timing validation. Isolate those checks, mark their cost, and keep deterministic lower-level coverage for the core contract.
Agent Instruction
Prefer deterministic tests over timing or external-state tests because tests that depend on timing,
network state, random ordering, real clocks, or external services fail for reasons unrelated to the
code under review.Mechanisms
Supported by fake clocks, seeded randomness, temp directories, mocked providers, local fixtures, retry-free assertions, and quarantined live integration jobs.