views:

117

answers:

2

Hi Folks,

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,

+1  A: 

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.

gareth_bowles
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 B
David Relihan
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.
gareth_bowles
A: 

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
David Relihan