I just finished reading Kent Beck’s recent piece where he argues that TDD prevents AI agents from writing tests that verify broken behavior. It hit me hard because I’ve been fighting with GitHub Copilot for months trying to maintain a test-first workflow.
Here’s my confession: I think AI copilots are killing my TDD discipline, and I’m not sure if I should fight it or embrace it.
The Core Problem: AI Wants Implementation First
Traditional TDD workflow:
- Write a failing test (red)
- Write minimal code to pass (green)
- Refactor for clarity (refactor)
AI copilot workflow in practice:
- Start writing a test
- Copilot suggests the implementation code
- I get tempted to accept it because it looks right
- Now I’m writing tests to validate code I already have
- Red-green-refactor becomes green-green-refactor
The problem is AI is trained on implementation-first code. It has seen millions of examples where the implementation exists and tests are written after. When I’m trying to do TDD, the AI actively works against me by suggesting solutions before I’ve fully specified the problem.
Does TDD Actually Matter With AI?
Kent Beck’s argument is compelling: when you write tests first, AI can’t cheat by writing tests that verify whatever buggy implementation it produced. The test is the specification, and the AI has to meet that specification.
But I’m struggling to see this work in practice:
Scenario 1: I write the test first
test('should calculate compound interest correctly', () => {
const result = calculateCompoundInterest(1000, 0.05, 10);
expect(result).toBe(1628.89);
});
As soon as I hit enter, Copilot suggests an implementation. Great! But did it actually understand compound interest, or did it just pattern-match from its training data? I don’t know what I don’t know.
Scenario 2: I accept the AI implementation first
Now I’m writing tests to verify the AI’s code. The test might pass, but am I testing the right behavior or just confirming the AI’s assumptions?
The Workflow Friction
Here’s what TDD with AI feels like:
- Constantly fighting autocomplete suggestions
- Having to deliberately ignore helpful-looking code
- Feeling like I’m slowing myself down by being “pure” about test-first
- Questioning whether the discipline adds value when AI can generate both tests and implementation
Meanwhile, my teammates who abandoned TDD are shipping features 2x faster. Their code has AI-generated implementations with AI-generated tests. Coverage looks good. Bugs… well, we haven’t seen a spike yet.
Test-Driven Generation (TDG)?
I came across this concept of “Test-Driven Generation” - using tests as specifications for AI to generate against. It sounds like TDD, but with AI as the implementation engine.
The idea: Write comprehensive tests that specify behavior, then let AI generate the implementation that satisfies those tests. Iterate until all tests pass.
Has anyone actually made this work? It sounds great in theory, but in practice:
- How do you know your tests specify the right behavior?
- What if the AI satisfies your tests but introduces bugs you didn’t think to test for?
- Aren’t you just deferring the “do I trust this” question from implementation to tests?
My Question for the Community
Has TDD survived contact with AI coding tools in your workflow?
Are you:
- Still practicing strict TDD (test-first, no exceptions)?
- Doing “test-adjacent development” (write tests early but not always first)?
- Abandoned TDD entirely and relying on AI + good coverage?
- Found some hybrid approach that works?
And more importantly: If you abandoned TDD, have you seen quality suffer? Or was TDD just ceremony that AI made obsolete?
I feel like I’m at a crossroads. Keep fighting to maintain TDD discipline, or accept that AI has fundamentally changed how we approach testing. Would love to hear how others are thinking about this.