NOTE: This site is archived content and is, for the most part, no longer being actively updated. Information on a permanent new home for JMLUnitNG will be available soon; the most recent version released before this site was archived will continue to be available here.


JMLUnitNG is an automated unit test generation tool for JML-annotated Java code, including code using Java 1.5+ features such as generics, enumerated types, and enhanced for loops. Like the original JMLUnit, it uses JML assertions as test oracles. It improves upon the original JMLUnit by allowing easy customization of data to be used for each method parameter of a class under test, as well as by using Java reflection to automatically generate test data of non-primitive types. An initial version of JMLUnitNG was introduced at FoVeOOS 2010 in the paper JMLUnit: The Next Generation, though some of the information in that paper is now out of date.

The tests generated by JMLUnitNG use the TestNG unit testing framework, and can be run (assuming an appropriately-configured CLASSPATH) by themselves or as part of larger TestNG suites. Currently, JMLUnitNG generates tests for OpenJML RAC, JML4 RAC (as compiled by jml4c, available from the University of Texas, El Paso) and JML2 RAC (as compiled by jmlc, part of the Common JML Tools); since only OpenJML RAC and JML4 RAC support modern Java features, the classes under test may not use such features when generating tests for JML2 RAC.

The current version of JMLUnitNG is 1.4, released 22 May 2014. A full history (including changes) of released JMLUnitNG versions is available, including download links for all versions.

A future version will include a source distribution and appropriate buildfiles/Eclipse projects, as well as more extensive documentation; currently, the only documentation (other than the help text displayed when running the Jar with no parameters) consists of the Usage page and the Javadoc for the classes comprising JMLUnitNG. Note that, while JMLUnitNG includes all the libraries on which it depends in the executable Jar, actually compiling and running the generated tests requires you to include both the JMLUnitNG Jar and the appropriate JML runtime Jar on the CLASSPATH (jml4rt.jar for JML4 RAC, jmlruntime.jar for JML2 RAC). There is no separate runtime Jar for JMLUnitNG.

Currently, limitations of both JML2 and JML4 require special compilation steps, described on the Usage page, in order to actually execute JMLUnitNG tests. Moreover, it is strongly recommended that OpenJDK 7 be used to run JMLUnitNG on Mac OS X; see the OpenJML on Mac OS X page for more details. The only part of using JMLUnitNG for which OpenJDK is recommended is the test generation step.

If you have questions/comments/suggestions about JMLUnitNG, please send them to me at dmz at acm dot org.