Elementary comparison testing
Elementary comparison testing is a white-box, control-flow, test-design methodology used in software development. 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 and basis path testing, coverage of all independent and isolated conditions is accomplished through modified condition/decision coverage (MC/DC). 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.
Test case
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
- T is the number of test cases per decision and
- n the number of conditions.
The transition function is defined as
Given the transition
the isolated test path consists of
Test case graph
A test case graph illustrates all the necessary independent paths to cover all isolated conditions. Conditions are represented by nodes, and condition values 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.Inductive proof of a number of condition paths
The elementary comparison testing method can be used to determine the number of condition paths by inductive proof.There are possible condition value combinations
When each condition is isolated, the number of required test cases per decision is:
there are edges from parent nodes and edges to child nodes from.
Each individual condition connects to at least one path
from the maximal possible connecting to isolating.
All predecessor conditions and respective paths are isolated. Therefore, when one node is added, the total number of paths, and required test cases, from start to finish increases by:
Q.E.D.
Test-case design steps
- Identify decisions
- Determine test situations per decision point
- Create logical test-case matrix
- Create physical test-case matrix
Example
Pseudocode
if days > 15 or price > 1000 or member then
return −0.2
else if 'and workday then
return −0.1
else
return 0.0
Factors'
- Number of days:
- Price :
- Membership card: none; silver; gold; platinum
- Departure date: workday; weekend; holiday
Example in Python:
if days > 15 or price > 1000 or member:
return -0.2
elif and workday:
return -0.1
else:
return 0.0
Step 1: Decisions
Step 2: MC/DC Matrix
The highlighted diagonals in the MC/DC Matrix are describing the isolated conditions:all duplicate situations are regarded as proven and removed.