Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Condition Coverage Testing

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,

like image 363
Robben_Ford_Fan_boy Avatar asked May 17 '10 22:05

Robben_Ford_Fan_boy


People also ask

What is multiple condition testing?

A white-box test design technique in which test cases are designed to execute combinations of single condition outcomes (within one statement). Synonyms: branch condition combination testing, condition combination testing.

What is multiple condition coverage in white-box testing?

All the possible combinations of outcomes of conditions in a decision (therefore the complete decision table) are tested at least once. Since there are only two possible outcomes of a condition (TRUE or FALSE), 2 is the basis for the number of test situations that can be created.

What is multi condition coverage?

MCC Metric Definition The coverage of a program is the number of executed statement blocks and condition combinations divided by their total number in the program.

How do you get 100% condition coverage?

To achieve 100% condition coverage, your test cases need to demonstrate a true and false outcome for both conditions. For example, a test case where x is equal to 4 demonstrates a true case for both conditions, and a case where x is equal to 7 demonstrates a false case for both conditions.


1 Answers

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.

like image 171
gareth_bowles Avatar answered Nov 02 '22 07:11

gareth_bowles