As AI coding assistants like Claude Code, Cursor, and GitHub Copilot become daily drivers in modern software engineering, a dangerous pattern has emerged in many team pipelines: letting LLMs generate unit tests for code they just wrote.
It feels efficient on the surface. The AI writes a feature, writes the test suite, the tests run, and the pipeline turns green.
However, relying on post-hoc test generation creates a massive structural blind spot one that software engineering researchers and core maintainers have now quantified.
1. The Flaw of Post-Hoc AI Tests: Confirmation Bias
When an LLM generates a feature, its context window contains the exact logic, assumptions, and potential edge-case omissions that produced that code.






