Testing UML Models Based on fUML
As part of our Moliz project, we provide a testing framework for validating the functional correctness of UML activities. The testing framework comprises a test specification language for expressing assertions on the execution behavior of activities and a test interpreter for evaluating the specified assertions. The test interpreter is based on our extension of the reference implementation of the virtual machine accompanying the foundational UML (fUML) standard, which is used to execute the activity under test. The execution trace obtained from executing the activity under test is analyzed by the test interpreter to evaluate the specified assertions.
Test Specification Language
In our test specification language, test cases on UML activities are organized in test suites. In a test case, the execution order of activity nodes contained by the activity under test and called activities can be validated (execution order assertion). Furthermore, the runtime state of the executed model can be validated at any point in time of the execution of the activity under test (state assertion). Therewith it is possible to assert not only the input and output of executed activities, but also intermediate states of the executed model. To test different execution scenarios, the test specification language enables the definition of test scenarios consisting of objects that can be provided as input to the activities under test.
Details of the test specification language and its grammar can be found here.
The process implemented by the test interpreter for executing and evaluating test cases on UML activities is shown in Figure 1. The test interpreter gets as input the UML model to be tested, as well as the test suite to be evaluated. For each test case defined in the test suite, the interpreter executes the activity under test using the fUML virtual machine and obtains an execution trace representing the execution behavior of this activity. Each assertion defined in the test case is evaluated by analyzing the execution trace. The test verdict comprises the information on which assertions succeeded and which failed.
To get a more concrete idea of our test specification language, we kindly refer to the automated teller machine example.
In order to evaluate the ease of use and usefulness of our test framework, we have performed a user study with eleven participants. Details can be found here.