Pairwise Testing
A combinatorial technique that ensures every pair of input values is tested at least once — typically cutting a combinatorial explosion of test cases by 80–95% while still catching the majority of defects.
What it is
Pairwise testing (also called all-pairs testing) is a combinatorial test design technique. Rather than testing every possible combination of input values, you select a minimal set of test cases that covers every pair of values at least once. The insight is that most defects are caused by interactions between one or two variables — not by complex interactions among many variables simultaneously.
This is distinct from equivalence partitioning or boundary value analysis, which test individual inputs in isolation. Pairwise is for when you have multiple inputs that could interact with each other, and you need to balance coverage against the cost of running many tests.
ISTQB definition: Pairwise testing is a black-box test design technique in which test cases are designed to cover all pairs of values of two parameters at least once. It is a specific form of combinatorial testing (CTFL 4.0 section 4.2).
The problem it solves
Imagine testing a checkout form with four configuration parameters, each with four possible values:
- Payment method: Credit card, POLi, Afterpay, Gift card
- Delivery type: Standard, Express, Same-day, Click & Collect
- Customer type: Guest, Registered, VIP, Business
- Discount code: None, 10% off, Free shipping, Bundle deal
Full combinatorial coverage: 4 × 4 × 4 × 4 = 256 test cases. Running 256 test cases for a single feature is rarely realistic in a sprint.
Pairwise testing covers all two-way interactions (every pair of values tested together at least once) in approximately 20–25 test cases. That is the same defect-catching power for combinations, at less than 10% of the testing cost.
When to use it
- Testing systems with many configuration options where combinations matter (software settings, checkout options, filter combinations)
- Form fields with multiple valid values that interact (discount code + payment method + delivery type)
- Feature flags — when multiple flags can be on or off, pairwise covers the interactions without testing every permutation
- Compatibility matrices — OS × browser × screen resolution
- Regression suites where scope needs to be cut without eliminating coverage of interactions
NZ examples where pairwise applies
- NZ e-commerce checkout: payment method (credit card / POLi / Afterpay) × delivery type (NZ Post standard / CourierPost / Click & Collect) × discount code (none / percentage / free shipping)
- NZ banking: account type (everyday / savings / term deposit) × transaction type (transfer / bill payment / international) × amount range (small / medium / large)
- Software configuration screen: browser (Chrome / Firefox / Safari / Edge) × OS (Windows / macOS / iOS / Android) × locale (en-NZ / mi-NZ)
Worked NZ example
A NZ online booking system has three parameters:
- Payment method: Credit card, POLi, Afterpay
- Delivery type: Standard (3–5 days), Express (next day), Click & Collect
- Location: Auckland, Wellington, Christchurch
Full combinations: 3 × 3 × 3 = 27 test cases
Pairwise covers all pairs in 9 test cases:
| Test # | Payment method | Delivery type | Location | Pairs covered |
|---|---|---|---|---|
| 1 | Credit card | Standard | Auckland | CC+Std, CC+AKL, Std+AKL |
| 2 | Credit card | Express | Wellington | CC+Exp, CC+WLG, Exp+WLG |
| 3 | Credit card | Click & Collect | Christchurch | CC+C&C, CC+CHC, C&C+CHC |
| 4 | POLi | Standard | Wellington | POLi+Std, POLi+WLG, Std+WLG |
| 5 | POLi | Express | Christchurch | POLi+Exp, POLi+CHC, Exp+CHC |
| 6 | POLi | Click & Collect | Auckland | POLi+C&C, POLi+AKL, C&C+AKL |
| 7 | Afterpay | Standard | Christchurch | AP+Std, AP+CHC, Std+CHC |
| 8 | Afterpay | Express | Auckland | AP+Exp, AP+AKL, Exp+AKL |
| 9 | Afterpay | Click & Collect | Wellington | AP+C&C, AP+WLG, C&C+WLG |
Every pair is covered at least once across these 9 tests. If Afterpay + Click & Collect has a bug (a known issue with some NZ payment providers and in-store pickup), test #9 will catch it. If Express delivery to Christchurch has a routing issue, test #5 will catch it.
Important: do not build pairwise tables by hand for more than 3–4 parameters. The algorithm is complex and humans make pairing errors. Use a tool (PICT, AllPairs, Hexawise) to generate the table from your parameter list.
Why it works
Research by NIST (National Institute of Standards and Technology) analysed hundreds of software defects and found that:
- ~70% of defects are caused by a single parameter (covered by equivalence partitioning)
- ~90% of defects are caused by interactions between at most 2 parameters (covered by pairwise testing)
- ~98% of defects are caused by interactions between at most 3 parameters (covered by 3-way combinatorial testing)
This means pairwise testing — covering all 2-way interactions — catches approximately 90% of the defects that full combinatorial testing would catch, at a fraction of the test count. The remaining ~10% require 3-way or higher-order coverage and are typically reserved for safety-critical systems.
Tools
- PICT (Pairwise Independent Combinatorial Testing, Microsoft, free CLI tool) — the most widely used pairwise generator. You define your parameters and values in a text file; PICT outputs the minimum test set. Runs on Windows, macOS, and Linux.
- AllPairs (free, Python-based) — similar to PICT; useful in Python-heavy automation environments
- Hexawise (commercial, web-based) — more user-friendly interface; produces pairwise and higher-order combinatorial sets; good for larger parameter sets
Using PICT: a quick example
Create a .txt file with your parameters and values:
| File content |
|---|
Payment: Credit card, POLi, Afterpay |
Delivery: Standard, Express, Click & Collect |
Location: Auckland, Wellington, Christchurch |
Run pict booking.txt and PICT outputs the 9-row test set above. For 10 parameters with 5 values each (full combinations: 5^10 = ~10 million), PICT generates approximately 35 test cases.
When not to use it
- Safety-critical systems — medical devices, aviation, nuclear control systems may require full combinatorial testing or even higher-order coverage. Pairwise is not sufficient when all combinations must be verified for safety.
- Known 3-way (or higher) interactions — if you already know that three specific parameters interact in a way that causes defects, use 3-way combinatorial testing (or targeted decision table testing) rather than pairwise.
- Very few parameters or values — if you have only 2 parameters with 3 values each, full combinatorial is only 9 tests. There’s no need for pairwise reduction.
Bugs pairwise testing typically catches
- A discount code that fails only when combined with Afterpay as the payment method (not with credit card or POLi)
- Click & Collect orders that fail for Wellington customers but not Auckland or Christchurch
- A form that only breaks when a long company name is entered and the city is Christchurch (due to a character limit in the Christchurch address database lookup)
- Express delivery unavailable for certain NZ regions, but only when a specific discount code is applied (the two interact in the pricing engine)
- A configuration screen where two specific feature flags enabled simultaneously cause a conflict, even though each flag works correctly in isolation
ISTQB mapping
| Syllabus ref | Topic | Level |
|---|---|---|
| CTFL 4.0 — 4.2 | Combinatorial testing techniques — pairwise as a specific technique | Foundation |
| FL-4.2 K3 | Apply pairwise testing to derive test cases for a given component or system | Foundation LO |
| CTAL-TA 3.2 | Advanced combinatorial techniques, n-way testing, constraint modelling | Advanced / Senior |
The ISTQB Foundation exam expects you to apply pairwise testing (K3). You must be able to identify parameters and values from a specification, understand what a pairwise table covers, and know when the technique is appropriate.
Tips
Don’t build pairwise tables by hand — use PICT or AllPairs. Feed in your parameters and values, and the tool generates the minimum set in seconds. Pairwise is especially valuable for regression suites where you need to cut scope without cutting coverage of interactions. If your sprint regression suite has 200 tests covering a configuration-heavy feature, a well-designed pairwise set might achieve the same interaction coverage in 30.
- Identify parameters carefully — the quality of your pairwise set depends entirely on correctly identifying the parameters that can interact. Think about which inputs go through the same code path together.
- Add a few targeted tests beyond pairwise — if you have business knowledge that suggests a particular 3-way interaction is risky, add a specific test for it. Pairwise is a baseline, not a ceiling.
- Use pairwise for compatibility matrices — if you need to test across browsers, operating systems, and screen sizes, pairwise dramatically reduces the matrix size without abandoning cross-environment coverage.
- Combine with risk-based prioritisation — not all pairs are equally risky. Use business knowledge to flag which parameter combinations are highest-risk and verify those are included in your generated set.
Practice this technique: Try Junior Practice 06 — Dropdown & select bugs.
Try It — Spot the missing pair
A NZ ferry booking system has three parameters. Someone has drafted a pairwise test set of 7 cases, but two pairs are not covered. Identify which pairs are missing.
- Payment: Credit card (CC), POLi (PO), Afterpay (AP)
- Passenger type: Adult (AD), Child (CH), Senior (SR)
- Route: Interislander (IS), Bluebridge (BB)
| Test # | Payment | Passenger | Route |
|---|---|---|---|
| 1 | CC | AD | IS |
| 2 | CC | CH | BB |
| 3 | PO | AD | BB |
| 4 | PO | CH | IS |
| 5 | AP | AD | BB |
| 6 | AP | CH | IS |
| 7 | CC | SR | IS |
Which two pairs are not covered by this test set?
Missing pairs
The two uncovered pairs are PO + SR (POLi with a Senior passenger) and AP + SR (Afterpay with a Senior passenger).
Tests 1–7 include Senior only in test #7 (CC + SR + IS). That covers CC+SR and SR+IS, but neither POLi+Senior nor Afterpay+Senior appears anywhere. Add two more tests:
| Test # | Payment | Passenger | Route | Pairs added |
|---|---|---|---|---|
| 8 | PO | SR | BB | PO+SR, SR+BB |
| 9 | AP | SR | BB | AP+SR (BB+SR already from #8) |
The key skill is auditing a pairwise set against a coverage matrix. With 3 parameters of 3/3/2 values, you need: CC×AD, CC×CH, CC×SR, PO×AD, PO×CH, PO×SR, AP×AD, AP×CH, AP×SR (9 payment+passenger pairs) plus IS/BB crossed with each payment and passenger. Any Senior row missing a payment covers a gap.