Pairwise & Combinatorial Testing
Pairwise (also called all-pairs) testing is a combinatorial technique that dramatically reduces the number of test cases needed when multiple parameters interact. Research shows that most software failures are caused by the interaction of just 2 parameters — so testing all unique pairs guarantees catching those bugs while reducing test cases by 60-90% versus exhaustive testing.
30 min•By Priygop Team•Updated 2026
The Combinatorial Explosion Problem
- Problem: A form has 3 parameters, each with 3 possible values = 3×3×3 = 27 test cases for exhaustive coverage
- With 5 parameters and 4 values each = 4^5 = 1,024 test cases (impossible budget)
- Pairwise solution: Test every possible pair of parameter values at least once
- Pairwise result: The same 5-parameter system requires only 16 test cases instead of 1,024
- Research backing: Studies show 60-90% of bugs are triggered by interactions of 2 or fewer parameters
- Tools: PICT (Microsoft), AllPairs, TestCaseMaker generate optimal pairwise test sets automatically
Pairwise Testing in Practice
Pairwise Testing in Practice
// ══════════════════════════════════════════════════════════════
// SCENARIO: Web form with 4 parameters
// OS: Windows, macOS, Linux
// Browser: Chrome, Firefox, Safari
// Language: English, Spanish, French
// User Role: Guest, Registered, Admin
//
// Exhaustive: 3 × 3 × 3 × 3 = 81 test cases
// Pairwise goal: Cover all unique OS-Browser, OS-Language,
// OS-Role, Browser-Language, Browser-Role,
// Language-Role pairs
// Pairwise result: ~9 test cases cover all pairs!
// ══════════════════════════════════════════════════════════════
// Pairwise-generated test cases (covers ALL pairs):
const pairwiseTests = [
// TC OS Browser Language Role
{ id: 1, os: "Windows", browser: "Chrome", lang: "English", role: "Guest" },
{ id: 2, os: "Windows", browser: "Firefox", lang: "Spanish", role: "Registered" },
{ id: 3, os: "Windows", browser: "Safari", lang: "French", role: "Admin" },
{ id: 4, os: "macOS", browser: "Chrome", lang: "Spanish", role: "Admin" },
{ id: 5, os: "macOS", browser: "Firefox", lang: "French", role: "Guest" },
{ id: 6, os: "macOS", browser: "Safari", lang: "English", role: "Registered" },
{ id: 7, os: "Linux", browser: "Chrome", lang: "French", role: "Registered" },
{ id: 8, os: "Linux", browser: "Firefox", lang: "English", role: "Admin" },
{ id: 9, os: "Linux", browser: "Safari", lang: "Spanish", role: "Guest" },
];
// 9 tests vs 81 exhaustive — 89% reduction with same bug-finding power for pair interactions
// ══════════════════════════════════════════════════════════════
// WHEN TO USE PAIRWISE TESTING
// ══════════════════════════════════════════════════════════════
// ✅ Compatibility matrices (OS × Browser × Device)
// ✅ Configuration testing (settings with multiple options)
// ✅ Form fields with multiple dropdowns
// ✅ API parameters with multiple options
// ✅ Feature flag combinations (A/B testing configurations)
// ✅ Real-world example: Microsoft uses pairwise in Windows testing
// to reduce driver compatibility tests from millions to thousandsDiagram
Loading diagram…
Technical diagram.
Common Mistakes
- Using pairwise for dependent parameters — pairwise assumes parameters are independent; if Browser=Safari only exists on macOS, pair restrictions must be defined
- Skipping PICT or similar tools — calculating pairwise manually for 5+ parameters is error-prone; use a generator
- Applying pairwise to all tests — pairwise is for configuration/compatibility scenarios; use BVA/EP for individual field validation
- Confusing pairwise with random testing — pairwise is a systematic mathematical technique, not random sampling
Key Takeaways
- Pairwise (also called all-pairs) testing is a combinatorial technique that dramatically reduces the number of test cases needed when multiple parameters interact.
- Problem: A form has 3 parameters, each with 3 possible values = 3×3×3 = 27 test cases for exhaustive coverage
- With 5 parameters and 4 values each = 4^5 = 1,024 test cases (impossible budget)
- Pairwise solution: Test every possible pair of parameter values at least once