Java Reference
In-Depth Information
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 pro-
gram. 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 how do we find out
which tests passed and which ones failed?
In this chapter, we look at how JU nit provides the functionality to answer those
questions. We begin with an overview of the core JU nit concepts—the test class, test
suite, and test runner. We take a close look at the core test runners and the test
suite before we revisit our old friend the test class. We also examine how the core
classes work together.
14
 
 
 
 
Search WWH ::




Custom Search