GTDD: Generative Test-Driven Development for AI Coding Agents with Adversarial Testing
cs.SE, cs.LG, stat.ME, stat.ML
Submitted: 2026-10-02
Updated: 2026-10-02
License: http://creativecommons.org/licenses/by-nc-nd/4.0/
The gist: Test-driven development gives AI coding agents executable requirements for implementing software.
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.
Sources
- Concrete Problems in AI Safety
- Monitoring Reasoning Models for Misbehavior and the Risks of Promoting Obfuscation
- Test vs Mutant: Adversarial LLM Agents for Robust Unit Test Generation
- Evaluating Large Language Models Trained on Code
- Generalization in Adaptive Data Analysis and Holdout Reuse
- AgentCoder: Multi-Agent-based Code Generation with Iterative Testing and Optimisation
- Do Code Language Models Use Tests? A Behavioral and Representational Study of Test-Driven Code Generation
- Scaling Test-Driven Code Generation from Functions to Classes: An Empirical Study
- A Theoretical Analysis of Test-Driven Code Generation
- Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineering
Related papers
- Falsification-Based Verification of LLM-Generated Optimization Models: Sound Test Batteries and Their Detection Limits
- GitSkills: A Dataset of Agent Skills on GitHub
- SABER: Benchmarking Operational Safety of LLM Coding Agents in Stateful Project Workspaces
- PackMonitor: Enabling Zero Package Hallucinations Through Decoding-Time Monitoring
- IntentCoding: Amplifying User Intent in Code Generation
- Incentives and Outcomes in Bug Bounties