liveBook · Manning

Test-driven development

As explained in Unit Testing Principles, Practices, and Patterns

Test-driven development is a software development process in which tests guide incremental implementation and refactoring.

Test-driven development uses tests to drive project development through a repeated cycle: specify behavior, implement minimally, then improve the design. section 2.3

Repeat these stages for each test case:

  • Write a failing test that identifies the required functionality and expected behavior. section 2.3
  • Write only enough code to make the test pass; elegance can wait. section 2.3
  • Refactor under the protection of the passing test to improve readability and maintainability. section 2.3

The London style leads to outside-in TDD: higher-level tests define system expectations, mocks specify collaborator communication, and implementation proceeds through the class graph. section 2.3

How Unit Testing Principles, Practices, and Patterns covers it

How deep it goes
Defines a repeatable three-stage loop and extends it to outside-in system design with mocks.
Examples
Uses failing tests, minimal implementations, passing-test protection, and collaborator expectations as concrete artifacts.
What you can do after
Build it incrementally through failing tests, minimal implementations, and protected refactoring.
How it connects
Connects unit testing, refactoring, mocks, collaborators, system design, and over-specification.

Also explained in

Compare how 15 books explain test-driven development →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.