Why Coding Agents Write Flaky Tests, and How to Make Them Deterministic
Blog post from TestMu AI
AI coding agents can introduce unreliable tests by reproducing common flakiness patterns such as fixed delays, order-dependent assertions, unseeded randomness, and shared state; by changing applications without updating associated tests; or by using an LLM to decide pass or fail, making the verdict variable. The text distinguishes true flakiness, where identical code produces inconsistent outcomes, from deterministic brittleness caused by application changes, and recommends repeat-run checks, controlled time and randomness, resilient role- or test-ID-based selectors, explicit database ordering, and isolated test data. It cites research suggesting generated tests are at least as prone to flakiness as human-written tests and that existing flaky suites can transmit poor patterns to AI-generated additions. It argues that acceptance criteria should be human-approved and that the coding agent should not evaluate its own work, advocating independent verification with preserved evidence such as logs, screenshots, steps, and verdicts. The piece presents Playwright and pytest repeat-run commands as practical checks, discourages unreviewed retries, skips, quarantines, and automated healing, and promotes TestMu AI’s Kane CLI as an optional separate verification layer for important user-facing flows.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| LLM | 14 | 3,914 | 877 | 205 | -41% |
| AI Coding Assistant | 3 | 2,080 | 477 | 150 | +6% |
| AI Agents | 1 | 6,608 | 1,301 | 248 | -6% |
| Agent Evaluations | 1 | 121 | 57 | 29 | -28% |
| MCP | 1 | 10,722 | 1,030 | 207 | -10% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.