How to (not) write a flaky test
summary
Defines flakiness as inconsistent test results and pins causes to three growing axes: coverage (DOM and network race conditions), execution (bad isolation and parallelism), and performance (slow infra and tests). Recommends concrete fixes: use Cypress intercept and mock empty array to eliminate network races, add assertions/checkpoints and wait for loader element for DOM determinism, design isolated resources per parallel worker, clean staging data outside tests (cron job), cache browser state/snapshots instead of repeating UI logins, and raise granular timeouts only where needed.
AI-written summary · about
chapters (9)
- 0:00Introduction to test flakiness
- 1:54Three axes of flakiness
- 3:17DOM flakiness and solutions
- 5:04Network layer flakiness
- 6:51Test isolation issues
- 8:38Infrastructure problems
- 10:44DRY principle in tests
- 12:30Test idling and timeouts
- 14:40Summary and key takeaways
related talks
32mHow to write a flaky test
46mFilip Hric: How to Write a Flaky Test Description: How (not) to Write a Flaky Test
22mTest Confidence: Types of Flake & How to Remediate
42mDon't Let Your Tests Flake Out
38mFlakiness in your tests isn't down to test framework
28mTest flakiness; methods for dealing with flaky tests
15mHow to Fix Flakiness in Tests | Using Time Machines to Debug #FlakyTest
29mCommon Mistakes that make test cases flaky and how to avoid them
