Chapter 3. Sampling JUnit

This chapter covers

  • Testing larger components

  • Project infrastructure

 

Tests are the Programmer’s Stone, transmuting fear into boredom.

 
 --Kent Beck, Test First Development

Now that you’ve had an introduction to JUnit, you’re ready to see how it works on a practical application. Let’s walk through a case study of testing a single, significant component, like one your team leader might assign to you. We should choose a component that is both useful and easy to understand, common to many applications, large enough to give us something to play with, but small enough that we can cover it here. How about a controller?

In this chapter, we’ll first introduce the case-study code, identify what code to test, and then show how to test ...

Get JUnit in Action 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.