SE450: JUnit: The JUnit Framework [31/41] Previous pageContentsNext page

JUnit is itself a good example of OO design. It contains a number of patterns that we will look at later. First, we will look at the various classes and interfaces that you will need to work with as you use the framework.

abstract classTestCase implements Test

The TestCase is the foundation of the framework. It is an abstract class that you must extend for each one of your TestCases.

The Test interface is used to collect TestResults

The concept of a Fixture is used to hold multiple tests that operate on the same set of objects. You can add more tests to your Fixture without much effort, allowing you to create tests to handle different scenarios.

Once you have multiple tests in a Fixture, you can run them together by creating a TestSuite. Since TestSuite also implements the Test interface, you can add TestSuites and Tests together and run them in one suite.

A higher level class diagram of JUnit.

Previous pageContentsNext page