KTH Logo

KTH Royal Institute of Technology
School of Computer Science and Communication

Modbat

Tool demonstration

Overview

Modbat is a model-based testing tool that is based on annotated (extended) finite-state machines. It can generate test cases for Java, Scala, or C programs from such models and find complex defects, as shown in this example, which tests iterators on an ArrayList:

[INFO] 1000 tests executed, 999 ok, 1 failed.
[INFO] One type of test failure:
[INFO] 1) java.util.ConcurrentModificationException at failingNext:
[INFO]    6945df2424fcf4ff
[INFO] model.ArrayListModel: 1 states covered (100 % out of 1),
[INFO] model.ArrayListModel: 11 transitions covered (100 % out of 11).
[INFO] model.IteratorModel: 2 states covered (100 % out of 2),
[INFO] model.IteratorModel: 9 transitions covered (81 % out of 11).
[INFO] model.ListIteratorModel: 2 states covered (100 % out of 2),
[INFO] model.ListIteratorModel: 26 transitions covered (89 % out of 29).
[INFO] Random seed for next test would be: 90606ba433a51041

Two demos are available (tested under Mac OS X, should also work on Linux).

Archives

To run the demos, download these two archives:

Video

This demonstration shows Modbat when applied to Java collections. If the video does not play well, try downloading it (Save Video As...). Note that in the video, model code is inlined to fit on the screen. In the downloadable archive of demo 1, the code is kept in separate functions for better readability. Furthermore, due to a minor change in the model, a different random seed is used in the archive; changing the random seed or increasing the number of tests finds the issue in any case.

Back to Modbat main page

[ KTH | JKU ]

KTH Logo