Skip to main content

Flaky Test

A flaky test is an automated test that passes and fails intermittently without any change to the code it's testing — usually caused by timing issues, unhandled async waits, test-order dependencies, or shared state. Flaky tests erode trust in a suite faster than almost any other automation problem, because a red build stops meaning anything.

The danger of flaky tests isn't the occasional false failure — it's what teams do in response to it. The first time a flaky test fails, someone re-runs the pipeline. The second time, someone mutes or skips it "for now." By the tenth time, the team has trained itself to ignore red builds, which means the one time a genuine regression slips in, nobody notices, because everyone assumed it was "just flakiness again."

Common causes: hard-coded sleep() calls instead of proper explicit waits, tests that depend on execution order or leftover state from a previous test, race conditions in async UI updates, and tests that hit real external services instead of mocks or stubs.

The fix is almost never "just re-run it" — that treats the symptom. Quarantining a flaky test (removing it from the blocking suite while it's fixed, not deleting it) is the honest way to keep the rest of the suite trustworthy while the root cause gets addressed.

Flaky Test — Definition, Example & How It's Used | QA Bash Glossary | QA Bash