ModelJUnit is a Java library which enhances JUnit's functionality by adding support for model-based testing.
The release of ModelJUnit 1.0 is a must-have for Java users, note that it uses the Java 5.0 annotations feature, so it requires JDK 1.5 or a higher version to operate. Notably, this version was presented in August 2007 by Mark Utting during a Google Tech Talk, introducing model-based testing within the first 30 minutes of the presentation. Discussion about ModelJUnit starts from 28:20 onwards, with a more sophisticated commercial tool, LEIRIOS Test Designer, discussed from 43:50 onwards.
To get access to the tool, you need the ModelJUnit.jar file, which was compiled with JDK 1.6. To learn more about how to operate ModelJUnit, users can easily access online Javadoc documentation for ModelJUnit by starting with the Description of the modeljunit package or downloading a modeljunit.zip version of the documentation.
The source code of ModelJUnit is part of the CZT project, and development sources can is checked out through two commands: svn co modeljunit and svn co pom.xml. Generating tests from this model is simple; with pertinent execution of Java code, users can generate tests. The main method of the FSM class offers a more sophisticated version that also evaluates model coverage metrics.
While users can print messages as the model is executed, ModelJUnit is versatile for offline and online testing. For the latter, the test generation code is written within the TestXYZ() methods of JUnit test classes. Each time the JUnit test suite runs, it generates a suite of tests from the FSM model. Similarly, the @Action… methods in the model class will recognize the @Action methods of the SUT to check its status and return value.
ModelJUnit has an experimental Lethal feature that lets users generate tests using a GUI interface by pointing and clicking, or by generating the code that generates the tests. To run the GUI, users must include modeljunit.jar and junit.jar in the classpath and then run java net.sourceforge.czt.modeljunit.gui.Main.
Version 1.0: N/A