And this criterion is called Modified Condition/Decision Coverage,
also called MC/DC. This criterion is very important because
it is often required for safety critical applications.
For example, the FAA, the Federal Aviation Administration, requires
for all the software that runs on commercial
airplanes to be tested according to the Modified Condition/Decision
Coverage. So what is the key idea behind the
MC/DC criterion? It is to test only the important
combinations of conditions instead of all of them, and limit
the testing cost by excluding the other combinations. And the way
in which it works is by extending branch and decision
coverage with the requirement that each condition should affect the decision
outcome independently. So let's see what this means with an
example that will also show you how you can reduce the
number of combinations in this way. I am going to
show you an example of how MC/DC works using this predicate
which consists of three conditions. a, b, and c, which are all
in and, so the overall predicate is a and b and c.
The first thing I'm going to do is to show you how
many test cases we will need to satisfy the multiple condition coverage
for this simple predicate. Which means, how many test cases we will
need to test all the possible combinations of true and false values
for these conditions. So I'm going to populate this table. And as you
can see, at the end we have eight test cases. Each test case
tests a different combination of values for a, b, and c.
I'm also showing, for each test case, the outcome of the overall
predicate. So, for example, if we look at the first one, the
first test case, will be such that a is true, b is
true, and c is true. And therefore, the overall outcome of
the predicate is true. Now lets consider the first condition, a. As
I said a minute ago, what we want to test are the
important combination. Which are the comibatinos
in which a single condition independently
effects the outcome of the overall predicate. So if we consider a
and we look at this possible set of this cases. Let's try to
find two test cases such that the only difference between the two
test cases is the value of a, and the overall outcome of the
predicate is different. If we look at the table, we can see
that this is true for test cases one and five. If we look
at these two cases, we can see that the overall of the predicate
in the two cases is true and false, and that the only difference
between the value of the conditions in the value of a. So
these test cases satisfy exactly what we wanted. There are two test
cases in which the value of a independently decides the overall value
of the predicate. What we do, therefore, is to add these first
two test cases to our set of tests down here. Now let's
focus on b and let's try to find two test cases such
that the value of b is the only value that changes between
the two test cases, but the overall value of the predicate is
different, the same thing we did for a. And in this case,
we can see that if we select test case number one, and test
case number three, we have exactly that situation. b is true in the
first case, false in the second one, a and c don't change, but
the overall value of the predicate changes. And now you can notice
something else. That even though we selected two test cases, tested two values,
one we already had. So, we only need three test cases overall to
test a and b according to MC/DC. Now, let's look at our last
condition, c. At this point, we know the game, so we
just have to look for two test cases that satisfy our
requirements. And in this case, one and two are suitable candidates.
And once more, because we already have one, we just have to
add two to our list. So as you can see from
this example, we went from having eight test cases needed to cover
all the possible combinations of conditions to only four test cases
to satisfy the MC/DC criteria. So let's see where MC/DC stands in
our substantion hierarchy. This is what we had so far
in the hierarchy and this is where the MC/DC criterion will
stand. MC/DC criterion is stronger than branch and condition coverage.
Why? Because it requires every single condition to be true and
false. And therefore, this section was a condition coverage criteria.
And it also requires every predicate to be true and false
and therefore, this section is branch coverage. And in addition,
it's got the additional requirements that the true and false values,
all the conditions have to also decide the overall
value of the predicate. So it's stronger. Which is more
thorough than branch and condition coverage and, as usual,
also stronger than branch coverage, statement coverage, and condition coverage.