Core idea
Test-driven development (TDD) is a software-development approach in which tests are written before implementation, with the implementation then developed against those tests. In AI-assisted coding, this can mean a human writes tests first, a human reviews agent-generated failing tests before implementation, or the agent independently writes tests and then implements the solution.1
TDD inside an AI agent loop
Martin Fowler’s exploratory evaluation examined the third pattern: an agent writing tests before its own implementation.1 The evaluation used Claude/Sonnet to generate solutions and Opus to judge them, comparing TDD-style and non-TDD runs on several greenfield business-logic tasks, with each run targeting at least 80% test coverage.1
The evaluation found no clear quality advantage for TDD in the agent loop; Opus often ranked non-TDD solutions slightly higher for design and test quality, while mutation scores were similar.1 Fowler suggests that non-TDD runs may have benefited from considering architecture, data types, and edge cases as a whole before implementation, whereas incremental test-first decisions could cause an agent to settle on a design too early and leave behavior unimplemented.1
Interpretation and limits
These results are exploratory rather than conclusive: the reported comparison involved a small set of tasks and a particular model-based evaluation setup.1 They do not establish that TDD is generally ineffective, nor do they address all ways humans and agents can collaborate around tests.1 The practical implication is narrower: requiring a coding agent to simulate the full human TDD cycle should not be assumed to improve design or testing quality; outcomes should be evaluated for the task and workflow at hand.1
Evidence from AI coding agents
Martin Fowler’s exploratory comparison used five batches of greenfield business-logic tasks, with TDD and non-TDD agent runs targeting at least 80% code coverage.
“I created 5 batches of solutions, with two non-TDD and two TDD solutions each.”
“_Instructions:_ In all runs, I included instructions to achieve at least 80% code coverage.”
The updated article reports no clear quality or mutation-testing advantage for agent-performed TDD; non-TDD solutions were often judged slightly higher, with upfront design offered as a possible explanation.