Testing programs: test plans and test data
A program is only finished when you have shown it works. A test plan lists what you will test, the data you will use and what should happen, before you run anything.
Three kinds of test data
Normal data: typical valid values that should be accepted, such as 55.
Boundary data: values at the very edge of the valid range, such as 0 and 100. Programs often fail here, for example by using < instead of <=.
Erroneous data: values that should be rejected, such as "abc", 150 or -5.
A test plan
def grade(mark):
if mark >= 70:
return "Distinction"
elif mark >= 40:
return "Pass"
else:
return "Fail"
| Test | Purpose | Data | Expected result |
|---|---|---|---|
| 1 | Normal pass mark | 55 | Pass |
| 2 | Boundary: lowest pass | 40 | Pass |
| 3 | Boundary: highest fail | 39 | Fail |
| 4 | Boundary: lowest distinction | 70 | Distinction |
| 5 | Erroneous: not a number | "abc" | Rejected with a message |
Testing validation
mark = input("Mark: ")
while not mark.isdigit() or int(mark) > 100:
mark = input("Whole number 0 to 100: ")
mark = int(mark)
print("Accepted", mark)
With the inputs abc, 150, -5 and 72, it asks again three times, then prints: Accepted 72
"-5" is rejected because the minus sign is not a digit, so isdigit() is False.
Fitness for purpose and efficiency
Efficient: it does not repeat work. For example, it stops a search once the item is found, uses a loop instead of copied lines, and does a calculation once after a loop rather than every time round it.
When asked to evaluate a program, say what works, what does not, and suggest a specific improvement.
A program accepts a number of tickets from 1 to 6. Give one example each of normal, boundary and erroneous test data.
- Normal: a typical valid value, such as 3.
- Boundary: the edge of the range, 1 or 6.
- Erroneous: a value that must be rejected, such as 7, 0 or "two".
Answer: Normal 3, boundary 6, erroneous 7
Test with normal, boundary and erroneous data. A test plan gives the purpose, data and expected result for each test, then records the actual result. Evaluate a program on correctness, robustness and efficiency.
- Erroneous data
- Invalid test data that should be rejected.
- Normal data
- Typical valid test data that should be accepted.
- Boundary data
- Valid test data at the very edge of the allowed range.
All GCSE and International GCSE Computer Science key terms and definitions →
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
A program accepts years from 2000 to 2025. Which is boundary test data?
- 2012
- 1990
- 2000
- "twenty"
Show the answer
Answer: 2000
2000 is valid and at the edge.
A program accepts years from 2000 to 2025. Which is erroneous test data?
- 2000
- 2025
- 2030
- 2012
Show the answer
Answer: 2030
2030 is outside the range.
Check you have got it
Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
- Pearson Edexcel GCSE Computer Science (1CP2) specification, topic 1.2.7, 6.1.6
- Pearson Edexcel International GCSE Computer Science (4CP0) specification, topic 1.1.9, 2.1.4, 2.1.7
Checked by the GCSE-ready editorial team, 17 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.
What do exam command words like explain and evaluate mean? →