Debug flaky tests: race conditions and timing
11 steps · about 3 h 35 min · Intermediate
- Async race conditions and flaky tests (article, BuildPulse, 15 min)
It shows how to reproduce a race on purpose with loops and added latency, which you need before you can fix it.
- How to Fix 'Race Condition' Test Failures (article, OneUptime, 15 min)
It gives concrete bad-versus-good patterns across several languages, including sleep-based assertions and shared state.
- Root Cause 1: Timing, Sleeps and Waits (article, TestingBot, 15 min)
It focuses on timing, including the trap of starting a network wait after the click.
- Playwright Waits and Timeouts: How Auto-Waiting Works (article, Hyperping, 15 min)
It explains how auto-waiting and retrying assertions replace sleeps, which is the standard fix for UI timing flakes.
- Why Your E2E Tests Are Flaky (And How to Fix Them) (article, Webstack Builders, 15 min)
It works through form-submission and navigation races, so you learn to wait for the event that causes the state change.
- Playwright: Diagnosing and Fixing Flaky Tests (article, Montelli, 20 min)
It adds repeat-each runs and Trace Viewer on first retry, so you can capture evidence of a failure that only shows up in CI.
- How to Debug Flaky E2E Tests: A Practical Workflow (article, CueTest, 10 min)
It pulls reproduce, categorise, inspect, fix and prove into one repeatable workflow.
- Catching Race Conditions in Go (article, DEV Community (frosnerd), 15 min)
It moves from timing guesses to tooling: a race detector reports unsynchronised memory access directly.
- ThreadSanitizerCppManual (reference, Google sanitizers wiki, 25 min)
It is the original manual for the data race detector behind Go's -race flag, and covers C and C++.
- 16.2 Race Detection (article, Go under the hood (golang.design), 25 min)
It explains happens-before and why race reports are reliable, so you can read a detector report with confidence.
- ThreadSanitizer: data race detection in practice (doc, Google Research, 45 min)
It is the original paper behind the tool, for readers who want to understand how detection works.