Back to the glossary

Process and automation

Flaky test

A flaky test is an unstable test that sometimes passes and sometimes fails without any change to the code, for example because of timing, ordering or external influences.

Also known as: unstable test, intermittent test failure

Why flaky tests do so much damage

A single unstable test seems harmless: you just restart the pipeline. But over time the team gets used to red builds. Real failures get lost in the noise, and the test suite loses its value as an early warning system.

Common causes

  • Fixed waits (sleep) instead of waiting for a condition
  • Tests that depend on each other or on their order
  • Shared test data or environments
  • Network, clock or random values without control
  • With hardware: loose contacts, temperature, measurement tolerances, boot times

What helps

  1. Make flaky tests visible: record retries and failure rates.
  2. Quarantine affected tests so the pipeline becomes reliable again.
  3. Fix the cause instead of permanently accepting automatic retries.

A stable suite with fewer tests is worth more than a large one nobody trusts.