Chapter 4 • 390 minutes
Test Analysis and Design
Black-box, white-box and experience-based test techniques; how to derive test conditions and test cases; collaboration-based test approaches (ATDD, BDD, examples).
4.1 Categories of Test Techniques
- Black-box (specification-based) — derived from specifications without considering internal structure. Examples: equivalence partitioning, boundary value analysis, decision tables, state transition testing.
- White-box (structure-based) — derived from internal structure. Examples: statement coverage, branch coverage.
- Experience-based — leverage tester's experience, intuition and skills. Examples: error guessing, exploratory testing, checklist-based testing.
4.2 Black-Box Test Techniques
Equivalence Partitioning (EP)
Divide the input domain into partitions where the system behaves the same way; one value per partition is selected. Cover all valid and invalid partitions.
Example: Age field 18–65. Partitions: <18 (invalid), 18–65 (valid), >65 (invalid).
Boundary Value Analysis (BVA)
Defects often cluster at boundaries. Use the boundary values and the values immediately adjacent.
2-value BVA: boundary and just-outside (e.g. 17, 18; 65, 66). 3-value BVA: boundary and value on each side (e.g. 17, 18, 19; 64, 65, 66).
Decision Table Testing
Models combinations of conditions and resulting actions. Each column is a test case. Excellent for business rules with combinations of inputs.
State Transition Testing
Models the system as states and transitions. Cover all states, all valid transitions (0-switch), and optionally pairs of transitions (1-switch). Also test invalid transitions.
4.3 White-Box Test Techniques
Statement Coverage
Percentage of executable statements exercised by tests. 100% statement coverage means every statement has been executed at least once — but it does not guarantee every decision outcome has been tested.
Branch Coverage
Percentage of branches (decision outcomes) exercised. 100% branch coverage subsumes statement coverage and ensures both true and false outcomes of every decision are taken.
Value of White-Box Testing
- Measures the thoroughness of testing in terms of code structure.
- Reveals code that is never executed (dead code).
- Helps verify that requirements have been implemented.
4.4 Experience-Based Test Techniques
Error Guessing
Tester uses experience to guess plausible defects (e.g. division by zero, empty string, very long input).
Exploratory Testing
Simultaneous learning, test design and test execution. Often time-boxed in sessions with a charter. Useful when specs are missing or poor, for early feedback, or as a complement to scripted tests.
Checklist-Based Testing
Test cases / heuristics are derived from a checklist (e.g. usability heuristics).
4.5 Collaboration-Based Test Approaches
Collaborative User Story Writing
The "Three Amigos" (business, dev, test) collaborate to ensure user stories are clear, testable and include good acceptance criteria. Use the INVEST heuristic (Independent, Negotiable, Valuable, Estimable, Small, Testable).
Acceptance Criteria
Conditions that a user story must satisfy to be accepted. Common formats: scenario-oriented (Given/When/Then) and rule-oriented (bulleted rules).
ATDD (Acceptance Test Driven Development)
Acceptance tests are derived collaboratively during requirement analysis, before code is written. They define "done" and double as automated regression tests.