How do statement, decision, condition and MC/DC coverage differ?
Answer
Statement coverage asks whether executable statements ran. Decision or branch coverage requires each decision outcome, such as true and false, to occur. Condition coverage requires each atomic condition inside a compound decision to take both values, but that alone may not prove that each condition can affect the decision. Modified condition/decision coverage adds that independent-effect requirement while also covering decision outcomes, so it is stronger and more expensive. Coverage measures exercised structure, not correctness: good assertions, meaningful data, missing requirements and infeasible paths still require separate analysis.
Strong answer includes
- distinguishes decision outcomes from atomic conditions
- explains independent effect in MC/DC
- does not equate structural coverage with defect detection or correctness
Practical example
In an avionics-style module with the condition `if (A && B) || C`, a team reaches 100% decision coverage with just two test cases, but a code review shows condition B never actually changes the outcome in either case — it's masked by A always being true. Adding MC/DC-driven test cases that isolate B's independent effect exposes a logic bug where B was supposed to gate an emergency override but never actually could.