Automatic Generation of MCDC Test Cases


Before describing what the tool can do, let's take a look at what is MCDC (modified condition/decision coverage) and why we need it. I will explain it according to my experience as a software tester so don't expect it to be detailed as what you can find in Wiki  🙂

What is MCDC and why we need it?

Consider following simple logic branches:

simple logic branches example

Let (a == True) is condition A, (b == 2) is condition B and (c == True) is condition C. So 3 conditions in total.

In order to test every situation,  we need 8 (23) test cases. See the table below:

Condition ACondition BCondition COutcome

What if we increase the number of conditions to 10? How many test cases do we need? Well, 1024 test cases. A huge increase in the number of test cases. No one would have time to do it. And we need MCDC to deal with this situation. It helps you to choose which case needs to be tested and here is how it works:

We choose test cases so that "only one condition changes at a time and each change in condition leads to a change in outcome".

Let's apply it to our example for condition A:

Condition ACondition BCondition COutcome

Notice that condition A changes and the outcome changes but remaining conditions don't. Do the same for condition B and C, so we have 6 test cases in total (each condition has 2 test cases).


This is the screenshot of the tool:

MCDC Tool screenshot

You simply enter your Boolean expression and press the GENERATE button. It will generates an Excel file that contains the result. Let's take our logic branches example and give input to the tool.

Logic branches: A and B or C ⇒ Tool input: A & B | C

And the result is 2 test cases for each condition:

results on excel

There is one point that I haven't mention yet. From our example, we see that condition A (a == True), B (b == 2) and C (c == True) are independent from each other. We can change A to True or False without influencing B or C. But how about the case where the conditions depends on each other? Let's see the following example:

logic branch contains dependent conditions

Let (a==True) is condition A, (b==2) is condition B, (a==False) is condition A' and (c == True) is condition C

Well the situation now becomes a bit complicated, when we want to change condition A, A' changes as well. So how do we choose test case for A? Just pick the test cases so that when A and A' change then the outcome changes (of course B and C have to stay unchanged).

Let's see if the tool can helps us solve this situation.

Logic branches: (A and B) or (A' or C) ⇒ Tool input: ( A_4 & B ) | ( A_4 | C )

The syntax "condition_4" (e.g. A_4) shows that these conditions are depend on each other based on rule number 4 which is if A is True then A' is False and vice versa. You can find the rule description by pressing the Help button on the tool.

location of Help button

The results for this case would be:

results on excel for dependent conditions

The result is 8 test cases (2 for each condition) and it seems a bit messy. Don't worry, I will explain it right away. I mark the 2 test cases for condition A as "condition no. 1". It is the position of our condition from left to right in the Boolean expression, so condition A is 1, B is 2, A' is 3 and C is 4.

I highlight identical test cases with same color. So there are only 4 test cases in total.

Wow, we come to an end finally. Click DOWNLOAD to get the tool and experience yourself  😎 


Leave a Reply