Chapter 10Practice 6: Write the Test First

Isn’t TDD dead?

Some people are claiming that the practice we’ll discuss next, test-driven development (TDD), is dead and gone. It was a nice idea, they say, but hasn’t worked out in practice. They speak of “test-induced damage” caused by over-testing where people write too many tests or implementation-dependent tests that end up being a burden rather than an asset.

And they’re right.

I’ve seen “test-induced damage” before—when developers don’t know when to stop writing tests.

A key benefit of the tests software developers create by doing test-first development is they support us when we have to change existing code. But when developers write too many tests, or write implementation-dependent tests, ...

Get Beyond Legacy Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.