Chapter 6. Running JUnit tests
This chapter covers
- Monitoring JUnit tests as they execute
- Executing individual tests
- Executing tests that need to reload classes
- Ignoring tests
- Using the JUnit-addons test runner
There are a number of ways to execute your tests, including a large variety of test runners, not all of which have the same set of features. JUnit provides three test runners: a text-based one, an AWT-based one, and a Swing-based one. We will describe each in turn. In addition to the ones that JUnit provides, a number of people have built their own test runners that include special features not found in the originals. The JUnit test runners were not built to be easily extended, and so whenever someone has wanted to add features, it has been shown to be easier to build a new test runner from the ground up. A person builds a custom test runner because he is either having a problem running tests in the current project or environment, or because a particular feature is needed that isn’t available. You might find yourself in either of these same situations. The recipes in this chapter focus not only on solving such problems with your test runner, but also on finding the special features you might need in a test runner. For basic tutorials on the various test runners, refer to their web sites. Now, let’s take a tour through the various test runners.