Chapter 12. Test First Development?

Tests are great for showing that a feature is not yet implemented.

It has always been an article of faith that programmers cannot really test their own code because they know how it works. Strange as it may seem, Extreme Programming does not challenge this idea; instead, it tries to build on it. Test First Development requires that the Unit Test be written before the production code.

The idea is that before the method is written, the programmer does not know how it will work, so it is safe for the programmer to design the tests. After all, the programmer knows exactly what she wants the method to do, so it is simple for her to write a test that verifies that the method does the right thing.

But Do Programmers Know ...

Get Questioning Extreme Programming 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.