View all services
Talk to QA Advisor
Browse the Knowledge Hub211 resources
/Books/Test Driven Development: By Example
Books · Honest notes

Test Driven Development: By Example: is it worth reading?

The book that defined TDD, written as two worked examples rather than as a methodology.

We earn nothing from any link on this page. No affiliate links anywhere in this library.

published
2002
key ideas
3
reading path
1

Reviewed by Viral Patel

Co-Founder, QAble

Cover of Test Driven Development: By Example
Unit testing & TDD

Test Driven Development: By Example

by Kent Beck

Publisher
Addison-Wesley
Year
2002
ISBN
9780321146533

Useful when you are: Practising tester, Senior / lead

Verdict

Should you read it?

Read it if

You want to understand TDD from its source rather than from a summary. It is short and the worked examples carry the explanation better than any description.

Skip it if

You do not write production code, or you want guidance on testing an existing untested codebase. For that, read Feathers instead.

The argument

What it argues

Beck demonstrates TDD by doing it, at length, in two examples: a multi-currency money model and a small testing framework. You watch the red-green-refactor cycle applied step by step, including the steps that in hindsight were wrong.

The argument is that TDD is a design practice rather than a testing one. Writing the test first forces you to decide the interface before the implementation, and the discipline of taking small steps keeps you from building more than is needed.

The second example, building a testing framework using itself, is the more interesting half and the part people skip.

Key ideas

Ideas worth taking from it

  1. 01

    Red, green, refactor

    Write a failing test, make it pass in the simplest way, then improve the design with the test holding behaviour constant. The cycle that defines the practice.

  2. 02

    TDD as design

    The tests are a by-product. The value is being forced to specify the interface before the implementation, which produces more testable code almost incidentally.

  3. 03

    Small steps and fake it till you make it

    Deliberately writing an obviously insufficient implementation to get to green, then generalising. Counterintuitive and genuinely effective at avoiding over-building.

Criticism

What has dated, and what it gets wrong

The Java and Python examples are dated and the second example in particular feels archaic now. The deeper limitation is that it shows TDD on small, self-contained problems and says almost nothing about applying it to code with substantial dependencies, which is where most people actually get stuck.

Reading paths

On our reading paths

Becoming an automation engineer

Book 1 of 5 · Automation and SDET

Short and practical. It teaches the red, green, refactor rhythm and, more usefully, how small and focused a test can be.

  1. Cover of Test Driven Development: By Example1. Test Driven Development: By Example (this book)
  2. Cover of Unit Testing Principles, Practices, and Patterns2. Unit Testing Principles, Practices, and Patterns
  3. Cover of Growing Object-Oriented Software, Guided by Tests3. Growing Object-Oriented Software, Guided by Tests
  4. Cover of Working Effectively with Legacy Code4. Working Effectively with Legacy Code
  5. Cover of Specification by Example5. Specification by Example

Keep reading

What to read next

Ready

Reading about quality is cheaper than learning it in production.

QAble runs QA for products in BFSI, gaming, healthcare and SaaS, with engineers who have read these and argued about them. Start with a free QA audit.

Talk to QA Advisor