Iterative & final testing · Test data types · Trace tables — making sure programs work correctly
calculateTotal() function. Before writing the rest of the program, they test it with several inputs and confirm the output is correct. Then they move on to writing the next function.| Feature | Iterative | Final |
|---|---|---|
| When? | During development | End of development |
| What's tested? | Individual modules | Complete program |
| Who tests? | Developer | Developer / client / user |
| Type | Definition | Expected result |
|---|---|---|
| Normal | Valid data the program should accept and process correctly | Accepted, correct output |
| Boundary | Data at the extreme limits of what is and isn't accepted | Varies (in/out of range) |
| Erroneous | Invalid data the program should reject or handle gracefully | Rejected, error message |
| Type | Examples |
|---|---|
| Normal | 25, 50, 73 — well within range |
| Boundary | −1, 0, 1, 99, 100, 101 — at the edges |
| Erroneous | −50, 200, "abc", "" — clearly invalid |
| Program | Normal test data |
|---|---|
| Score 0-100 | 45, 72, 88 |
| Age 0-120 | 16, 35, 62 |
| Username (3-20 chars) | "alice", "johndoe99" |
| Login (user: "admin") | "admin" + "pass1" |
| Test # | Input | Type | Expected output |
|---|---|---|---|
| 1 | 50 | Normal | Grade C |
| 2 | 85 | Normal | Grade A |
| 3 | 30 | Normal | Grade F |
score < 100 instead of score <= 100 would reject 100 — a valid score. That bug only shows up when you test with exactly 100. Testing 50 would pass and miss it entirely.| Input | Description | Expected |
|---|---|---|
| −1 | Just below lower boundary | Rejected |
| 0 | Lower boundary | Accepted |
| 1 | Just above lower boundary | Accepted |
| 99 | Just below upper boundary | Accepted |
| 100 | Upper boundary | Accepted |
| 101 | Just above upper boundary | Rejected |
| Program | Erroneous examples |
|---|---|
| Score 0-100 | −50, 150, "abc", "" (empty) |
| Age 0-120 | −5, 200, "twenty", "" |
| Username (3-20 chars) | "ab" (too short), 30-char string (too long) |
| Login | Wrong username, wrong password, both wrong |
| Input | Why erroneous | Expected |
|---|---|---|
| −50 | Far below range | Error message, re-prompt |
| 200 | Far above range | Error message, re-prompt |
| "abc" | Wrong data type | Error message, re-prompt |
| "" | Empty input | Error message, re-prompt |
| x | total | output |
|---|---|---|
| 1 | — | — |
| — | 0 | — |
| — | 1 | — |
| 2 | — | — |
| — | 3 | — |
| 3 | — | — |
| — | 6 | — |
| 4 | — | — |
| — | — | 6 |
x becomes 4, the WHILE condition (x ≤ 3) is false, so the loop ends. x = 4 is recorded but the loop body doesn't run again — hence total stays at 6, and print(total) outputs 6.| total | i | avg | output |
|---|---|---|---|
| 0 | — | — | — |
| — | 1 | — | — |
| 1 | — | — | — |
| — | 2 | — | — |
| 3 | — | — | — |
| — | 3 | — | — |
| 6 | — | — | — |
| — | 4 | — | — |
| 10 | — | — | — |
| — | — | 2.5 | — |
| — | — | — | 2.5 |
a ← 2
b ← 0
FOR i = 1 TO 3
b ← b + a
a ← a + 1
NEXT i
print(b)
| i | a | b | output |
|---|---|---|---|
| — | 2 | — | — |
| — | — | 0 | — |
| ? | ? | ? | — |
| ? | ? | ? | — |
| ? | ? | ? | — |
| — | — | — | ? |
| i | a | b | output |
|---|---|---|---|
| — | 2 | — | — |
| — | — | 0 | — |
| 1 | — | 2 | — |
| — | 3 | — | — |
| 2 | — | 5 | — |
| — | 4 | — | — |
| 3 | — | 9 | — |
| — | 5 | — | — |
| — | — | — | 9 |
| Type | For range 1–10 | Expected |
|---|---|---|
| Normal | 5 | Accepted ✓ |
| Boundary | 0, 1, 10, 11 | 1,10: ✓ · 0,11: ✗ |
| Erroneous | −50, 99, "abc" | Rejected ✗ |
| Type | When | What |
|---|---|---|
| Iterative | During development | Each module/subroutine |
| Final | End of development | Complete program |
Get the full resource pack at CSZone.co.uk