Software Testing
What to know
Testing spans levels (unit, integration, system, acceptance), types (functional, performance, security, usability, regression), and techniques. Black-box techniques include equivalence partitioning, boundary value analysis, decision tables, and state transition testing. White-box techniques include statement, branch/decision, condition, and path coverage; path coverage is generally strongest but infeasible for loops. Coverage measures what code tests execute, not whether tests are correct.
Know verification vs validation ("built right" vs "right thing built"), fault/error/failure distinctions, and test doubles: stubs (canned responses), mocks (verify interactions), fakes (working lightweight implementations). Regression testing guards against reintroduced defects. Exploratory testing is simultaneous learning, design, and execution.
Traps in questions
- Coverage ≠ correctness: 100% branch coverage does not mean zero defects; tests can assert nothing.
- Boundary values: for range 1–100, test 0, 1, 100, 101 - not just 50.
- Mock vs stub: mocks verify behavior/interactions; stubs supply fixed data. Questions swap them.
- Verification/validation swap: reviews and unit tests are verification; user acceptance is validation.
- Defect found late costs more: the cost curve rises through the lifecycle.
Rule of thumb
Combine techniques: partition inputs, then test each partition's boundaries; add white-box coverage to find untested branches. Neither alone is sufficient.
Worked example
Discount applies for ages 18–65. Equivalence classes: <18, 18–65, >65. Boundary tests: 17, 18, 65, 66. Add a decision-table case for membership status to catch combined-condition bugs.