4.5.13 · D3Software Engineering

Worked examples — Testing — unit, integration, system, acceptance, smoke, regression

2,608 words12 min readBack to topic

This page is a drill. The parent note told you what the six test types are. Here we throw every awkward case at you — every "which test do I use?", every degenerate input, every limiting number — and work each one fully. First guess, then read.


The scenario matrix

Think of every question this topic can ask as living in one of these cells. The worked examples that follow each carry a [Cell X] tag so you can see the whole space get covered.

Cell Case class What makes it tricky Example
A Classify a test (unit vs integration) the "mocked DB" trap Ex 1
B Classify a test (system vs acceptance) Verification vs Validation Ex 2
C Classify a test (smoke vs regression) both "re-run checks" Ex 3
D Cost-of-delay — normal Ex 4
E Cost-of-delay — degenerate "caught immediately" edge Ex 4
F Cost-of-delay — limiting large why cost explodes Ex 4
G Suite trust — normal case Ex 5
H Suite trust — degenerate or perfect / single test Ex 5
I Suite trust — limiting why flaky top of pyramid is poison Ex 5
J Real-world word problem pick tests + estimate savings Ex 6
K Exam-style twist "all tests green" but wrong product Ex 7
L Ordering a pipeline fail-fast arithmetic Ex 8

The two formulas you will lean on (from the parent, restated so nothing is assumed):


Cells A–C — classification (no arithmetic, pure judgement)


Cells D–F — cost of delay across all

The figure below draws with , . Notice the vertical axis is logarithmic — a straight line there means explosive growth.

Figure — Testing — unit, integration, system, acceptance, smoke, regression

Cells G–I — suite trust across all and

The next figure plots against the number of tests , for three reliabilities . Watch the top curve collapse as tests accumulate.

Figure — Testing — unit, integration, system, acceptance, smoke, regression

Cell J — a real-world word problem


Cell K — the exam-style twist


Cell L — ordering a pipeline (fail-fast arithmetic)


Recall Quick self-test on the matrix

Test with mocked DB is which type? ::: A unit test — no real seam runs. System test answers which V&V word? ::: Verification — built the product right. Acceptance test answers which V&V word? ::: Validation — built the right product. Cost of a bug caught immediately, c=\50, k=1050\cdot10^0 = $5050\cdot10^3 = $50{,}000n=500p=0.9990.999^{500}\approx 0.61n\to\inftyp<1P_{\text{trust}}\to0$ — flaky tests compound to worthlessness. Why does smoke run first in a pipeline? ::: To fail-fast and avoid wasting minutes on the full suite.