Test Automation / Quiz
The Flaky Test Clinic
Sleeps, races, shared state, and order dependence, diagnose the four diseases that make suites lie to you.
- Difficulty
- Medium
- Format
- Quiz
- Points
- 150
- Estimate
- 9 min
// MISSION BRIEF
Your Mission
A flaky test is worse than no test: it burns CI minutes, erodes trust, and trains the team to click "re-run" without reading.
You're the automation lead. Diagnose the root causes behind classic flake patterns and pick fixes that cure the disease instead of muting the symptom.
// FIRST CONTACT
Battle teaser
A test does: click 'Save' → sleep(3000) → assert toast visible. It fails ~5% of runs on slow CI. The real fix is:
- AReplace the sleep with an explicit wait for the toast (condition-based, generous timeout)
- BMark the test with retries(3)
- CIncrease the sleep to 10 seconds
- DRun it only on fast machines
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
flaky-testswaitsisolationci