Testcoverage → Modified Condition Coverage

[English][Français]

Example of Multicondition coverage (Multiple condition coverage - MCC)


Simple example

Assume we want to test the following code extract:

if ( (A || B) && C )
{
/* instructions */
}
else
{
/* instructions */
}

where A, B and C represent atomic boolean expressions (i.e. not divisible in other boolean sub-expressions).

In order to ensure Multicondition coverage criteria for this example, each combination of values for A, B and C should be tested at least one time.

So, in our example, we need 23=8 testes leading to the following evaluations of A, B and C to valid Multicondition coverage:

  1. A = true  / B = true  / C = true
  2. A = true  / B = true  / C = false
  3. A = true  / B = false / C = true
  4. A = true  / B = false / C = false
  5. A = false / B = true  / C = true
  6. A = false / B = true  / C = false
  7. A = false / B = false / C = true
  8. A = false / B = false / C = false

However, Testwell CTC++ used to ensure Multicondition coverage ("-i m" option of instrumentation) will present the results of testes in the following way:

  1. A = true  / B = not eval / C = true
  2. A = true  / B = not eval / C = false
  3. A = false / B = true       / C = true
  4. A = false / B = true       / C = false
  5. A = false / B = false      / C = not eval

E.g., for the 1st case, if A is "true", system will not calculate the value of B since in every way (A or B) will be evaluated to "true". In fact, it means that the 1st and 2nd cases of the 1st list will be evaluated in the same way by the system and that Testwell CTC++ will follow this logic while presenting the results.




More complex example

Assume we replace the condition: ( (A || B) & C )
by: ( ((u == 0) || (x>5)) & ((y<6) || (z == 0)) )

A full Test Coverage would consist into building the following truth table and testing each combination:

Test case n° A: (u == 0) B: (x>5) C: (y<6) D: (z == 0) ( (A || B) && (C || D) )
1 F F F F F
2 F F F T F
3 F F T _ F
4 F T F F F
5 F T F T T
6 F T T _ T
7 T _ F F F
8 T _ F T T
9 T _ T _ T

And to ensure a full Multicondition coverage, we should test each combination, i.e. the 9 possible testes here-before underlined in yellow.

Go back to Test Coverage Levels

Glossary:

Condition: a logical indivisible (atomic) expression. It is often called boolean variable, represented by a capital letter (A, B, C, etc.), can only be equal to "true" or "false", but can not be divided in other simpler "sub-conditions".

Decision : a logical expression which can be composed of several conditions separated by logical operators like "or", "and", "xor".

The Test Coverage Analyzer Testwell CTC++ can do measurements for all kinds of test coverage criteria (particularly for MC/DC and MCC) requested for "critical software development" in order to get certifications, such as DO-178B of the Federal Aviation Administration (FAA).


last updated: 03.08.2010

© 2010 Verifysoft Technology GmbH
Author: Christophe Sourisse, Verifysoft Technology GmbH
CTA++, CTC++, CMT++ and CMTJava are products of Testwell Oy, Tampere (Finland)
all other trademarks of this site are the property of their respective owners.