ModelJUnit is a Java library that extends JUnit to support model-based testing.
In this example, we will consider how to model and test the example from the ModelJUnit website. The system under test is illustrated by the following state diagram:
The FSM class models this system. Our script makes use of the RandomTester class to generate some tests for this model. The total code looks like this:
When we run this script, we will see the randomly generated test transitions. The output will be:
Labels