ArticleslgStudy

chemistry

Elementary comparison testing

Elementary comparison testing is a chemistry topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Elementary comparison testing rather than just read about it. In short: Elementary comparison testing (ECT) 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.

Elementary comparison testing — main illustration
Elementary comparison testing — illustration

Key takeaways

  • Elementary comparison testing belongs to chemistry; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Elementary comparison testing to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Elementary comparison testing from memory before moving on to harder problems.

Reference excerpt

Elementary comparison testing (ECT) 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. 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 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 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 Identify decisions Determine test situations per decision point (Modified Condition / Decision Coverage) Create logical test-case matrix Create physical test-case matrix

Example

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:

Step 1: Decisions

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

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

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

Physical test cases are created from logical test cases by filling in actual value representations and their respective results.

Test-case graph

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 Code coverage § Multiple condition coverage Control-flow graph Decision-to-decision path

References

Illustrations

Elementary comparison testing: Figure 3: ECT Inductive Proof End
Figure 3: ECT Inductive Proof End
Elementary comparison testing: Figure 4: ECT Example Control-Flow Graph
Figure 4: ECT Example Control-Flow Graph
Elementary comparison testing: Figure 5: ECT Example D2 Conditions
Figure 5: ECT Example D2 Conditions
Elementary comparison testing: Figure 6: ECT Example Test Case Graph
Figure 6: ECT Example Test Case Graph

Worked examples

Example 1 — a first encounter with Elementary comparison testing

Start with the simplest possible case. Write down what Elementary comparison testing claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In chemistry, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Elementary comparison testing before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Elementary comparison testing ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Elementary comparison testing

In research
Elementary comparison testing appears in chemistry research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Elementary comparison testing in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Elementary comparison testing is common in secondary-school and first-year university syllabi. It links to neighbouring topics Software testing, so understanding it makes those chapters shorter.
In everyday life
Look for Elementary comparison testing outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Elementary comparison testing” →

How to study Elementary comparison testing in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Elementary comparison testing means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Elementary comparison testing out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Elementary comparison testing in simple terms?

Elementary comparison testing (ECT) 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.

Why does Elementary comparison testing matter?

Because it connects several chemistry ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Elementary comparison testing?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Elementary comparison testing.

Tags

  • Software testing

Keep exploring