Published by Patrick Mutisya · 14 days ago
Effective testing requires not only a clear test plan but also carefully selected test data that
reveals faults while keeping the effort reasonable. The following notes describe the main techniques
for choosing test data and illustrate how they can be applied in a systematic test plan.
Divide the input domain into classes (partitions) that are expected to behave similarly.
One representative value from each class is sufficient to test that class.
Errors often occur at the edges of partitions. For each numeric range, test the minimum,
just‑above minimum, maximum, just‑below maximum and a typical interior value.
When output depends on several conditions, a decision table lists all possible combinations.
Each column becomes a test case.
For programs that change state (e.g., UI workflows, protocol handlers), identify states,
events, and transitions. Test each transition, especially those that lead to error states.
Based on experience, anticipate typical programmer mistakes (off‑by‑one, null pointer,
incorrect loop limits) and create test data that might trigger them.
The program takes a numeric mark (0–100) and returns a grade:
\$\$\text{Grade} =
\begin{cases}
\text{A} & \text{if } 80 \leq m \leq 100\\
\text{B} & \text{if } 70 \leq m < 80\\
\text{C} & \text{if } 60 \leq m < 70\\
\text{D} & \text{if } 50 \leq m < 60\\
\text{F} & \text{if } 0 \leq m < 50\\
\text{Invalid} & \text{otherwise}
\end{cases}
\$\$
| Partition | Representative Test Data | Reason |
|---|---|---|
| Valid – A grade (80‑100) | 80, 85, 100 | Boundary (80,100) and interior value (85) |
| Valid – B grade (70‑79) | 70, 75, 79 | Boundary (70,79) and interior value (75) |
| Valid – C grade (60‑69) | 60, 65, 69 | Boundary (60,69) and interior value (65) |
| Valid – D grade (50‑59) | 50, 55, 59 | Boundary (50,59) and interior value (55) |
| Valid – F grade (0‑49) | 0, 25, 49 | Boundary (0,49) and interior value (25) |
| Invalid – below range | -1, -10 | Error‑guessing for negative input |
| Invalid – above range | 101, 150 | Error‑guessing for out‑of‑range high values |
| Invalid – non‑numeric | "A", null | Type‑checking error guess |
If the program also checks for “late submission” (boolean flag) and applies a penalty, a decision
table can be built:
| Condition | Mark in range | Late submission? | Resulting Grade |
|---|---|---|---|
| Case 1 | ≥80 | No | A |
| Case 2 | ≥80 | Yes | B (penalty) |
| Case 3 | 50‑79 | No | Corresponding grade |
| Case 4 | 50‑79 | Yes | One grade lower |
| Case 5 | <50 | Any | F (no further penalty) |
The following table shows how selected test data are recorded in a test plan.
| Test ID | Purpose | Input Data | Expected Output | Pass/Fail | Comments |
|---|---|---|---|---|---|
| T01 | Verify lower boundary of A grade | Mark = 80 | Grade = A | ||
| T02 | Verify upper boundary of F grade | Mark = 49 | Grade = F | ||
| T03 | Check handling of negative input | Mark = -5 | Output = “Invalid” | ||
| T04 | Late submission penalty for B grade | Mark = 75, Late = true | Grade = C | ||
| T05 | Non‑numeric input handling | Mark = “A” | Output = “Invalid” |