Exam Practice
Cheat sheet, flashcards and concept quiz covering Lectures 1–9 of Software Testing, from verification & validation to MC/DC, black box test design, test completion criteria, unit & integration testing and TDD.
Reference text: CSC312 lecture notes (KMUTT SIT); G. Myers, The Art of Software Testing; R. Patton, Software Testing; ISTQB Foundation syllabus
Lecture 1 · Foundations
Test caseInput and expected result, decided before running (usually from the SRS).
VerificationProduct vs. specification, "built the thing right".
ValidationProduct vs. user's real needs / intended use, "built the right thing".
STLCRequirement analysis → planning → test design → environment → execution → closure (loops).
Where bugs are bornRequirements 55%, design 25%, code 15%, other 5%, so more than 80% before code.
Economics of testing×10 per stage, about 1 → 10 → 100 → 1,000+ dollars (spec → design → coding → released).
ReworkAbout 44% of total development cost.
Load vs. stressLoad = lots of work; stress = restricted resources.
Lecture 1 · Seven principles & five bug definitions
| # | Seven ISTQB principles | Five bug definitions (Patton) |
|---|---|---|
| 1 | Testing shows presence of defects, never absence | Doesn't do what the spec says it should |
| 2 | Exhaustive testing is impossible, so risk can be reduced, not eliminated | Does what the spec says it shouldn't |
| 3 | Early testing (×10 cost rule) | Does what the spec doesn't mention (extras = bugs) |
| 4 | Defects cluster (Murphy, 80/20) | Doesn't do what the spec doesn't mention but should, so only validation catches it |
| 5 | Pesticide paradox (renew the tests) | Hard to use, slow, users unhappy (subjective, hardest) |
| 6 | Testing is context-dependent | |
| 7 | Absence-of-errors fallacy (no bugs seen ≠ no bugs; ISTQB reading = unusable system) |
Lecture 2 · Can't test everything
Exhaustive countMultiply independent domains, tests for one addition (×4 if both numbers carry a sign).
TimeTests × time per test; automation changes time, not count.
Risk / impactHow often × how much it costs, giving high / medium / low; test high first.
TestabilityControllability + observability.
Testing vs. debuggingTesting shows a bug exists (testers). Debugging locates (90–95%) + fixes (5–10%) (developers).
Unfixed bugsCost/time, low risk, a fix may create new bugs.
Debugging strategiesBrute force, backtracking, induction (clues → theory), deduction (all causes → one), by testing.
Unattainable perfectionThe goal of showing every bug, not perfect software. The curve flattens after the knee (~50–70%).
Reviews (casual → strict)Walkthrough → ad hoc → technical review → formal inspection.
ChecklistComplete & repeatable for its items; misses anything not listed, kills creativity.
Lecture 3 · The coverage ladder for foo(a, b, x)
| Coverage | Asks | Example tests (a, b, x) | Can escape |
|---|---|---|---|
| Statement | Every statement once | (2,0,3) | Bugs on a false branch |
| Decision (branch) | Each decision T and F | (3,0,3), (2,1,1) | Wrong condition inside a decision |
| Condition | Each condition T and F | (1,1,2), (2,0,3) | A whole branch (decision 2 never false) |
| Decision/condition | Both of the above | (2,0,4), (1,1,1) | Conditions masked by short circuit |
| Multiple condition | Every combination | (2,0,4), (2,1,1), (1,0,2), (1,1,1) | Nothing important, but tests |
| MC/DC | Each condition independently changes the decision | (1,0,0), (2,1,0), (3,0,6) | Best balance, about n + 1 per decision |
Lectures 3–4 · MC/DC method
RuleEach condition shown to independently affect the decision outcome.
SizeMinimum n + 1 tests, never fewer.
Step 1 Truth tableColumns start with F; last variable changes every row; number rows 1, 2, 3…
Step 2–3 Extended columnsA varies, others fixed. If the result changes, write the partner row number.
Step 4 Mark pairsColours or shapes (circle, triangle, star).
Step 5 ChooseWhole pairs only; start with the column with the fewest pairs; follow the colour path; overlap rows.
Check a given set1) a full pair in every column? 2) exactly n + 1 rows? Pairs first, size second.
TranslateWrite the chosen rows as T/F values with the expected output.
Lectures 3–4 · MC/DC results to know
| Expression | Pairs | Minimum set(s) |
|---|---|---|
| A && B | A {2,4}; B {3,4} | {2,3,4} = FT, TF, TT |
| A || B | A {1,3}; B {1,2} | {1,2,3} = FF, FT, TF |
| A xor B | A {1,3},{2,4}; B {1,2},{3,4} | Any 3 rows (4 answers) |
| A && (B || C) | A {2,6},{3,7},{4,8}; B {5,7}; C {5,6} | {2,5,6,7} or {3,5,6,7} |
| (A || B) && C | A {2,6}; B {2,4}; C {3,4},{5,6},{7,8} | {2,3,4,6} or {2,4,5,6} |
| (A && !B) || (C xor D) | A {1,9},{4,12}; B {9,13},{12,16}; C, D six each | e.g. {1,9,13,14,15} (16 answers) |
Lectures 5–6 · Black box design
EP guidelinesRange 1 valid + 2 invalid · specific value 1 + 2 · set 1 + 1 · Boolean 1 + 1.
EP coversInputs and outputs, plus invalid types (real, letter) and unspecified outputs (E, A+, null).
BVAOn, just below, just above each boundary. 0–75 → −1, 0, 1, 74, 75, 76.
Combining partitionsValid partitions freely; invalid inputs one per test (no masking).
Triangle boundarySorted a ≤ b ≤ c, so a + b = c on (flat line), a + b = c + 1 just inside, a + b = c − 1 outside. Test all permutations.
Decision tableTransposed truth table, rules; X = don't care; rules complete & consistent.
WorkflowSpec → (simple code) → cause-effect graph → decision table → one test per rule.
De Morgan(A·B)' = A' + B' · (A + B)' = A'·B'.
ConstraintsE at most one · O exactly one · I at least one · R requires · M mask.
elseNOT of everything before, so dateFashion maybe = (1 + 3)'·(2 + 4)'.
Decision treeMost decisive condition at the root; one test per root-to-leaf path; BVA picks the values.
Third-party / IV&V weaknessCost.
Lecture 7 · Test completion criteria
Category 1Principles/coverage (e.g. 100% MC/DC). Good for unit/module; usually not for higher-order tests.
Category 2Statistics/past experience. Needs prior data.
Category 3Bug-finding trend of this project. Stop at the greatest drop in slope.
Total errorsStatements × errors per 100 / 100.
Split (assume if not given)CLD 40%, design 60%.
Goals98% of CLD, 95% of design.
Level targetCLD rate × total CLD + design rate × total design.
Detection ratesModule 65% / 0% · function 30% / 60% · system 3% / 35%.
10,000 stmts, 5/100500 → 200 / 300 → goals 196 / 285 → 130 / 240 / 111 (sum 481).
Slope; difference ; largest negative = stop.
Lecture 8 · Unit, integration & TDD
| Topic | Key facts |
|---|---|
| Failure vs. error | Failure = wrong answer (bug found). Error = crash not caused by the test case (e.g. NullPointerException). |
| Unit-test rules | Independent, any order, no reliance on side effects; fixtures give a fresh start. |
| Stub / driver | Stub = fake module below (is called). Driver = fake caller above (calls). |
| Top-down | Stubs. + early executable, interface flaws early. − poorer control/observation, stubs costly. |
| Bottom-up | Drivers. + better control/observation. − executable very late, many drivers costly. |
| Why integrate | Precision growth (0.9³ = 0.729), interface errors, timing/race conditions. |
| TDD cycle | start → GREEN; write failing test → RED; fix code [0 fail] → GREEN; refactor [ok] → GREEN; refactor [broken] → RED; no more tests → end. |
| Ways to green | Fake it · obvious implementation · triangulation. |
| JUnit 4 | @BeforeClass, @Before, @Test, @After, @AfterClass; @Test(expected = X.class), @Test(timeout = ms). |
| Assertions | assertEquals (values) · assertSame (same object) · assertTrue/False · assertNull/NotNull · fail(). |
| Acceptance | Unit tests never replace it; Selenium (browser), FIT (customer tables). |