1 Introduction
2 Coverage analysis and MC/DC
-
Every point of entry and exit in the program has been invoked at least once,
-
Every condition in a decision in the program has taken all possible outcomes at least once,
-
Every decision in the program has taken all possible outcomes at least once,
-
Each condition in a decision has shown to independently affect that decision’s outcome by: (1) varying just that condition while holding fixed all other possible conditions or (2) varying just that condition while holding fixed all other possible conditions that could affect the outcome.
TC | a | b | c | D | MC/DC pairs |
---|---|---|---|---|---|
(a) MCC test cases | |||||
1 | 0 | 0 | 0 | 0 | |
2 | 0 | 0 | 1 | 1 | c(1,2) |
3 | 0 | 1 | 0 | 0 | |
4 | 0 | 1 | 1 | 1 | c(3,4) |
5 | 1 | 0 | 0 | 0 | |
6 | 1 | 0 | 1 | 1 | c(5,6) |
7 | 1 | 1 | 0 | 1 | a(3,7), b(5,7) |
8 | 1 | 1 | 1 | 1 | |
(b) Selected MC/DC test cases | |||||
1 | 0 | ? | 0 | 0 | |
2 | 1 | 1 | ? | 1 | a(1,2) |
3 | 1 | 0 | 0 | 0 | b(2,3) |
4 | 0 | ? | 1 | 1 | c(1,4) |
3 Instrumentation of CPN models
3.1 MC/DC coverage for CPN models
3.2 Automated instrumentation of net inscriptions
.cpn
XML file of CPN Tools in combination with an SML parser. Arc expressions are handled analogously. Guards in a CPN model are written following the general form of a comma-separated list of Boolean expressions (decisions):
var
is bound already via a pattern in another expression (arc or guard) of the transition, then this is indeed a Boolean equality test (decision). If, however, var
is not bound via other expressions, then this assigns the value of exp
to the variable var
and does not contribute to any guarding effect.f
cover user-defined functions as well as (built-in) relational operators such as <,
\(=\); we do not detail the overall nature of arbitrary SML expressions, but refer the reader to [14] for a comprehensive discussion. The automatic instrumentation also processes the definition of SML functions in the body of the .cpn
XML file, which were not considered in our manually instrumented solution. We do not provide instrumentation to measure coverage of pattern matching in function definitions and
expressions.
eval
collects the result of intermediate evaluations in a list data structure, and the
function (implementation not shown) turns this result into a single Boolean value that is used in the guard, and as a side effect outputs the truth value outcome for individual conditions. As an example, if we consider a guard:
; then we can transform this guard in a straightforward manner into
. It is important to notice that this does not give us the (symbolic) Boolean expressions, as we still leave it to the standard SML semantics to evaluate the
, while abstractly we refer to the AP as a condition named “1.” We elide expression and proposition names for clarity in the text when not needed.4 Post-processing of coverage data
4.1 Coverage analysis
R
set shows three such pairs for condition 1, but no complementary entries at all are found in the truth table for conditions 2, 3 and 4, and hence indicated as empty sets []
by Python. This information can then be used by developers to drill down into parts of their model, e.g. through simulation, that have not been covered adequately yet.4.2 Combining coverage data from multiple runs
mcdcgen()
function only explores the state space for the current configuration as determined by the initial markings. Compared to regular testing of software, this corresponds to providing a single input to the system under test.4.3 Coverage visualization in CPN model
5 Evaluation on example models
CPN model | Executed decisions | Model decisions | Non- trivial decisions | MC/DC (%) | BC (%) | Simulation status |
---|---|---|---|---|---|---|
Paxos | 2,281,466 | 27 | 11 | 37.03 | 40.74 | Incomplete |
MQTT timeout | 3654 | 18 | 14 | 11.11 | 22.22 | Incomplete |
MQTT notimeout | 1,828,751 | 23 | 19 | 21.73 | 65.22 | Complete |
CPNABS | 1,386,642 | 32 | 13 | 59.37 | 88.88 | Incomplete |
DisCSP WCS | 140680 | 9(2) | 5 | 57.14 | 57.14 | Complete |
DisCSP SBT | 7686 | 7 | 3 | 57.14 | 57.14 | Complete |
DisCSP ABT | 604055 | 7 | 5 | 57.14 | 57.14 | Complete |
NPP | 194,481 | 13 | 13 | 53.84 | 92.3 | Incomplete |
PC | 8,677,800 | 10 | 9 | 90 | 90 | Incomplete |
TIS | 10,789,149 | 19 | 19 | 52.94 | 73.68 | Incomplete |
VM | 4444 | 8 | 7 | 25 | 50 | Incomplete |
T34PIM | 3,644,768 | 23 | 8 | 69.56 | 82.6 | Complete |
5.1 Experimental setup
5.2 Experimental results
5.3 Discussion of results
6 Related work
7 Summary and outlook
7.1 Outlook
git
repository just represents a snapshot, or we did not discover all possible configurations in the model. In the future, we may also try to generate test cases specifically with the aim to increase coverage.