Blog
Flaky Tests Are Production Bugs In Your Feedback System
Rerunning a red build until it turns green trains team to ignore failures. Soon the one real regression looks exactly like background noise.
Preserve The Failure
Capture seed, test order, timestamps, environment, thread dump where relevant, and logs for the failing test. Reproduce the same conditions before adding random sleeps.
Common causes are shared mutable fixtures, fixed ports, transaction leakage, wall-clock boundaries, unordered assertions, and asynchronous work surviving test end.
Classify the flake by signal. A consistent assertion mismatch under random order points toward leaked state. A timeout under load suggests a scheduling assumption. A missing callback after the test ends suggests lifecycle leakage. Classification turns “sometimes red” into a smaller search space.
Stress The Suspect
Run the test repeatedly, in isolation, under random order, and with parallel execution. Each mode narrows the shared assumption.
Quarantine may unblock delivery, but it needs an owner, issue, and expiry. A quarantine folder without deadline is a graveyard where confidence goes to die.
Fix the cause, then keep a regression that would fail under the old condition. Deleting the test proves only that silence is stable.