Unit → Integration → System → Acceptance
| Black box testing | White box testing |
|---|---|
| Tests behaviour without seeing the code | Tests internal code, paths and logic |
| Done by testers | Done by developers |
| Equivalence partitioning, boundary value analysis | Statement, branch and path coverage |
- Regression testing — re-test after a change to make sure nothing old broke.
- Smoke testing — quick check that the main features work in a new build.
- Alpha testing (inside the company) vs Beta testing (real users).
- Verification = are we building the product right? Validation = are we building the right product?
// Function under test
int maxOf(int a, int b) { return a > b ? a : b; }
// Unit tests (boundary and normal cases)
assert(maxOf(3, 5) == 5);
assert(maxOf(5, 3) == 5);
assert(maxOf(-1, -1) == -1);
assert(maxOf(INT_MAX, 0) == INT_MAX);
Q & A
-
What is boundary value analysis?Testing at the edges of valid ranges. For an age field 18–60, test 17, 18, 19, 59, 60 and 61, because bugs often hide at boundaries.
-
Error vs defect vs failure?Error: a human mistake. Defect (bug): the fault in the code caused by it. Failure: the wrong behaviour seen when the defective code runs.