Flaky tests
Name the main causes of a check that passes and fails by luck: timing, shared data and order, async slips and the environment. Then fix them.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a kitchen scale that cannot make up its mind. You weigh flour and see 200 grams. You weigh the same flour again and see 205. Neither number is wrong by much, but now you trust none of them. You start guessing instead.
can act the same way. The Daily List team has a check that goes red on Monday, green on Tuesday and red again on Wednesday. Nobody changed the app. People begin to say, "Just run it again."
A check like this is a . The danger is not the red days. The danger is that people stop looking at red, and one day the red is real.
Tom's job is to find why the scale wobbles. It might be timing, shared data, the order of checks or the machine itself.
The picture has limits. A scale wobbles for one reason. A check can wobble for several reasons at once.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
PLAIN WORDS · 3 in this section
- flaky
- passing sometimes and failing sometimes with no product change
- wobbles
- Gives a different answer each time, like a shaky scale.
- wobble
- move up and down by small amounts
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Naming why passes and fails by luck, and fixing the cause, not hiding it.
- Count the passes
- Find the cause
- Fix the cause
- Quarantine with a date
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| The wobbling scale | A flaky check |
| Weighing again and again | Running it many times |
| Dust under the scale | Shared data or order |
| Taking it off the shelf for repair | Quarantine with a date |
WHERE THIS PICTURE STOPS
- A scale wobbles for one reason. A check may have several.
- A scale is checked on its own. A check shares a machine with others.
- A shelf has no deadline. Quarantine must have one.
HOOK
Count, find the cause, fix, quarantine with a date.
REMEMBER IT THIS WAY
A rule of thumb: if you see this, think that.
If goes red, then green, and nobody changed the app, find the cause before anyone says "just run it again".
| In the trick | What it stands for |
|---|---|
| Red, then green, no change | A check that goes red on Monday and green on Tuesday |
| Just run it again | What people begin to say |
| Find the cause | Timing, shared data, the order of checks or the machine |
A real bug can also come and go, so do not call a check flaky before you look at the cause.
TELL A FRIEND
A scale that gives different numbers for the same flour is not trusted. A flaky check is the same, and it is fixed by finding what makes it wobble.
OFTEN MIXED UP WITH Waits and timing in automated checks. The waits lesson fixes one cause. This lesson names all the usual causes.
PRACTISE AND KEEP
Sources for this topic — 8 sources
- Market practice
Flaky tests at Google and how we mitigate them (Google Testing Blog, 2016) ↗ — Google (Testing Blog) · Describes flaky tests at Google and the ways the team mitigates them (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Eradicating Non-Determinism in Tests (Martin Fowler) ↗ — Martin Fowler · Names isolation, asynchronous behaviour and quarantine; advises polling or callbacks with a timeout instead of bare sleeps; quarantined tests need a deadline (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Just Say No to More End-to-End Tests (Google Testing Blog, 2015) ↗ — Google · End-to-end tests are slow and flaky when they dominate; keep them few (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Using promises (Mozilla developer docs) ↗ — Mozilla · It is easy to forget await, and a promise used as a value gives a type mismatch (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
The Practical Test Pyramid (Martin Fowler site, by Ham Vocke) ↗ — Martin Fowler / Ham Vocke · Many small fast checks, few slow ones (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Waiting strategies (Selenium documentation) ↗ — Selenium project · Fixed waits and implicit waits can make timing unpredictable (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Retries ↗ — Playwright (Microsoft) · Playwright docs: a test that fails first and passes on retry is categorized flaky. Search excerpt, page not opened.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
ISTQB Certified Tester Advanced Level Test Automation Engineering (CTAL-TAE) Syllabus v2.0 ↗ — International Software Testing Qualifications Board (ISTQB) · Section 8.1.1 (printed page 48): test histogram to find fragile tests; machine learning and self-healing of locators reported in the test report; version 2.0 of 2024-05-03, mirror copy of the publisher PDF, version checked against front matter, opened
Primary publisher body opened and relevant sections read on 6 November 2026; selected-section reading, not a claim every page or external link was read. See docs/research/v16-testing-automation-literacy-audit-20261106.md for exact sections, version and limitations.
V52 additionally read actual publisher PDF7 November 2026: version 2.0,3 May 2024 front/introduction and all substantivechapters 1–8/29 learning objectives, throughprintedp 53 and selectedreferences. Not every appendix or cited book. §3.1.5 says interface substitution; Martin’s original calls it Interface Segregation. Preserve the source discrepancy separately. No unrestricted commercial image permission established.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.