Egor Urvanov

Flaky test

Testing · flaky tests, flakiness, intermittent test

A flaky test is a test that is sometimes green and sometimes red on the same code, with no edit at all. A green test passed and a red one failed; a flaky test changes colour on its own. It is like a scale that shows a different weight each time: you cannot trust it. The usual causes are a race condition between parallel actions, dependence on time, calls to an outside system, and tests that affect each other. Such tests erode trust in the whole suite: the team gets used to red and can miss a real defect.

the same codeno editsthe same test✓greenrun 1✓greenrun 2×redrun 3✓greenrun 4×redrun 5✓greenrun 6red no longer means “broken”: the team learns to ignore redThe same code and the same test: a green run, then a red one, with no edit at all

Frequently asked questions

What is a flaky test?

A test that is sometimes green (passed) and sometimes red (failed) on the same code, with no edits.

Why do tests become flaky?

Because of races between parallel actions, dependence on time, calls to outside systems and insufficient isolation between tests.

Why is a flaky test harmful?

The team gets used to red results and stops looking at them, so a real breakage can go unnoticed.

What to do with a flaky test?

Isolate it from other tests, pin down time and random values, replace outside services with mocks. While it is being fixed it can be quarantined, but not left there for good.

Source: Wikipedia: Flaky test

Read more: The races found by Quint models

Where it appears · 2

Related terms

Whole glossary

© 2026 Egor Urvanov