Unit 9 — Software Testing¶
Learning objectives¶
- Design tests at unit, integration, system, and acceptance levels.
- Apply equivalence partitioning, boundary analysis, and negative testing.
- Use test doubles appropriately and interpret coverage critically.
Testing is information production¶
A test is valuable when it can reveal a meaningful fault or reduce uncertainty about important behavior.
Test pyramid as a heuristic¶
flowchart TB
E2E[End-to-end tests: few, high realism]
INT[Integration/service tests: some]
UNIT[Unit tests: many, fast, focused]
E2E --> INT --> UNIT
The exact shape varies by system. The principle is to obtain useful feedback at reasonable cost and speed.
Boundary example¶
For an input allowed from 1 through 100, useful values include 0, 1, 2, 99, 100, and 101—not only a typical value such as 50.
Coverage¶
Coverage can reveal unexecuted code, but 100% statement coverage can still miss incorrect assertions, missing requirements, interaction faults, and security problems.
Tip
A strong test suite should fail for the right reason when the relevant behavior is intentionally broken.