Pairwise testing is used to check combinations of input parameters.
Pairwise Testing
Example of a multi-parameter form
The «Room Booking» form allows you to book a meeting room for a specific time slot.
The form has three input parameters: Meeting duration, Room, Confirmation required.
Each parameter has several possible values. If we create all combinations and test them using brute force, we will get 12 tests.
| # | Meeting duration | Room | Confirmation required |
|---|---|---|---|
| 1 | 30 minutes | Little Bear | No |
| 2 | 30 minutes | Little Bear | Yes |
| 3 | 30 minutes | Orion | No |
| 4 | 30 minutes | Orion | Yes |
| 5 | 30 minutes | Andromeda | No |
| 6 | 30 minutes | Andromeda | Yes |
| 7 | 1 hour | Little Bear | No |
| 8 | 1 hour | Little Bear | Yes |
| 9 | 1 hour | Orion | No |
| 10 | 1 hour | Orion | Yes |
| 11 | 1 hour | Andromeda | No |
| 12 | 1 hour | Andromeda | Yes |
Formula for calculating all combinations
If you have
n
parameters, and each of them has
v1, v2, ..., vn
possible values, the total number of combinations is calculated as:
Total combinations = v1 × v2 × ... × vn
For the «Room Booking» form, the number of combinations is:
- Meeting duration — 30 minutes, 1 hour — 2 values
- Room — Little Bear, Orion, Andromeda — 3 values
- Confirmation required — Yes, No — 2 values
Total combinations = 2 × 3 × 2 = 12
Combination optimization
Pairwise testing helps reduce the number of tests.
Instead of testing every possible combination, pairwise testing focuses on covering all pairs of values, because most defects occur due to the interaction of two parameters—not all parameters at once.
Pairwise testing allows you to cut the number of tests for the «Room Booking» form in half:
| # | Meeting duration | Room | Confirmation required |
|---|---|---|---|
| 1 | 30 minutes | Little Bear | No |
| 2 | 30 minutes | Orion | Yes |
| 3 | 30 minutes | Andromeda | No |
| 4 | 1 hour | Little Bear | Yes |
| 5 | 1 hour | Orion | No |
| 6 | 1 hour | Andromeda | Yes |
To avoid creating pairs manually, you can use an online generator.
Уровень повышен!