Pairwise testing- a best testing technique that is hardly used

Have you tested applications that involve a lot of combinational inputs to produce an output or report generations etc.? I’m sure you did.  Heck of a task, I know! When there are more than 3 combinations probably with many values in it.  Usually testers miss out on testing for all the combinations, which leads to the real-time issues. Combinatorial testing can be performed with the help of a best technique by pairing the inputs. It is called pairwise testing technique.

Best explained is with the help of an example:

REQUIREMENT

How would you test the percentage, grade and rank fields with the following requirement? What would be the possible cases?

Below 35%, grade- D is accepted

Between 35% and 50%, grade- C is accepted

Between 50% and 70%, grade- B is accepted

Between 70 and 80 %, grade – A is accepted

80% and above, A+ is accepted.

The percentage accepts decimals up to 2 places and for more than 2 places, round off to 2-decimal place. And Rank should be tagged such that,

For percentage above 90, Rank =1

For 80<=P<90, Rank =2

For 75<=p<80, Rank =3.

 

 

EXHAUSTIVE TESTING

If I must perform exhaustive testing cascading every value of a field with the other, the count of test cases would be elucidated something like this;

Percentage – 0 to   100

Percentage should accept even decimals – decimal up to places have 99 combinations 0.1 to 0.99

Grade- A+, A, B, C, D

Rank- 1, 2, 3

The total number of test cases, 101*99*5*3=149,985

Total number of test cases including negative (invalid) cases > 149,985

 

 

And that’s huge number!

 

CONVENTIONAL SOFTWARE TESTING METHOD

With conventional software testing method; I can try to reduce such exhaustive combinations, yet complete test coverage.

Percentage field should accept

1.       positive integers {considering that 1.00 is taken as 1} (PI)

2.       0

3.       Positive decimal number (PDN)

not accept

4.       negative integers (NI)

5.       negative decimal numbers (NDN)

total no of variables for percentage- 5

 

Rank field should accept

1.       1

2.       2

3.       3

Not accept

4.       Negative numbers (NN)

5.       Numbers >3 (NA3)

6.       0

total no of variables for rank- 6

 

Grade field should accept

1.       A

2.       B

3.       C

4.       D

Not accept

5.       Any alphabet after D. (Any alpha)

total no of variables for grade- 5

 

So, the total number of test cases reduce to 5*6*5=150

 

 

PAIRWISE TESTING

Let’s see how does pairwise testing reduce it further.

It’s simple, as many input fields those many would be the columns of the table to create combinations. Add an additional test case ID column (I have added number).

The first column (ignore test case number) should be the field which has highest number of variables.

Followed by the columns in the reducing order of the number of variables.

Create the table as shown below.

Test case number Rank Grade Percentage
1 1 A PI
2 1 B 0
3 1 C PDN
4 1 D NI
5 1 Any alpha NDN
6 2 A PI
7 2 B 0
8 2 C PDN
9 2 D NI
10 2 Any alpha NDN
11 3 A PI
12 3 B 0
13 3 C PDN
14 3 D NI
15 3 Any alpha NDN
16 NN A PI
17 NN B 0
18 NN C PDN
19 NN D NI
20 NN Any alpha NDN
21 NA3 A PI
22 NA3 B 0
23 NA3 C PDN
24 NA3 D NI
25 NA3 Any alpha NDN
26 0 A PI
27 0 B 0
28 0 C PDN
29 0 D NI
30 0 Any alpha NDN

 

Please note, there should also be those test cases that suffice the conditions of the requirement. Few of which are anyways covered in the above.

Percentage Grade Rank
0 to 34 D
35 ?
36 to 49 C
50 ?
51 to 69 B
70 ?
71 to 79 A
75 to 79.99 A 3
 80 to 90 A+ 2
90.01 to 100 A+ 1

 

Pairwise technique has brought down the test cases count to 30 without any loss of coverage.

It concentrates in making various combinations of inputs, causing ease to test.

This reduces a lot of effort in test cases creation and strategizing as well. All we need to identify is the variables and frame the table.

The question remains, what if there are very many input combinations? – simple, use some open source pairwise testing tools!

Feel free to share your experience or the hurdles faced in such testing and how did you overcome them.

Jeevan

Related posts

Challenges bring the best out of us. What about you?

We love what we do so much and we're always looking for the next big challenge, the next problem to be solved, the next idea that simply needs the breath of life to become a reality. What's your challenge?