Modified Condition / Decision Coverage (MC/DC) is a strong white-box testing criterion often used in safety-critical systems (like aviation or medical software). It ensures very thorough testing by requiring more than just simple condition coverage.
To achieve MC/DC, you must satisfy:
- Each entry and exit point in the program must be invoked at least once
- Each decision (e.g., an
if
statement) must evaluate to both True and False at least once - Each condition (e.g., parts of a compound condition like
a > 10
orb < 20
) must evaluate to True and False - Each condition must independently affect the outcome of the decision
MC/DC requirement
MC/DC requires us to:
- Make the decision evaluate to both True and False
- Have each condition evaluate to both True and False
- Show that each condition independently affects the result of the decision
Example
a = ...
b = ...
if (a > 10 or b < 20):
return False
return True
This is a compound decision with two conditions:
- Condition 1:
a > 10
- Condition 2:
b < 20
The test suite to satisfy MC/DC:
- Decision takes both True and False values
- True → T1, T3, T4
- False → T2
- Each condition takes both True and False
a > 10
: True (T1, T4), False (T2, T3)b < 20
: True (T3, T4), False (T1, T2)
- Each condition independently affects the decision
- For a > 10: Compare T1 vs T2:
- T1: a > 10 = True, b < 20 = False → Decision = True
- T2: a > 10 = False, b < 20 = False → Decision = False
- The only change is in a > 10, and it changes the decision
- For
b < 20
: Compare T3 vs T2:- T3:
a > 10 = False
,b < 20 = True
→ Decision = True - T2:
a > 10 = False
,b < 20 = False
→ Decision = False
- T3:
- The only change is in
b < 20
, and it changes the decision
- For a > 10: Compare T1 vs T2:
Test | a | b | a > 10 | b < 20 | Decision (a > 10 or b < 20 ) | Return |
---|---|---|---|---|---|---|
T1 | 11 | 30 | True | False | True | False |
T2 | 9 | 30 | False | False | False | True |
T3 | 9 | 10 | False | True | True | False |
T4 | 11 | 10 | True | True | True | False |
Back to parent page: Software Testing
Web_and_App_Development Software_Testing Blackbox_Testing SOFT3202 Modified_Condition_Decision_Coverage