Software Testing - Pairwise Testing
What is Pairwise Testing?
Pairwise Testing also known as All-pairs testing is a testing approach taken for testing the software using combinatorial method. It's a method to test all the possible discrete combinations of the parameters involved.
Assume we have a piece of software to be tested which has got 10 input fields and 10 possible settings for each input field, then there are 10^10 possible inputs to be tested. In this case, exhaustive testing in impossible even if we wish to test all combinations.
Let us also understand the concept by understanding with an example:
An application with simple list box with 10 elements (Let's say 0,1,2,3,4,5,6,7,8,9) along with a checkbox, radio button, Text Box and OK Button. The Constraint for the Text box is it can accept values only between 1 and 100. Below are the values that each one of the GUI objects can take :
List Box - 0,1,2,3,4,5,6,7,8,9
Check Box - Checked or Unchecked
Radio Button - ON or OFF
Text Box - Any Value between 1 and 100
Exhaustive combination of the product B is calculated.
List Box = 10 Check Box = 2 Radio Button = 2 Text Box = 100 Total Number of Test Cases using Cartesian Method : 10*2*2*100 = 4000 Total Number of Test Cases including Negative Cases will be > 4000
Now, the idea is to bring down the number of test cases. We will first try to find out the number of cases using the conventional software testing technique. We can consider the list box values as 0 and others as 0 is neither positive nor negative. Radio button and check box values cannot be reduced, so each one of them will have 2 combinations (ON or OFF). The Text box values can be reduced into three inputs (Valid Integer, Invalid Integer, Alpha-Special Character).
Now, we will calculate the number of cases using software testing technique, 2*2*2*3 = 24 (including negative cases).
Now, we can still reduce the combination further into All-pairs technique.
Step 1: Order the values such that one with most number of values is the first and the least is placed as the last variable.
Step 2: Now start filling the table column by column. List box can take 2 values.
Step 3: The Next column under discussion would be check box. Again Check box can take 2 values.
Step 4: Now we need to ensure that we cover all combinations between list box and Check box.
Step 5: Now we will use the same strategy for checking the Radio Button. It can take 2 values.
Step 6: Verify if all the pair values are covered as shown in the table below.
|Text Box||List Box||Check Box||Radio Button|
Result of Pair-Wise Testing:
Exhaustive Combination results in > 4000 Test Cases. Conventional Software Testing technique results in 24 Test Cases. Pair Wise Software Testing technique results in just 6 Test Cases.