Testing is the process of running a program with carefully chosen data to check that it behaves correctly. A well-tested program should handle normal data, boundary data, and erroneous data correctly. The goal of testing is to find and fix errors before the program is deployed.
| Error Type | When it occurs | Example |
|---|---|---|
| Syntax error | During translation — breaks language rules | Writing ENDWHILE (no space) instead of END WHILE (correct Edexcel form); missing END IF |
| Logic error | During execution — program runs but gives wrong result | Using > instead of ≥ in a condition |
| Runtime error | During execution — program crashes | Division by zero; array index out of bounds |
Good test data covers three categories:
| Type | Description | Example (age input, valid range 1–120) |
|---|---|---|
| Normal (valid) | Typical data the program should accept and process correctly | 25, 40, 67 |
| Boundary (extreme) | Values at the edge of what is acceptable — tests the boundary condition | 1, 120 (just inside); 0, 121 (just outside) |
| Erroneous (invalid) | Data the program should reject — wrong type or out of range | "hello", -5, 200, 3.14 |
A trace table (also called a dry run) is used to track variable values through an algorithm step by step. It helps identify logic errors by showing exactly what the program does at each stage. Create a column for each variable and update values row by row as you execute the algorithm.
Answer each question then submit for marking against the Edexcel mark scheme.
| Term | Definition |
|---|---|
| Syntax error | An error caused by breaking the rules of the programming language; detected at translation |
| Logic error | An error where the program runs but produces incorrect output due to a flaw in the algorithm |
| Runtime error | An error that causes the program to crash during execution (e.g. division by zero) |
| Normal test data | Typical, valid data the program should accept and process correctly |
| Boundary test data | Values at the extreme edge of the valid range; tests the boundary condition |
| Erroneous test data | Invalid data the program should detect and reject (wrong type or out of range) |
| Trace table | A table used to manually track variable values as an algorithm is dry-run step by step |
Test your knowledge of testing and debugging.