2 Exploring core JUnit

This chapter covers

  • Understanding the JUnit life cycle
  • Working with the core JUnit classes, methods, and annotations
  • Demonstrating the JUnit mechanisms

Mistakes are the portals of discovery.

--James Joyce

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

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