Section: IT & Technology · Software DevelopmentDifficulty: Medium

Test-Driven Development

USUK

A development practice where tests are written before production code.

Also: TDD

Definition

Test-Driven Development (TDD) is a software development methodology where developers write failing tests before writing any production code, then write the minimum code needed to make tests pass, and finally refactor. This red-green-refactor cycle ensures comprehensive test coverage, drives modular design through the need for testable code, and provides a safety net for refactoring. TDD produces living documentation and reduces debugging time by catching regressions immediately when code changes.

Example

A developer writes a failing test asserting that calculateDiscount(100, 0.1) returns 90, then implements the function until the test passes, then refactors for clarity before writing the API endpoint that calls it.

Synonyms

  • test-first development
  • red-green-refactor
  • test-driven design

Antonyms / Opposites

  • code-first development
  • untested code
  • no unit tests

Images

CC-licensed · free to use
More on Wikimedia
Loading images…

Video

  • unit-testing
  • solid-principles
  • dependency-injection
  • cicd

Dictionary Entry

Back to IT & Technology