Learning Objectives
By the end of this lesson you will be able to:
- Apply the MC/DC principle to select a minimal test set for compound boolean conditions
- Verify that each condition in an expression independently influences the outcome
- Distinguish between full combinatorial coverage and MC/DC coverage
The Problem With Ad-Hoc Boolean Testing
You have a condition: A && B && C. How many test cases do you need?
A full combinatorial approach gives 8 cases (2³). In practice, testers pick 2–3: one where all are true and one where all are false. But this misses the individual effect of each condition.
Modified Condition/Decision Coverage (MC/DC) is a smarter middle ground: it requires significantly fewer cases than full coverage while guaranteeing that each condition is independently tested.
The MC/DC Principle
For each condition in a compound expression, MC/DC requires at least one pair of test cases where:
- The condition changes value (true ↔ false)
- All other conditions remain the same
- The overall expression changes value as a result
In other words: prove that flipping this one condition — and only this one — changes the outcome.
Building an MC/DC Test Set
For A && B && C:
| Test | A | B | C | Result | Proves |
|---|---|---|---|---|---|
| T1 | T | T | T | T | Baseline |
| T2 | F | T | T | F | A independently affects outcome |
| T3 | T | F | T | F | B independently affects outcome |
| T4 | T | T | F | F | C independently affects outcome |
4 test cases instead of 8. Each condition's independent influence is demonstrated.
MC/DC for OR Conditions
For A || B || C:
| Test | A | B | C | Result | Proves |
|---|---|---|---|---|---|
| T1 | F | F | F | F | Baseline |
| T2 | T | F | F | T | A independently affects outcome |
| T3 | F | T | F | T | B independently affects outcome |
| T4 | F | F | T | T | C independently affects outcome |
Again, 4 tests instead of 8.
Mixed AND/OR
For A || (B && C):
| Test | A | B | C | Result | Notes |
|---|---|---|---|---|---|
| T1 | F | F | F | F | Baseline |
| T2 | T | F | F | T | A's independent effect |
| T3 | F | T | T | T | B's independent effect (need C=T for B to matter) |
| T4 | F | T | F | F | C's independent effect |
5 tests (T3 requires a supporting value for C).
Pro Tip: MC/DC doesn't require you to know the implementation. You derive it from the specification. If the specification says
A || (B && C), you can build the MC/DC table before the feature is coded.
When Full Coverage Beats MC/DC
MC/DC is the right tool for complex conditions with many subconditions. For simple 2-condition expressions, full coverage (4 cases) is usually fine and more intuitive. Use MC/DC when you have 4+ conditions and need to justify a smaller test set to your team.
Summary
MC/DC is the professional standard for testing compound boolean conditions when full combinatorial coverage is too expensive. It proves each condition independently matters, catches the AND/OR swap bugs from the previous lessons, and produces a documented, defensible test set. Now you have the complete boolean testing toolkit.