Cover by Gary Gregory, Vincent Massol, Felipe Leme, Petar Tahchiev

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 2. Exploring core JUnit

Mistakes are the portals of discovery.

James Joyce

This chapter covers

  • Using the core JUnit classes
  • Understanding JUnit mechanisms
  • Understanding the JUnit lifecycle

In chapter 1, we decided that we need a reliable and repeatable way to test our program. Our solution is to write or reuse a framework to drive test code that exercises our program’s API. As our program grows with new classes and new methods to existing classes, we need to grow our test code as well. Experience has taught us that sometimes classes interact in unexpected ways; we need to make sure that we can run all of our tests at any time, no matter what code changes took place. The question becomes, how do we run multiple test classes? And ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required