How do I extend JUnit?
JUnit is a testing framework intended to be customized for specialized use. Browsing the JUnit source code is an excellent way to learn its design and discover how it can be extended. Examples of JUnit extensions can be found in the junit.extensions package: * TestDecorator A decorator for Tests. You can use it as the base class for implementing new test decorators that add behavior before or after a test is run. * ActiveTestSuite A TestSuite that runs each test in a separate thread and waits until all threads have terminated. * TestSetup A TestDecorator to initialize and cleanup test fixture state once before the test is run. * RepeatedTest A TestDecorator that runs a test repeatedly. * ExceptionTestCase A TestCase that expects a particular Exception to be thrown. Kent Beck has mentioned that ExceptionTestCase likely does not provide enough to be useful; it is just as easy to write the “exception test” yourself. Refer to the Writing Tests section for guidance.