arXiv(opens in a new tab)cs.SEOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.02952

GTDD: Generative Test-Driven Development for AI Coding Agents with Adversarial Testing

Masahiro Kato

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.

1 Introduction

Test-driven development (TDD) organizes software development around executable requirements: developers write tests that describe the intended behavior, implement the corresponding functionality, and use those tests to check subsequent changes (Beck, 2002). This

*Email: mkato-csecon@g.ecc.u-tokyo.ac.jp discipline is especially relevant to AI coding agents because a natural-language request permits many possible implementations, whereas an executable test gives the agent a concrete result against which to improve its code. As large language models (LLMs) take on code generation and repository repair, the connection between tests and successive implementation decisions becomes central to the reliability of the resulting software (Chen et al., 2021; Jimenez et al., 2024; Fakhoury et al., 2024).

Existing systems already use generated tests to structure this interaction. CodeT evaluates candidate programs with generated tests, AlphaCodium uses them throughout an iterative coding process, and AgentCoder assigns programming and test design to separate agents (Chen et al., 2023; Ridnik et al., 2024; Huang et al., 2023). Guidance for Claude Code similarly describes a workflow in which one session writes tests and another writes the implementation (Anthropic, 2026). In an industrial integration setting, Krawczyk (2023) describes generative TDD based on historical input–output pairs that guide code generation and validate the generated mappings. These approaches make testing part of the development process itself, with test results shaping the next implementation.

The same feedback that guides development also allows an agent to adapt to the tested examples without satisfying the full behavioral contract. A program may implement only the exercised cases or special-case their inputs, and an agent with broader access may attempt to change the tests. Additional benchmark tests have exposed incorrect programs that passed the original evaluation (Liu et al., 2023), while reward-optimization experiments have documented direct test subversion (Baker et al., 2025). This is an instance of the more general discrepancy between optimizing an observed objective and satisfying its intended purpose (Amodei et al., 2016; Skalse et al., 2022). Increasing the number of tests and generating new tests during development address different parts of the problem, because acceptance also depends on what the coding agent has learned about those tests. A development framework must therefore specify both how new failures reach the coder and what evidence justifies accepting the resulting implementation.

References (41)