Testing-World


Register the mailing list in order to get updates everytime site will be update with more info. The mailing list is secured and will not be used for any spam delivery and will not be given to any third party.
 
To join the mailing list enter your e-mail address:
 Send


Counter:

Home >> Black box methods >> All pairs
 

What is "All Pairs"?

"All Pairs" is a method of testing several variables together. The test cases include all the pairs of values for every variable. The main role of "All Pairs" is that every value is paired with another value at least once.

Here are some examples of testing several variables:

  • A window with several fields.
  • A search screen with several search criteria.
  • Configuration options of software.
  • Configuration options of hardware.
  • Environment configuration of software (operation system, SQL, networking, RAM, ROM…).

"All Pairs" drastically reduces the number of test cases required to test software and it can help you find most errors with the smallest number of test cases.

How to use "All Pairs"?

Let say, for example, that we have a screen with 3 fields: A1, A2 and A3.

  • A1 can get as values the numbers '1' and '2'.
  • A2 can get as values the chars 's' and 't'.
  • A3 can get as values the chars 'z' and 'y'.

In other words: Let A1, A2, A3 be 3 variables.

  • A1 has '1','2' as values.
  • A2 has 's', 't' as values.
  • A3 has 'z', 'y' as values.

Step 1 - calculate all combinations using "All Singles" method:

The Cartesian product will be:

A1 X A2 X A3 = {1, 2} X {s, t} X {z, y}

Now let's write in a table the test cases using "All Singles" method which means writing all the combinations:

Test Case #

Values Participates

Result

1

{1, 2, 3}X{s, t}X{y, z}

(1, s, y)

2

{1, 2, 3}X{s, t}X{y, z}

(1, s, z)

3

{1, 2, 3}X{s, t}X{y, z}

(1, t, y)

4

{1, 2, 3}X{s, t}X{y, z}

(1, t, z)

5

{1, 2, 3}X{s, t}X{y, z}

(2, s, y)

6

{1, 2, 3}X{s, t}X{y, z}

(2, s, z)

7

{1, 2, 3}X{s, t}X{y, z}

(2, t, y)

8

{1, 2, 3}X{s, t}X{y, z}

(2, t, z)

* This table is just a reminder to the "All Singles" method.

Step 2 – base table

Now, let's create a table that each column represents a variable and each row represents a test case combination:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

5

2 s y

6

2 s z

7

2 t y

8

2 t z

 

Step 3 - pick the last row (mark in red):

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

5

2 s y

6

2 s z

7

2 t y

8

2 t z

Step 4 – If all pairs exist in other rows – delete the last row and go up, if not keep the row and go up to the next row:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

5

2 s y

6

2 s z

7

2 t y

8

2 t z

We can see that the pair (2, t) exists in test case 7, the pair (2, z) exists in test case 6 and the pair (t, z) exists in test case 4. Because all pairs in test case 8 (the last row) exists in above rows, we can delete test case 8. The new table will be:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

5

2 s y

6

2 s z

7

2 t y

 Now, let's move one row up to test case 7:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

5

2 s y

6

2 s z

7

2 t y

We don’t have the couple (2, t) so we keep the line (test case 7) and move up to the next row up to test case 6:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

5

2 s y

6

2 s z

7

2 t y

We don’t have the couple (2, z) so we keep the line (test case 6) and move up to the next row up to test case 5.

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

5

2 s y

6

2 s z

7

2 t y

We can see that the pair (2, s) exists in test case 6, the pair (2, y) exists in test case 7 and the pair (s, y) exists in test case 1. Because all pairs in test case 5 (the current row) exists in other rows, we can delete test case 5.

The new table will be:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

6

2 s z

7

2 t y

Now, let's move one row up to test case 4.

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

6

2 s z

7

2 t y

We don’t have the couple (t, z) so we keep the line (test case 4) and move up to the next row up to test case 3:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

3

1 t y

4

1 t z

6

2 s z

7

2 t y

We can see that the pair (1, y) exists in test case 1, the pair (1, t) exists in test case 4 and the pair (t, y) exists in test case 7. Because all pairs in test case 3 (the current row) exists in other rows, we can delete test case 3.

The new table will be:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

4

1 t z

6

2 s z

7

2 t y

Now, let's move one row up to test case 2:

Test Case #

A1

A2

A3

1

1 s y

2

1 s z

4

1 t z

6

2 s z

7

2 t y

 

We can see that the pair (1, s) exists in test case 1, the pair (1, z) exists in test case 4 and the pair (s, z) exists in test case 6. Because all pairs in test case 2 (the current row) exists in other rows, we can delete test case 2.
The new table will be:

Test Case #

A1

A2

A3

1

1 s y

4

1 t z

6

2 s z

7

2 t y

Now, let's move one row up to test case 1.

Test Case #

A1

A2

A3

1

1 s y

4

1 t z

6

2 s z

7

2 t y

We don’t have the couples (1, s), (1, z), (s, z) so we keep the line.

Test Case #

A1

A2

A3

1

1 s y

4

1 t z

6

2 s z

7

2 t y

Well, no more lines left which means that after using "All Pairs" method, we have 4 test cases to test. We reduced the number of test cases from 8 to 4 (50% less).

This was a small example that 3 variables had 2 values for each variable.

Let's say we have a screen with 3 variables, each variable can have 5 values.
The amount of test cases with "All Singles" will be: 5X5X5 = 125 test cases.
Using "All Pairs", we can reduce it to 25 test ceases, which is 80% less.

Practice 1

You have a system that can work under Win XP, Win 98 and Win NT, IE 6.5, IE 7.0 and FireFox and .Net 1.0, .Net 2.0 and .Net 3.0.
In other words:
  • Operation system (OS) can be Win XP, Win 98 or Win NT.
  • Explorer can be IE 6.5, IE 7.0 or FireFox.
  • .Net can be.Net 1.0, .Net 2.0 and .Net 3.0.

How many test cases will you have if you use the ‘all pairs’ method?

Try to solve it before continue to read the answer.

Practice 1 - answer

Using "All Singles" you will have 27 test cases:

Test Case #

OS

Explorer

.Net version

1

Win XP IE 6.5 .Net 1.0

2

Win XP IE 6.5 .Net 2.0

3

Win XP IE 6.5 .Net 3.0

4

Win XP IE 7.0 .Net 1.0
5 Win XP IE 7.0 .Net 2.0
6 Win XP IE 7.0 .Net 3.0
7 Win XP FireFox .Net 1.0
8 Win XP FireFox .Net 2.0
9 Win XP FireFox .Net 3.0
10 Win 98 IE 6.5 .Net 1.0
11 Win 98 IE 6.5 .Net 2,0
12 Win 98 IE 6.5 .Net 3.0
13 Win 98 IE 7.0 .Net 1.0
14 Win 98 IE 7.0 .Net 2.0
15 Win 98 IE 7.0 .Net 3.0
16 Win 98 FireFox .Net 1.0
17 Win 98 FireFox .Net 2.0
18 Win 98 FireFox .Net 3.0
19 Win NT IE 6.5 .Net 1.0
20 Win NT IE 6.5 .Net 2.0
21 Win NT IE 6.5 .Net 3.0
22 Win NT IE 7.0 .Net 1.0
23 Win NT IE 7.0 .Net 2.0
24 Win NT IE 7.0 .Net 3.0
25 Win NT FireFox .Net 1.0
26 Win NT FireFox .Net 2.0
27 Win NT FireFox .Net 3.0

Using "All Pairs" you will have 13 test cases: (the result is only an example, you can get other results, it all depends on the first row you started with)

Test Case #

OS

Explorer

.Net version

1

Win XP IE 6.5 .Net 1.0
5 Win XP IE 7.0 .Net 2.0
6 Win XP IE 7.0 .Net 3.0
8 Win XP FireFox .Net 2.0
9 Win XP FireFox .Net 3.0
11 Win 98 IE 6.5 .Net 2,0
12 Win 98 IE 6.5 .Net 3.0
13 Win 98 IE 7.0 .Net 1.0
16 Win 98 FireFox .Net 1.0
20 Win NT IE 6.5 .Net 2.0
21 Win NT IE 6.5 .Net 3.0
22 Win NT IE 7.0 .Net 1.0
25 Win NT FireFox .Net 1.0

Free tools

Microsoft PICT - free tool to implement "All Pairs" method.


Go Back  Print  Send Page
[Top]              [Add to Favorites]