A flaky test passes and fails on the same code. Each one seems harmless, but together they teach developers to re-run the pipeline and ignore red builds, and that is exactly when a real failure slips through.
Find them
Track test results over time and flag tests that fail and then pass on a retry without any code change. Most CI tools and test reporters can do this. Rank them by how often they fail and how many builds they block.
Common causes
- Fixed waits instead of waiting for a condition, such as an element appearing
- Tests that depend on each other’s data or on run order
- Shared environments where other tests change the data
- Time zones, dates and clocks, especially around midnight and month ends
- Unreliable external services called directly from tests
Fix the cause, not the symptom
Replace sleeps with explicit waits for the expected state. Give each test its own data and clean up afterwards. Use fixed clocks in tests that depend on time. Replace external services with stable fakes or sandboxes in most tests, and keep a few contract tests against the real thing.
A clear policy
Quarantine a flaky test straight away so it stops blocking others, give it an owner and fix or delete it within a set time. A test nobody fixes is not protecting anything.
Our engineers and consultants write about what they see in real projects. Have a question about your own systems?






