← Community

27 AUG 2026 · SIGIST Sweden

Error 500: Internal Testing Times - Does TDD Actually Help Inside an AI Agent's Loop?

A small Thoughtworks experiment found no evidence that prompting an AI coding agent to follow TDD produces better designs, better tests, or better mutation scores than just letting it write code freely — and costs three to eight times the tokens to do it.

Test-driven development is one of the few practices in software engineering that gets treated as settled wisdom rather than an ongoing debate. Write the test first, watch it fail, make it pass, refactor, repeat — the discipline has decades of advocates and a reasonably solid track record with human developers. So when AI coding agents showed up, the instinct across the industry was to just tell them to do TDD too. Birgitta Böckeler, a Distinguished Engineer at Thoughtworks, decided to actually check whether that instinct holds up, instead of assuming it does. (source: Martin Fowler)

What's going on

Böckeler set up an exploratory (her word — she's careful not to oversell it) comparison: small, medium, and large greenfield coding tasks, each run multiple times with an agent instructed to follow full TDD inside its own loop, and multiple times with no TDD instructions at all. A separate model judged how well each run actually followed TDD, and a third, independent model — without knowing which approach produced which solution — ranked the resulting code and tests on design, code quality, and test quality. She also measured mutation scores, a way of testing whether a test suite actually catches injected bugs rather than just existing. (source: Martin Fowler)

The result, in her own summary: no clearly discernible difference in quality based on TDD versus no TDD — and if anything, the non-TDD solutions were ranked slightly higher more often than not, with no meaningful difference in mutation scores either way. Across the small and medium tasks, non-TDD solutions took the top two ranking spots in most batches, with TDD solutions landing third and fourth. Only once, after she strengthened the prompt with explicit refactoring instructions, did a TDD solution rank first — and in that same batch, a second TDD run with the identical prompt ranked dead last. (source: Martin Fowler)

The cost side is where the finding gets sharper. TDD runs consistently used far more tokens than non-TDD runs — anywhere from roughly 3x to 8.5x depending on task size, driven by dramatically more turns and tool calls. For the smallest task, that meant close to a million tokens for TDD versus around 120,000 without it, for a result that a blind judge ranked lower. (source: Martin Fowler)

Why it matters

Böckeler's own explanation for why TDD underperformed is the most useful part of the piece, and it cuts against a comfortable assumption about how these practices transfer. Her hypothesis, informed by a colleague's observation, is that non-TDD runs tended to design the full solution — architecture, data types, edge cases — before writing any code, while TDD instructions actively worked against that upfront thinking: the design instead emerged from a series of locally-minimal decisions shaped by whatever the first test happened to lock in, and anything the agent didn't think to write a test for simply never got implemented. (source: Martin Fowler)

That points at something deeper than "TDD doesn't work for agents." Böckeler walks through TDD's classical human benefits one by one — avoiding tautological tests, driving testability, red-green as proof a test actually catches something, small steps enforcing restraint, and Kent Beck's original framing of TDD as fear management — and finds that most of them depend on a human being the one experiencing the friction. A red test only proves something if someone is watching why it went red and could have caught a wrong reason; an agent that both writes the test and confirms the failure doesn't provide that check on itself. Small steps enforcing restraint assumes the implementer doesn't already have the entire spec in front of them, which an agent typically does. Beck's "managing fear" framing is explicitly about giving a human permission to relax — it doesn't obviously transfer to a process with no human in the step-by-step loop at all. (source: Martin Fowler)

Different angles

It's worth being honest about how small and informal this study is — Böckeler says so herself, repeatedly. A handful of batches, tasks that were all relatively small greenfield business logic, and quality judgment left almost entirely to one AI model's on-the-fly rubric. She explicitly invites someone with more time and tokens to run a larger version. This isn't a rigorous controlled trial; it's a first, transparent look that raises a hypothesis worth testing further, not a verdict.

It's also genuinely interesting that this finding sits in tension with a view that came out of Böckeler's own professional circle just months earlier. At Thoughtworks and Martin Fowler's own Future of Software Development Retreat in February 2026, one of the widely-reported takeaways was the opposite framing: that TDD had become "the strongest form of prompt engineering," on the logic that tests written before code give agents a deterministic, executable specification that prevents them from quietly validating broken behavior. (source: LavX News) That's not a rival vendor's marketing claim — it's a view from inside the same community that produced this experiment, which makes the disagreement more interesting than a typical "vendor vs. skeptic" split. The honest reading is probably that both things can be true depending on which TDD workflow is meant: Böckeler is specifically testing the fully-autonomous, no-human-checkpoint version of TDD, and she's explicit that a human-in-the-loop review step at any point in the process is a different claim than the one her experiment addresses.

What this means for SIGIST members

If your team has been instructing coding agents to follow strict TDD purely on the assumption that "it works for humans, so it should work for agents," this is a reasonable moment to check that assumption against your own results rather than take it on faith — in either direction. Böckeler's own conclusion is worth sitting with: she's stopped telling her coding agents to write tests first, and instead focuses on getting the outcomes TDD used to guarantee through other means — mutation testing to check regression quality, static analysis and structural reviews to trigger refactoring, and human-reviewed "approved scenarios" to get some of the confidence TDD used to provide. The generalizable lesson isn't "abandon TDD" — it's "measure the outcome you actually want (test effectiveness, good design, confidence) rather than assuming a specific process guarantees it once a human isn't the one doing the process."

Worth raising at the next meetup: has anyone on your team actually measured whether your AI-assisted TDD workflow produces better mutation scores or cleaner designs than the alternative — or is it running on the same assumption Böckeler decided to go test for herself?

← Community

Was this useful?

STAY IN THE LOOP

Enjoyed this? Get the next one by email.

Join The Dispatch — our occasional digest of community write-ups, events and reading picks.

Keep me posted