White Box – MCDC Testing

White Box – MCDC Testing

MCDC enhances the condition/decision coverage criteria.

According to MCDC  each condition independently affects the outcome of the decision.

For example, this example contains three conditions

if(a<10     &&     b<20    OR   c<30)

{
}

 

Condition C1: a<10

Condition C2: b<20

Condition C3: c<30

According to MCDC in this example,

  • Firstly, we will see that overall decision(T or F) depends on Condition C1.
    • If C1 is T, then a decision will be T
    • If C1 is F, then a decision will be F.
  • Secondly, we will see that overall decision(T or F) depends on Condition C2.
    • If C2 is T, then the decision will be T
    • If C2 is F, then the decision will be F.
  • Thirdly, we will see that overall decision(T or F) depends on Condition C3.
    • If C1 is T, then the decision will be T
    • If C1 is F, then the decision will be F.

Test Requirements:

No of test requirements = No of conditions * 2

Note: Here 2 representing T and F.

If 1 condition:

No of test requirements = No of conditions * 2.

2 =1*2

If 2 conditions:

No of test requirements = No of conditions * 2

4 =2*2

If 3 conditions:

No of test requirements = No of conditions * 2

6 =3*2

 

Test cases:

Decision depends on Condition  C1.

a b C C1 C2 C3 Descision Test Case#
5 10 40 T T F T 1
15 10 40 F T F F 2

 

Decision depends on condition C2.

a b C C1 C2 C3 Descision Test Case#
5 10 40 T T F T 3
5 40 50 T F F F 4

 

Decision depends on condition C3.

a b C C1 C2 C3 Descision Test Case#
15 40 10 F F T T 5
15 40 50 F F F F 6

.