Technology and Engineering Atlas

How Things Are Built
Sign In
Text size
100%
Theme
Method

Test-Driven Development

Software Engineering

Test-driven development is a software engineering method in which a programmer writes an automated test for a small piece of intended functionality before writing the code that implements it, then writes just enough code to make that test pass, and finally refactors the code to improve its structure while keeping the test passing, repeating this cycle for each new piece of functionality. The practice, popularized by Kent Beck as part of extreme programming in the late 1990s, aims to produce a comprehensive suite of automated tests as a natural byproduct of writing the code itself, catching regressions early and giving developers confidence to change or refactor a codebase without breaking existing behavior.

Facts
Core Principle
Test-driven development is a way to write source code that involves writing an automated unit-level test case that fails, then writing just enough code to make the test pass, then refactoring both the test code and the production code, then repeating with another new test case. 1
Origin Year
2003 1
2003 is when Kent Beck stated his own account of rediscovering and formalizing the technique; the underlying practice traces to an older, unnamed method he describes reading about.
FAQs

What commonly goes wrong with test-driven development?

Common mistakes include trivial or oversized tests and a poorly maintained or abandoned test suite.

The Agile Alliance lists typical individual mistakes such as forgetting to run tests frequently, writing too many tests at once, writing tests that are too large or coarse-grained, writing overly trivial tests that omit assertions, and writing tests for trivial code such as accessors. It also lists team pitfalls: only a few developers on the team using the practice, poor maintenance of the test suite that leaves it with a prohibitively long running time, and an abandoned test suite that is seldom or never run.
Connections

Associated With

In Field

Sources
1. Test-driven development (Wikipedia)
Wikipedia contributors, Wikimedia Foundation
  • en.wikipedia.org/wiki/Test-driven_development, lead section
    writing an automated unit-level test case that fails, then writing just enough code to make the test pass, then refactoring both the test code and the production code, then repeating with another new test case
  • en.wikipedia.org/wiki/Test-driven_development, History section
    Software engineer Kent Beck, who is credited with having developed or "rediscovered" the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.
  • In Group: Software Development Processes, Introduction
    Test-driven development (TDD) is a way to write source code that involves writing an automated unit-level test case that fails, then writing just enough code to make the test pass, then refactoring both the test code and the production code, then repeating with another new test case.
View the Source
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.

View At A Past Year

Choose a year to see this entry's facts and connections as the atlas records them at that moment: what it held then, what it held instead, and what it had not yet adopted. Choose Present for the current record.