Activity 3: Check an execution trace against the state machine
Once the initial state machine model is defined,
an execution trace like VendingMachine.events can be checked for
conformance against this model.
First create in the main project directory
a folder VendingMachineEventsFiles by
File > New > Folder ; choose Vending Machine Example as parent
Next extend VendingMachine.prj with a task to generate the monitoring (you may copy the text below):
Generate Monitors {
monitoringIService for interface IService {
trace directories "VendingMachineEventsFiles"
}
}
The lay-out can be improved by means of <CTRL>-<SHIFT>-F. Next perform the following steps:
-
Execute again the steps from Activity 1 by just switching on and off the machine a couple of times and performing LoadProducts. Do not perform any other actions! These actions are recorded in file VendingMachine.events.
-
Rename file VendingMachine.events to VendingMachine1.events (use right-click on the file > Rename) and move it to folder VendingMachineEventsFiles.
-
Construct a few more .event files and move them also to folder VendingMachineEventsFiles after renaming.
-
Right-click on file VendingMachine.prj and choose "Run As > Generate and execute monitoring". The check is executed and results are produced.
-
In order to view the results of monitoring, see file dashboard.html in folder comma-gen. It contains information about errors and warnings.
-
As soon as the monitoring detects that a .events file does not conform to the state machine of the interface, an error is generated and monitoring of this files terminates.
-
Later we will also define time and data constraints; violations of these constraints are reported as warnings and monitoring continues.
-
-
The dashboard also provides coverage information; in each state the transitions are numbered in the order of occurrence and the dashboard describes for each transition how often it was used during monitoring. If a transition contains multiple clauses (by mean of the "OR" construct) then also the clauses are numbered. The dashboard also reports the percentage of covered transitions and states.
-