This article is not approved yet.
Modified Condition/Decision Coverage (MC/DC) is a structural code coverage criterion that requires each logical condition in a decision statement to be shown, through testing, to independently affect the outcome of that decision.
In software systems, decisions are typically implemented using control structures such as if, while, or for. These decisions may consist of multiple logical conditions combined using Boolean operators. MC/DC requires that each individual condition within a decision be evaluated in such a way that its independent impact on the decision result is demonstrated, while all other conditions remain unchanged.
The main objectives of MC/DC are:
MC/DC is applied by defining at least one test pair for each condition in a decision. In these test pairs:
The general application steps are:
MC/DC does not require testing all possible combinations of condition values. For a decision containing n conditions, it is commonly stated that n + 1 test cases may be sufficient to achieve full MC/DC coverage. This approach balances test efficiency with thorough logical verification.
During structural coverage analysis, instrumentation is typically added to the source code to collect coverage data during test execution. Some software testing and analysis programs are capable of measuring and reporting statement, decision, and MC/DC coverage levels, highlighting uncovered conditions and decisions.
The following example illustrates how MC/DC can be achieved for a decision with three conditions:
Code Example
This decision consists of three conditions: A, B, and C. The decision outcome depends on their logical combination.
To satisfy MC/DC, each condition must be shown to independently affect the decision outcome while the other conditions remain unchanged. The following test cases meet this requirement:
Test Decision Table
Using this test set:
Therefore, 100% MC/DC coverage is achieved for this decision.
No Discussion Added Yet
Start discussion for "Modified Condition/Decision Coverage Test (MC/DC)" article
What is it?
Purpose
How is it applied?
Number of test cases
Tool support
Code Example
This article was created with the support of artificial intelligence.