Multiple Condition Coverage Testing
Asked Answered
I

2

6

When using the White Box method of testing called Multiple Condition Coverage, do we take all conditional statements or just the ones with multiple conditions? Now maybe the clues in the name but I'm not sure.

So if I have the following method

void someMethod()
  {

      if(a && b && (c || (d && e)) )  //Conditional A
      {

      }

      if(z && q)   // Conditional  B
      {
      }

  }

Do I generate the truth table for just "Conditional A", or do I also do Conditional B?

Thanks,

Instill answered 17/5, 2010 at 22:25 Comment(1)
Looks more like the code executed by Conditional A and the that by Conditional B should be in different methods that get tested independantlyCatchings
H
1

I might be missing something here but, the way you wrote the code in your question, conditions A and B are completely independent of each other. You therefore won't cover all of the code unless you test both conditionals.

Hypothesize answered 18/5, 2010 at 0:11 Comment(2)
Yep - it won't. But it's more the term multip[le-condition-coverage that I'm referring to - specifically does the term just apply to A or BInstill
My understanding of multiple condition coverage is that all combinations of conditions inside each decision are tested, which implies that you need it whenever there are two or more values being tested. That means condition B would qualify in my book.Hypothesize
I
1

I found the following on Multiple condition coverage. This would seem to indicate that Multiple Condition Coverage, as the name suggests, only applies to conditionals with multiple statements.

So for the following conditional:

if ((a>0)&&(b<=4)&&(c>0))

We create the following

Test Case   a > 0   b <= 4    c > 0
MCC1        F        F         F
MCC2        F        F         T
MCC3        F        T         F
MCC4        F        T         T
MCC5        T        F         F
MCC6        T        F         T
MCC7        T        T         F
MCC8        T        T         T
Instill answered 18/5, 2010 at 8:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.