GTDD: Generative Test-Driven Development for AI Coding Agents with Adversarial Testing
Organizations: Mizuho-DL Financial Technology Co., Ltd.
Abstract
Test-driven development gives AI coding agents executable requirements for implementing software. Because these agents can adapt their implementations to the examples they observe, passing a predetermined collection of tests can leave substantial parts of the intended behavior unimplemented. We propose Generative Test-Driven Development (GTDD), a formulation of test-driven development in which a separate testing agent generates new inputs after each candidate implementation is fixed, using a human-specified behavioral contract and the feedback from earlier rounds. A trusted evaluator checks these inputs, returns reduced counterexamples to the coding agent, and saves them for regression testing, so development continually confronts failures beyond the initial examples. We characterize the evidence that this process provides through a finite-population analysis of false acceptance under adaptive candidate selection. The resulting bounds quantify how test visibility and repeated feedback affect acceptance, and show that fresh random audits after candidate commitment control false acceptance across development rounds. In a paired experiment on a stateful key-value store, both policies that regenerated tests during development ended with lower mean failure rates than the policy whose tests were generated once by the same language model, and giving the tester the candidate's source produced no detectable additional improvement. Further conditions requesting equal numbers of tests did not isolate any single feature of the policies as the source of this difference. GTDD combines this adaptive development feedback with established regression tests and an independent acceptance rule.
Figures & tables
| Test selection | Sufficient size condition | New cases per round |
|---|---|---|
| Known fixed tests | after setup | |
| Hidden fixed tests | after setup | |
| Uniform generation | ||
| Fresh audit |
| Guarantee target | Exact | Exponential | |
|---|---|---|---|
| One candidate | |||
| Repository over rounds | |||
| family conclusions |
| Hidden test-set size | Union lower bound | Exact success |
|---|---|---|
| Failures | Risk | Pass at | Pass at | Pass at |
|---|---|---|---|---|
| Condition | Round 1 | Round 2 | Round 3 | Round 4 | New counterexamples in round 3 |
|---|---|---|---|---|---|
| Public only | — | ||||
| Static property | |||||
| Static LLM | |||||
| Dynamic blind | |||||
| Dynamic informed |
| Contrast (first minus second) | Difference | 95% interval | Lower and higher | |
|---|---|---|---|---|
| Dynamic informed static LLM | ||||
| Dynamic informed dynamic blind | ||||
| Dynamic blind static LLM | ||||
| Dynamic informed static property | ||||
| Static property static LLM | ||||
| Dynamic informed public only |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Condition | Round 1 | Round 2 | Round 3 | Round 4 | Valid tests |
|---|---|---|---|---|---|
| Static LLM | |||||
| Static LLM 600 | |||||
| Staged 600 | |||||
| Regenerated without history | |||||
| Dynamic blind | |||||
| Blind rerun |
| Contrast (first minus second) | Difference | 95% interval | Lower and higher | |
|---|---|---|---|---|
| Staged 600 static LLM 600 | ||||
| Regenerated without history staged 600 | ||||
| Blind rerun regenerated without history | ||||
| Static LLM 600 static LLM | ||||
| Blind rerun dynamic blind | ||||
| Blind rerun static LLM 600 |
| Contrast (first minus second) | Mean | Median | Trimmed mean | Sign test |
|---|---|---|---|---|
| Dynamic informed static LLM | ||||
| Dynamic informed dynamic blind | ||||
| Dynamic blind static LLM | ||||
| Dynamic informed static property | ||||
| Static property static LLM | ||||
| Dynamic informed public only |
Automated Software Testing
Automated software testing uses tools and algorithms to generate, run, and evaluate tests that find defects and prevent regressions.
See all 131 papers