Pairwise testing

Pairwise testing, also called all-pairs testing, is a software test design technique that chooses a small set of test cases in which every pair of values from any two parameters appears together at least once. It tests far fewer combinations than the full set while still exercising every two-way interaction between parameters.

The longer version

A page that must work across three browsers, three operating systems and three viewport sizes has 27 full combinations. A pairwise set of nine can still put every browser with every operating system, every browser with every viewport and every operating system with every viewport. Tools generate the set from the parameters and their values, and the saving grows quickly as parameters are added.

The technique assumes that a failure is caused by a single parameter or by the interaction of two. Where that holds, covering all pairs finds the defect. Where a bug needs three values to line up, such as one browser on one system at one width, a pairwise set can miss it, and the tester has to add the specific triples that the product's history or architecture makes risky.

Most of the effort goes into choosing the values. The parameters should be independent enough to combine, and the values within each should already be grouped by equivalence partitioning so that one stands for a class. Some pairs are impossible, such as a browser that does not run on a given system, and the generator needs to be told so that it does not spend tests on them.

Compatibility checking is the natural fit, because the parameters are enumerable and the full matrix is expensive. A test matrix of browsers, devices and settings is a table to be thinned, and pairwise selection does the thinning with a stated guarantee.

Common questions

What is pairwise testing?

A technique that reduces the number of test combinations by covering every pair of parameter values rather than every full combination. If a test has several parameters, the set is built so that any two of them meet in all their value pairings at least once, which keeps the suite small and the interactions covered.

How does pairwise testing reduce the number of test cases?

Full combination multiplies the value counts of every parameter, so three parameters with three values each give 27 cases. Covering pairs only requires that each two-parameter pairing appears somewhere, and nine well-chosen cases achieve that for this example. The gap widens as parameters are added.

When is pairwise testing not enough?

When a defect needs three or more parameters to interact, a pairwise set can pass while the bug remains. High-risk or safety-related combinations should be added by hand, or a stronger variant covering triples should be used. The method also assumes parameters can be combined freely, so impossible pairs must be excluded.

What tools generate pairwise test sets?

Free generators such as Microsoft's PICT and the open-source AllPairs, along with several commercial test design tools, take a list of parameters and values and output the reduced set. Most also accept constraints that exclude invalid combinations, and some can raise the strength to cover triples.

Does pairwise testing replace equivalence partitioning?

The two solve different problems and work in sequence. Equivalence partitioning decides which values are worth testing for each parameter, and pairwise testing decides how to combine those values across parameters. Skipping the first step leaves the second with a long, redundant list of values to combine.

Bug reports that arrive ready to triage.

Collect replay, console, network and browser context with the Free plan.

<script src="…/widget.js" data-key="pb_pub_…">