# N-wise testing

N-wise testing has the aim of testing all the possibilities of any random combination of N factors.

The maximum value for N is equal to the number of parameters. In that case, the result is equal to the testing of the complete decision table: all the combinations of all the values of all the parameters. In practice, a value of 4 or higher is seldom applied. In order to apply N-wise testing tools are required.

#### Pairwise testing

The most common application of N-wise testing is pairwise testing. Pairwise testing is based on the phenomenon that most faults in software are the consequence of one particular factor or the combination of 2 factors. The number of faults that are caused by a specific combination of more than 2 factors becomes exponentially smaller. Instead of testing all the possible combinations of all the factors, it is very effective if every combination of 2 factors is tested.

The aim of pairwise testing is to test all the possibilities of any combination of 2 factors.

This delivers an enormous reduction in the number of required test cases, yet still gives a good fault-detection result.

The following example illustrates the meaning of pairwise testing.

In the system under test (for ordering books via the Internet), the following 3 paramete play a role. For each parameter, there are 2 equivalence classes to be tested:

Number of books Few; many

Sum Low; high

Membership card None; Gold card

In order to test all the combinations relating to these 3 parameters, 2x2x2=8 test situations are required, namely:

Number of books | Sum | Membership card | |

1 | Few | Low | None |

2 | Few | Low | Gold card |

3 | Few | High | None |

4 | Few | High | Gold card |

5 | Many | Low | None |

6 | Many | Low | Gold card |

7 | Many | High | None |

8 | Many | High | Gold card |

For pairwise testing, as few as 4 test situations will suffice, as shown below:

Membership card | Sum | Membership card | |

1 | Few | Low | None |

2 | Few | High | Gold card |

3 | Many | Low | Gold card |

4 | Many | High | None |

Of the 2 parameters [Number of books, Sum], all 4 existing combinations are tested (Few/Low; Few/High; Many/Low; Many/High). The same applies to the other combinations of 2 parameters, so for [Number of books, Membership card] and [Sum, Membership card]. Check it for yourself.

What is the point of this? If a fault exists in the system that occurs when one of the possible values of one of the parameters is combined with a particular value of one of the other parameters, then this fault is always found with these 4 test cases. That is the strength of pairwise testing.