Copyright 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

O'Reilly logo

Chapter 29. xUnit Patterns

These are patterns for using one of the xUnit family of testing frameworks.

Assertion

How do you check that tests worked correctly? Write boolean expressions that automate your judgment about whether the code worked.

If we are going to make the tests fully automated, then every bit of human judgment has to be taken out of the evaluation of the results. We need to push a button and make all of the decisions necessary to verify the correct working of the code that the computer runs. This suggests the following.

  • The decisions have to be boolean—True generally means everything is okay, and false means something unexpected happened.

  • The state of the booleans have to be checked by computer, by calling some variant of an assert() ...

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