Elementary comparison testing (ECT) is a white-box, control-flow, test-design methodology used in software development.[1] [2] The purpose of ECT is to enable detailed testing of complex software. Software code or pseudocode is tested to assess the proper handling of all decision outcomes. As with multiple-condition coverage[3] and basis path testing, coverage of all independent and isolated conditions is accomplished through modified condition/decision coverage (MC/DC).[4] Isolated conditions are aggregated into connected situations creating formal test cases. The independence of a condition is shown by changing the condition value in isolation. Each relevant condition value is covered by test cases.
A test case consists of a logical path through one or many decisions from start to end of a process. Contradictory situations are deduced from the test case matrix and excluded. The MC/DC approach isolates every condition, neglecting all possible subpath combinations and path coverage.where
The decision
di
The transition function
\alpha
Given the transition
\vdash
the isolated test path
Pm
A test case graph illustrates all the necessary independent paths (test cases) to cover all isolated conditions. Conditions are represented by nodes, and condition values (situations) by edges. An edge addresses all program situations. Each situation is connected to one preceding and successive condition. Test cases might overlap due to isolated conditions.
The elementary comparison testing method can be used to determine the number of condition paths by inductive proof.
There are
r=2n
When each condition
ci
T
\forall{i}\in\{1,...,n\}
0<e<i+1
ci
s=2
ci
Each individual condition
ci
n
cn
cn
All predecessor conditions
ci; i<n
This example shows ETC applied to a holiday booking system. The discount system offers reduced-price vacations. The offered discounts are
-20\%
-10\%
0\%
Pseudocode
if days > 15 or price > 1000 or member then return −0.2 else if (days > 8 and days ≤ 15 or price ≥ 500 and price ≤ 1000) and workday then return −0.1 else return 0.0
Factors
<8; 8-15; >15
<500; 500-1000; >1000
T=3 x 3 x 4 x 3=108
Example in Python:
Outcome | ||||||||
---|---|---|---|---|---|---|---|---|
Decision D1 | 1 | 0 | ||||||
Conditions | c1 | c2 | c3 | c1 | c2 | c3 | ||
c1 | days>15 | 1 | 0 | 0 | 0 | 0 | 0 | |
c2 | price>1000 | 0 | 1 | 0 | ||||
c3 | member | 0 | 0 | 1 |
Outcome | ||||||||
---|---|---|---|---|---|---|---|---|
Decision D2 | 1 | 0 | ||||||
Conditions | c4 | c5 | c6 | c4 | c5 | c6 | ||
c4 | 8<days<15 | 1 | 0 | 1 | 0 | 0 | 1 | |
c5 | 500<price<1000 | 0 | 1 | 1 | ||||
c6 | workday | 1 | 0 | 0 |
The highlighted diagonals in the MC/DC Matrix are describing the isolated conditions:all duplicate situations are regarded as proven and removed.
Situation Sj | T1 | T2 | T3 | T4 | T5 | T6 | T7 | |
---|---|---|---|---|---|---|---|---|
\alpha(d1,100)\mapsto(1,E) | x | |||||||
\alpha(d1,000)\mapsto(0,d2) | x | x | x | x | ||||
\alpha(d1,010)\mapsto(1,E) | x | |||||||
\alpha(d1,001)\mapsto(1,E) | x | |||||||
\alpha(d2,101)\mapsto(1,E) | x | |||||||
\alpha(d2,001)\mapsto(1,E) | x | |||||||
\alpha(d2,011)\mapsto(1,E) | x | |||||||
\alpha(d2,110)\mapsto(0,E) | x |
Test cases are formed by tracing decision paths. For every decision
di; 0<i<n+1
S
E
Factor\Test Case | T1 | T2 | T3 | T4 | T5 | T6 | T7 | |
---|---|---|---|---|---|---|---|---|
days | 16 | 14 | 8 | 8 | 8 | |||
price | 1100 | 600 | ||||||
departure | sa | |||||||
member | silver | |||||||
Result | ||||||||
0 | 0 | |||||||
-10 | 1 | 1 | 1 | |||||
-20 | 1 | 1 | 1 |
Physical test cases are created from logical test cases by filling in actual value representations and their respective results.
In the example test case graph, all test cases and their isolated conditions are marked by colors, and the remaining paths are implicitly passed.