Why AI-written tests miss bugs that need two conditions at once
Paper: Combined but Not Reached: AI-Generated Tests for Requirement Interactions
Preprint. It has not yet been peer reviewed.
The short version
Some bugs appear only when two requirements hold at the same time. I gave an AI coding agent the requirements and the code before the fix for eight real bugs from five open-source projects, and asked it to write tests, with and without an instruction to exercise the requirements together. Many tests (40 of 102) combined the two requirements, but only 7 reached the faulty code. That gap appeared for every bug that went undetected, and the extra instruction did not improve detection in these runs.
What I found
- Of 102 valid tests the agent wrote for 8 historical bugs from 5 open-source projects, 40 combined the two requirements, 7 reached the code path with the bug, and 6 detected it.
- In 21 of the 29 test suites that missed their bug, the tests combined the requirements but did not reach the faulty path.
- Asking the agent to exercise the requirements together raised the number of tests combining them from 16 to 24, but detection stayed at 3 of 15 runs with either prompt.
Why it matters
A test that sets up the right situation can still pass over the code that fails. When reviewing tests written by AI, check that each test actually runs the code it is meant to check, not only that it names the right conditions.
How the study was done
For each of 8 historical bugs, the agent got neutral requirements and the code before the fix, and wrote tests three times with a plain prompt and three times with an added instruction. Each test was run against the code before and after the fix; the agent could not run its own tests. The data, scores and scripts that reproduce the tables are on Zenodo.
How to cite
Thapa, S. J. (2026). Combined but Not Reached: AI-Generated Tests for Requirement Interactions [Preprint]. Zenodo. https://doi.org/10.5281/zenodo.24482952