JUnit Expansions

The number of expansions and add-ons developed and maintained for JUnit has grown continuously. Some of them were introduced in Parts I and II of this tutorial. A current list of these additional tools is maintained on the JUnit Web page at [URL:JUnitExt]. The following list is not complete, but it includes the most important additional tools available at the time of writing this tutorial. To spare the reader from having to look up references in the bibliography, we directly list the URLs in this appendix.

JUnitX and XPTest

JUnitX offers a way to access private or protected variables, methods, and classes in test cases. The tool builds on the latest JUnit version and uses the Java reflection mechanism. XPTest combines and integrates JUnit and JUnitX in the UML modeling tool TogetherJ. This also allows automatic creation of test cases by using the pattern mechanism of TogetherJ.


Daedalos JUnit Extensions

The JUnit extensions of Daedalos allow you to define testing resources that are initialized only once. This can speed up some test suites. URL:


This expansion allows testing of Swing user interfaces. , , introduced JFCUnit in an example.



JUnitPP expands JUnit by a test data repository, some command line arguments, a built-in iteration counter, and multi-threading from the command line.


Mock Objects

This library offers both an extensive base of generic mock objects and some specialized packages, for example, for testing of JDBC connections and servlets. The concept of mock objects was described in .



MockMaker is a tool that serves to create source code for mock objects and builds upon the mock objects library. The tool starts from an interface and generates classes allowing both the specification of the expected behavior and return of predefined function values. URL:


This package allows you to define simple mock objects directly in the test code, without the need to write your own mock classes. The underlying Java proxy mechanism is available from JDK Version 1.3 and higher.



JXUnit allows you to separate test data from the test logic by dumping the test data into XML files. This is more interesting for functional test suites than for fine-grained unit tests.



JUnitHelp offers general information and tips about the use of JUnit in HTML and JavaHelp format.



Joshua was designed for the distributed execution of regression tests, based on Jini and JavaSpaces, in addition to JUnit.



JDepend makes its way hand over hand through a set of Java class files and Java source directories and for each package, determines metrics on dependencies upon other packages. Properly interpreted, the figures provide hints about expandability, reusability, and maintainability of a package. You can test automatically for permitted tolerances of specific measurement values in JUnit test cases.



JesTer uses the mutation testing approach to offer a completion to conventional coverage analyses. This type of testing is based on targeted changes to the app code and subsequent checks to determine whether or not the original test suite detects these changes as errors. This means that you can identify code parts run within the suite, but with effects not verified in the tests. , , classified this approach into the classic coverage analysis.



HttpUnit is a framework to address external Web sites in a Java program. One possible use in combination with JUnit is to run automated Web function tests. , , introduced this use in an example.



This package uses a test runner servlet to run server-side test suites. One possible use is testing EJBs (see , ). URL:

Canoo WebTest

Canoo WebTest is a free open source tool for automated testing of Web apps. It calls Web pages and verifies the results, giving comprehensive reports on success and failure. The test scripts are specified in XML as ANT tasks and use HttpUnit behind the scenes.



Cactus is another tool that allows you to run server-side tests. In contrast to JUnitEE, this tool uses proxy servlets, which establish the connection to client test cases. , , introduced Cactus in theory and practice.



JUnitPerf represents a collection of "test decorators" you can use to check performance and scalability.


J2ME Unit

Java 2 Microversion was designed for devices with scarce storage and resources. This means that the virtual machine may not support reflection, making it necessary to adapt JUnit. A JUnit port for this platform, J2ME Unit is available. URL:

Test Mentor Java version

To my knowledge, Silvermark's Test Mentor is the only commercial software that supports the same test approach as JUnit and can even run JUnit test cases. In addition, this product offers a large number of additional functions, including graphical tools for test creation and documentation, management generic test modules, and test result management on XML basis.