TDD
Abbreviation · Development
Definitions
Test-Driven Development (TDD) is a software development discipline built on a short, repeating cycle called red-green-refactor. First, write a failing test that describes the desired behavior (red). Then write the minimum code needed to make the test pass (green). Finally, refactor the code to improve its structure while keeping all tests passing. This cycle repeats for each small increment of functionality. TDD forces developers to think about requirements and edge cases before writing implementation code, producing designs that are inherently testable. The resulting test suite acts as living documentation and a safety net for future changes. TDD is most effective for business logic and algorithmic code, and is often combined with integration tests for broader coverage.
In plain English: A way of writing software where you write the test before the actual code, then write just enough code to make the test pass.
Example: "Following TDD, I wrote the test for the discount calculator before a single line of business logic existed — then made it green."