Glossary · Test design
Pairwise testing
Also called: all-pairs testing, all pairs testing, pairwise, pair-wise testing
Definition
A combinatorial technique that picks a small set of test cases in which every pair of parameter values appears together at least once.
Pairwise testing (all-pairs testing) reduces the number of combinations you need when a feature has several parameters. Instead of testing every possible combination, it chooses a set of tests where every value of each parameter is paired with every value of every other parameter at least once. The idea rests on a practical observation: most configuration-related defects are triggered by a single parameter or by the interaction of two, and far fewer need three or more specific values at once.
Example
A web app must work across these options:
- Browser: Chrome, Firefox, Safari
- OS: Windows, macOS, Linux
- Language: English, German, Japanese
Every combination is 3 x 3 x 3 = 27 tests. A pairwise set needs only 9:
| # | Browser | OS | Language |
|---|---|---|---|
| 1 | Chrome | Windows | English |
| 2 | Chrome | macOS | German |
| 3 | Chrome | Linux | Japanese |
| 4 | Firefox | Windows | German |
| 5 | Firefox | macOS | Japanese |
| 6 | Firefox | Linux | English |
| 7 | Safari | Windows | Japanese |
| 8 | Safari | macOS | English |
| 9 | Safari | Linux | German |
Check any two columns: every pair appears. Chrome with Linux is row 3, macOS with Japanese is row 5, Safari with German is row 9. With more parameters the savings grow quickly. Ten parameters with three values each have 59,049 combinations, while a pairwise set can cover all pairs in roughly 15 to 20 tests, depending on the generator.
Constraints
Real systems have impossible combinations. Safari is not available on Linux, so row 9 must be replaced, and good generators let you declare constraints like this and then rebuild the set so every valid pair is still covered. Tools that generate pairwise sets include Microsoft’s PICT and the AllPairs family of scripts.
When not to rely on it
- Known risky combinations. If a specific three-way combination matters (a payment method, currency and country), add it explicitly.
- Rules that depend on several inputs together. Use a decision table to capture business logic; pairwise is for coverage of configurations and independent options.
- Single critical parameters. Pairwise does not replace equivalence partitioning and boundary values for each parameter’s own values.
Higher-strength variants (3-wise, or t-wise in general) cover every triple or larger tuple, at the cost of more tests.