In computer science, all-pairs testing or pairwise testing is a combinatorial method of software testing that, for each pair of input parameters to a system (typically, a software algorithm), tests all possible discrete combinations of those parameters. Using carefully chosen test vectors, this can be done much faster than an exhaustive search of all combinations of all parameters by "parallelizing" the tests of parameter pairs.[1]
In most cases, a single input parameter or an interaction between two parameters is what causes a program's bugs.[2] Bugs involving interactions between three or more parameters are both progressively less common [3] and also progressively more expensive to find, such testing has as its limit the testing of all possible inputs.[4] Thus, a combinatorial technique for picking test cases like all-pairs testing is a useful cost-benefit compromise that enables a significant reduction in the number of test cases without drastically compromising functional coverage.[5]
More rigorously, if we assume that a test case has
N
\{Pi\}=\{P1,P2,...,PN\}
R(Pi)=Ri
|Ri|=ni
\prodni
To demonstrate, suppose there are X,Y,Z parameters.We can use a predicate of the form
P(X,Y,Z)
p(u,v)
P(X,Y,Z)
pxy(X,Y),pyz(Y,Z),pzx(Z,X)
X=\{ni\}
max(S)
S
T=max(X) x max(X\setminusmax(X))
Therefore, if the
n=max(X)
m=max(X\setminusmax(X))
\prodni
N-wise testing can be considered the generalized form of pair-wise testing.
The idea is to apply sorting to the set
X=\{ni\}
P=\{Pi\}
N
Ps=<Pi> ; i<j\implies|R(Pi)|<|R(Pj)|
Now we can take the set
X(2)=\{PN-1,PN-2\}
X(3)=\{PN-1,PN-2,PN-3\}
X(T)=\{PN-1,PN-2,...,PN-T\}
The N-wise testing then would just be, all possible combinations from the above formula.
Consider the parameters shown in the table below.
Parameter name | Value 1 | Value 2 | Value 3 | Value 4 | |
---|---|---|---|---|---|
Enabled | True | False | - | - | |
Choice type | 1 | 2 | 3 | - | |
Category | a | b | c | d |
'Enabled', 'Choice Type' and 'Category' have a choice range of 2, 3 and 4, respectively. An exhaustive test would involve 24 tests (2 x 3 x 4). Multiplying the two largest values (3 and 4) indicates that a pair-wise tests would involve 12 tests. The pairwise test cases, generated by Microsoft's "pict" tool, are shown below.
Enabled | Choice type | Category | |
---|---|---|---|
True | 3 | a | |
True | 1 | d | |
False | 1 | c | |
False | 2 | d | |
True | 2 | c | |
False | 2 | a | |
False | 1 | a | |
False | 3 | b | |
True | 2 | b | |
True | 3 | d | |
False | 3 | c | |
True | 1 | b |