Chapter 3

Classic TDD II

I'm not a great programmer; I'm just a good programmer with great habits.

– Kent Beck

Like most developers starting TDD, I encountered a common blocker: coming up with good test names. With experience and a little help from other programmers, I learned to not reach for the test name too soon. I give the test a temporary name; foo is a fine name. Then I concentrate on what the assertion should look like for the behavior I'm testing. Once I get the assertion right, I need to think how I get there. Once I have all this, naming the test becomes so much easier.

Writing the Assertion First and Working Backward

In this lesson, we will write our tests in a slightly different way. When creating a new test, we will go straight ...

Get Agile Technical Practices Distilled now with the O’Reilly learning platform.

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