[Français]

Counter-exemple: full Condition coverage does not necessarily implies full Decision coverage


Assume we want to test the following code extract:

if ( ((u=0) or (x>5)) and ((y<6) or (z=0)) ) then
<instructions>
else
<instructions>
end if

Following truth table sums up all conceivable test cases for this code extract:

Test case n° A: (u=0) B: (x>5) C: (y<6) D: (z=0) (A or B) (C or D) ( (A or B) and (C or D) )
1 F F F F F F F
2 F F F T F T F
3 F F T F F T F
4 F F T T F T F
5 F T F F T F F
6 F T F T T T T
7 F T T F T T T
8 F T T T T T T
9 T F F F T F F
10 T F F T T T T
11 T F T F T T T
12 T F T T T T T
13 T T F F T F F
14 T T F T T T T
15 T T T F T T T
16 T T T T T T T

To ensure Condition coverage, we should test (for example) just the 2 combinations here-before underlined in yellow.

However, for both cases, the decision's outcome is evaluated 2 times to "true" but never to "false": Decision coverage is not effective... We should for example choose the 2 combinations here-before underlined in blue to ensure both Condition and Decision coverage.

Go back to Test Coverage Levels

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).

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".


last updated: 21.07.2010

© 2010 Verifysoft 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.