O'Reilly logo

Test Driven Development: By Example by Kent Beck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 21. Counting

Invoke test methodInvoke setUp firstInvoke tearDown afterwardInvoke tearDown even if the test method failsRun multiple testsReport collected resultsLog string in WasRun

I was going to include an implementation to ensure that tearDown() is called regardless of exceptions during the test method. However, we need to catch exceptions in order to make the test work. (I know, I just tried it, and backed it out.) If we make a mistake implementing this, then we won't be able to see the mistake because the exceptions won't be reported.

In general, the order of implementing the tests is important. When I pick the next test to implement, I find a test that will teach me something and which I have confidence I can make work. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required