TDD
Test-Driven Development is a workflow where you write a failing test first, write the minimum code to make it pass, then refactor — repeated in tight loops. Popularised by Kent Beck in the early 2000s, TDD's main value isn't bug catching but design pressure: the act of writing the test forces you to think about the interface before the implementation, producing cleaner code.
TDD's tight loop (write test → run it red → write code → run it green → refactor → repeat) is sometimes called Red-Green-Refactor. The discipline pays off most when the code under test has clear behavioural boundaries — pure functions, data transformations, business logic. It's awkward for UI work, integration with hard-to-mock systems, and exploratory programming where you don't yet know the right interface. Teams that adopt TDD report fewer defects shipping but often slower initial development speed; the trade-off shifts in TDD's favour as the codebase ages.
Long-form posts that explore tdd in depth — when to use it, common failure modes, how AI helps.
- Are AI-generated test cases worth shipping?Yes, with a sharp caveat — when they're tied to AC and reviewed by a human. Five categories where AI test generation is great, five anti-patterns to catch.9 min read
- Can AI write Gherkin? (yes — here's how)Yes. AI writes Gherkin well, often better than humans for surface area coverage. Five wins, five recognisable failure modes, and the prompts that work.8 min read
Related terms
- BDD
Behavior-Driven Development is a software practice that builds on TDD by writing tests in business-readable, scenario-style language (typically Gherkin).
- Gherkin
Gherkin is a structured plain-English DSL for writing executable acceptance tests, using the Given / When / Then format.
- Regression test
A regression test verifies that previously working functionality still works after a code change.
- Acceptance criteria
Acceptance criteria are the conditions a story must satisfy to be considered complete — testable, bounded statements describing what the system does.