 Multiple Condition Coverage

What is Multiple Condition Coverage?

Condition coverage is correlated to decision coverage as whenever any decision is to be taken, focus will be on number of possible conditions. Condition Coverage is also known as ‘Predicate Coverage’.

Example:

If ((A || B) && C)

{

<< Statements >>

}

Else

{

<< Statements >>

}

An Example: Multiple Condition Coverage

The programmatic condition is given by,

If (A||B)

Then

Print C

There are two Boolean Expressions A and B, so the Multiple Condition Coverage is defined as:

• Test Case1: A=TRUE, B=TRUE
• Test Case2: A=TRUE, B=FALSE
• Test Case3: A=FALSE, B=TRUE
• Test Case4: A=FALSE, B=FALSE

According to this explanation, there are 4 test cases for 2 conditions. So, for 3 conditions there will be 8 test cases.

Therefore, for n number of conditions, there are 2n tests.

An Example: MCDC

If {(X or Y) and Z} then

To fulfil condition coverage, Boolean expression X, Y and Z will be evaluated in TRUE and FALSE form, at least once.

The test case for condition coverage is given by:

• Test Case1: X=TRUE, Y=TRUE, Z=TRUE
• Test Case2: X=FALSE, Y=FALSE, Z=FALSE

To satisfy decision coverage, we need to evaluates IF statements in TRUE and FALSE form. Therefore, the test set is expressed as:

• Test Case1: X=TRUE, Y=TRUE, Z=TRUE
• Test Case2: X=False, Y=FALSE, Z=FALSE

To evaluate MCDC, the above test cases are not sufficient. So, in this context, there are 4 more test cases to appropriate decision.

• TEST CASE3: X=FALSE, Y=FALSE, Z=TRUE
• TEST CASE4: X=FALSE, Y=TRUE, Z=TRUE
• TEST CASE5: X=FALSE, Y=TRUE, Z=FALSE
• TEST CASE6: X=TRUE, Y=FALSE, Z=TRUE

For test case 3, decision outcome = FALSE

For test case 4, decision outcome = TRUE

For test case 5, decision outcome = FALSE

For test case 6, decision outcome = TRUE

From the above observation, the change in Boolean variables can be determined that illustrates change in decision outcomes.

Conclusion

In any decision, there are some possible number of conditions, which can be examined and evaluated by applying Boolean Expression as expressed above.