Model Based Testing Tool
Java Max HTML
Switch branches/tags
Nothing to show
Latest commit f75790e Oct 14, 2016 @mukatee mukatee moved junit integration code to examples to avoid cluttering projects…
… with excess junit imports when using osmotester with other frameworks/versions


Tool for generating and executing test cases.

Test models are expressed as Java programs, which the test generator executes based on annotations defined in the model. The test generator can be configured with different algorithms to generate tests in different ways.

The main point with this approach is to provide:

  • Systematic approach to go through the specification and define it more formally in the form of a test model from which the tool can then be used to automatically generate tests.
  • Automated generation of large number of tests for level of coverage not realistic for manual test creation. The set of coverage elements supported:
  • Variable values (all or category-partitions)
  • Covered steps
  • Covered step-pairs
  • Covered state values (defined by annotated methods with return values)
  • Covered state-pairs
  • Requirements (defined in model as illustrated in the example model below).

Example test model:

public class ExampleModel {
  private final Requirements req = new Requirements();
  private int counter = 0;

  public void start() {
    counter = 0;

  public boolean toDecreaseOrNot() {
    return counter > 1;

  public void decreaseState() {
    System.out.println("- " + counter);

  public boolean shallWeIncrease() {
    return counter > 0;

  public void increaseState() {
    out.println("+ " + counter);

The tests can then be executed by configuring the generator such as:

  public static void main(String[] args) {
    OSMOTester tester = new OSMOTester();
    tester.addModelObject(new ExampleModel());
    tester.setAlgorithm(new RandomAlgorithm());
    tester.setTestEndCondition(new Length(100));
    tester.setSuiteEndCondition(new Length(100));

This generates 100 tests, each with 100 steps. Each step is chosen randomly based on the set of enabled steps.


Currently the suggested method is to use the Maven repository. Either as a dependency or download the jar file from the repository. Dependency:


or direct link

The required core dependencies should be only Log4J2 (api and core jars). Some of the reports use Velocity, and some of the JUnit integration uses JUnit. But those should not be strict requirements if you do not use those features.


Some documentation exists here:


LGPL License