A Flaky Test is an automated test that produces different results across runs even though neither the code under test nor the test itself has changed. Because a failure may or may not mean a real defect, flaky tests erode trust in the test suite and slow down delivery.
Common causes of flaky tests include:
- Timing and Race Conditions: Tests that rely on fixed waits or assume an operation finishes in a set time fail when the system is slower than usual.
- Shared State: Tests that depend on data or settings left behind by other tests behave differently depending on the order they run in.
- Unstable Environments: Network latency, overloaded CI machines or unreliable third-party services cause intermittent failures.
- Brittle Locators: UI tests that target elements by position or generated attributes break when the page renders slightly differently.
- Non-Deterministic Data: Random values, dates and time zones produce results that vary between runs.
Teams manage flaky tests by tracking pass rates over many runs, quarantining unreliable tests so they do not block releases, and fixing the root cause rather than simply adding retries, which only hide the problem.


