Q6 of 38 · Test design
What is pairwise testing and why is it useful?
Short answer
Short answer: Pairwise testing covers every pair of input combinations rather than every full combination. For systems with many inputs, it shrinks the test count dramatically (often 5-10×) while empirically catching most combinatorial bugs.
Detail
Pairwise (or all-pairs) testing rests on a result from combinatorial testing research: most defects in systems with multiple inputs depend on the interaction of just two inputs at a time. By covering every pair of input combinations, you catch the vast majority of those bugs without enumerating every full combination.
The math is dramatic. A feature with 5 inputs, each with 4 values, has 4^5 = 1024 full combinations. The minimum number of test cases needed to cover every pair is around 16 — a 60× reduction.
When pairwise is the right tool:
- Many inputs, many values per input (full combinatorial is impractical).
- Inputs combine in unknown ways (you don't have a decision table).
- Risk profile is "any pair could be buggy" — typical for configuration UIs, search filters, form combinations.
How to apply it:
- List inputs and their possible values.
- Use a tool — PICT (Microsoft), AllPairs.py, Hexawise — to generate the minimum set covering every pair.
- Run the generated cases. If a defect is found involving three or more inputs, add explicit cases (pairwise won't catch those).
Limits worth knowing:
- Three-way bugs slip through. If a defect requires admin + UK + free together but not any pair, pairwise misses it. Higher-order (t-way) techniques exist but cost more cases.
- Pairwise doesn't tell you the right answer. It tells you which combinations to test; you still have to know the expected behaviour for each.
NIST research suggests ~70% of defects involve 1 or 2 factors; ~95% involve ≤ 4. Pairwise hits the sweet spot for most projects.