Elementary comparison testing

Elementary comparison testing (ECT) is a white-box, control-flow, test-design methodology used in software development.

Uses your system voice; voice and rate in settings.

≈ 7 min read

Cite, export and learn8 citation formats · 8 exports · lesson and quiz

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

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,[1] 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.

Test case

edit edit source

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.[1] T=n+1 where

  • T is the number of test cases per decision and
  • n the number of conditions.

The decision di consists of a combination of elementary conditions

Σ={0,1}C={c0,c1,c2,c3,...,cn} ϵ:C→Σ×C D⊆C∗;di∈D

The transition function α is defined as α:D×Σ∗→Σ×D

Given the transition ⊢ ⊢⊆(Σ×D×Σ∗)×(Σ×D×Σ∗)

Sj=(bj,dm,vj)⊢(bj+1,dn,vj+1) Ej=(aj,cj)⊢(aj+1,ck) (bj+1,dn)=α(dm,vj);(bj+1,ck)=ϵ(cj);aj∈Σ, the isolated test path Pm consists of Pm=(b0,d0,v0)⊢...⊢(bi,di,vi)⊢∗(bn,dn,vn)=(b0,c0)⊢...⊢(bm,cm)⊢∗(bn,cn) bi∈Σ;cm∈di;v∈C∗;d0=S;dn=E.

Test case graph

edit edit source

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.

Inductive proof of a number of condition paths

edit edit source

The elementary comparison testing method can be used to determine the number of condition paths by inductive proof.

There are r=2n possible condition value combinations ∀i∈{1,...,n}, ci↦{0, 1}.

When each condition ci is isolated, the number of required test cases T per decision is: T=log2(r)+1=n+1.

∀i∈{1,...,n} there are 0<e<i+1 edges from parent nodes ci and s=2 edges to child nodes from ci.

Each individual condition ci connects to at least one path ∀i∈{1,...,n−1}, ci↦{0, 1} from the maximal possible n connecting to cn isolating cn.

All predecessor conditions ci; i<n and respective paths are isolated. Therefore, when one node (condition) is added, the total number of paths, and required test cases, from start to finish increases by: T=n−1+2=n+1. Q.E.D.

Test-case design steps

edit edit source
  1. Identify decisions
  2. Determine test situations per decision point (Modified Condition / Decision Coverage)
  3. Create logical test-case matrix
  4. Create physical test-case matrix

Example

edit edit source

This example shows ETC applied to a holiday booking system. The discount system offers reduced-price vacations. The offered discounts are −20% for members or for expensive vacations, −10% for moderate vacations with workday departures, and 0% otherwise. The example shows the creation of logical and physical test cases for all isolated conditions.

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

  • Number of days: <8; 8−15; >15
  • Price (euros): <500; 500−1000; >1000
  • Membership card: none; silver; gold; platinum
  • Departure date: workday; weekend; holiday

T=3×3×4×3=108 possible combinations (test cases).

Example in Python:

if days > 15 or price > 1000 or member: return -0.2 elif (days > 8 and days <= 15 or price >= 500 and price <= 1000) and workday: return -0.1 else: return 0.0

Step 1: Decisions

edit edit source
Table 1: Example D1 MC/DC
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 0 0 0
c3 member 0 0 1 0 0 0

d1=days>15 or price>1000 Eur or memberc1=days>15c2=price>1000c3=member d2=(8<days<15 or 500<price<1000 Eur) and workdayc4=8<days<15c5=500<price<1000 Eurc6=workday

Step 2: MC/DC Matrix

edit edit source
Table 2: Example D2 MC/DC
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 0 0 1
c6 workday 1 0 1 1 0 0

The highlighted diagonals in the MC/DC Matrix are describing the isolated conditions: (ci,ci)↦{1,0} all duplicate situations are regarded as proven and removed.

Step 3: Logical test-Case matrix

edit edit source
Table 3: Example Logical Test Case Matrix
Situation Sj T1 T2 T3 T4 T5 T6 T7
α(d1,𝟏00)↦(1,E) x
α(d1,𝟎00)↦(0,d2) x x x x
α(d1,0𝟏0)↦(1,E) x
α(d1,00𝟏)↦(1,E) x
α(d2,𝟏01)↦(1,E) x
α(d2,𝟎01)↦(1,E) x
α(d2,0𝟏1)↦(1,E) x
α(d2,11𝟎)↦(0,E) x

Test cases are formed by tracing decision paths. For every decision di; 0<i<n+1 a succeeding and preceding subpath is searched until every connected path has a start S and an end E: T1=(d1,100)⊢(1,E)T2=(d1,000)⊢(0,d2,100)⊢(1,E)T3=(d1,010)⊢(1,E)⋮Tn+1

Step 4: Physical test-case matrix

edit edit source
Table 4: Example Physical Test Cases
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.

Test-case graph

edit edit source

In the example test case graph, all test cases and their isolated conditions are marked by colors, and the remaining paths are implicitly passed.

See also

edit edit source

References

edit edit source
  1. ^ a b c Lee Copeland (2004). A Practitioners Guide to Software Test Design, chapter 10. Artech House Publishers, Norwood. ISBN 0140289712. Wikipedia revision 1306187737, retrieved 2026-11-19
  2. ^ "All about the elementary comparison test | Testlearning". www.testlearning.net. Retrieved 2022-09-02. Wikipedia revision 1306187737, retrieved 2026-11-19
  3. ^ Glenford J. Myers (2004). The Art of Software Testing, Second Edition, p. 40., John Wiley & Sons, New Jersey. ISBN 0-471-46912-2. Wikipedia revision 1306187737, retrieved 2026-11-19
  4. ^ Tim Kroom (2006). TMap Next, for result driven testing, p. 668. UTN Publishers, Rotterdam. ASIN B01K3PXI5U. Wikipedia revision 1306187737, retrieved 2026-11-19

Text derived from https://en.wikipedia.org/w/index.php?oldid=1306187737 under CC BY-SA 4.0; modifications have been made.

Words in each sectionExampleExampleExample: 598 words598Test caseTest caseTest case: 165 words165Inductive proof of a nu…Inductive proof of a number of condition pathsInductive proof of a number of condition paths: 157 words157Test case graphTest case graphTest case graph: 55 words55Test-case design stepsTest-case design stepsTest-case design steps: 23 words23See alsoSee alsoSee also: 13 words13
Words in each section. Measured from the stored article body; sections below the minimum are not plotted.

Provenance

snapshot enwiki-001306187737 · captured 2025-08-16 · ledger · version history

Cite this page as: encyclopegia.org, “Elementary comparison testing”, snapshot enwiki-001306187737. https://encyclopegia.org/a/elementary-comparison-testing