Chapter 2. Exploring JUnit

This chapter covers

  • Using the core JUnit classes

  • Understanding the JUnit life cycle

 

Mistakes are the portals of discovery.

 
 --James Joyce

In chapter 1, we decided that we need an automatic testing program so that we can replicate our tests. As we add new classes, we often want to make changes to classes under test. Of course, experience has taught us that sometimes classes interact in unexpected ways. So, we’d really like to keep running all of our tests on all of our classes, whether they’ve been changed or not. But how can we run multiple test cases? And what do we use to run all these tests?

In this chapter, we will look at how JUnit provides the functionality to answer those questions. We will begin with an overview ...

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.