Chapter 1. The big picture

I can stand brute force, but brute reason is quite unbearable.

Oscar Wilde

“Only ever write code to fix a failing test.” That’s test-driven development, or TDD,[1] in one sentence. First we write a test, then we write code to make the test pass. Then we find the best possible design for what we have, relying on the existing tests to keep us from breaking things while we’re at it. This approach to building software encourages good design, produces testable code, and keeps us away from over-engineering our systems because of flawed assumptions. And all of this is accomplished by the simple act of driving our design each step of the way with executable tests that move us toward the final implementation.

1 The acronym ...

Get Test Driven: Practical TDD and Acceptance TDD for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.