Testing and Test Data
Master Testing and Test Data for GCSE Computer Science with this free worksheet and full mark scheme — Foundation and Higher exam-style questions with worked answers for AQA GCSE Computer Science (8525). Programs are tested with normal, boundary and erroneous data to check they work correctly.
Free downloads
These worksheets and mark schemes are original, written for Virtus Academy and checked against the current AQA specification. Every worksheet comes with a full mark scheme.
Topic overview
Testing checks that a program works correctly, and choosing the right test data is what makes testing effective.
Three types of test data must be known. Normal data is typical valid input the program should accept. Boundary data sits exactly on the edge of what is acceptable, testing the limits themselves. Erroneous data is invalid input the program should reject.
Boundary data catches the most bugs, because off-by-one errors cluster at the limits. For an age check accepting 0 to 120, the boundary values are 0 and 120 which should be accepted, and −1 and 121 which should be rejected. Testing only normal data such as 35 would never reveal a condition using < instead of ≤.
Revision notes
The three types of test data
Normal: typical valid input the program should accept, such as an age of 35.
Boundary: values exactly at the limits, such as 0 and 120 for an age range. Erroneous: invalid input the program should reject, such as −5 or the text 'hello'.
Why boundary data matters most
Off-by-one errors cluster at the limits of a range.
A condition using < where it should use ≤ rejects the boundary value but accepts everything else. Only testing exactly at the boundary reveals it — normal data would pass regardless.
Recording tests
A test plan records the test data, the reason for the test, the expected result and the actual result.
Comparing expected with actual is how a failure is identified. Without a stated expected result, there is nothing to compare against.
Key points
- Testing checks a program works correctly.
- Normal data is typical valid input.
- Boundary data sits at the limits.
- Erroneous data should be rejected.
- Boundary data catches off-by-one errors.
- A test plan records expected and actual results.
Worked examples
Example 1
A program accepts ages from 0 to 120. Give one boundary value that should be accepted and one that should be rejected. [2 marks]
Working
Example 2
Explain why boundary test data is particularly useful. [2 marks]
Working
Example 3
State three things a test plan should record. [3 marks]
Working
Common mistakes
Testing only with normal data.
Boundary and erroneous data catch far more bugs.
Confusing boundary with erroneous data.
Boundary sits at the limit; erroneous is clearly invalid.
Not recording an expected result.
Without it there is nothing to compare the actual result against.
Giving only one boundary value.
Test both sides of the limit.
Exam tips
- Test both sides of every boundary.
- Learn all three data types with examples.
- Record expected results before running tests.
- Explain boundary testing through off-by-one errors.
Key terms
- Normal data
- Typical valid input a program should accept.
- Boundary data
- Input exactly at the limits of a valid range.
- Erroneous data
- Invalid input a program should reject.
- Test plan
- A record of test data, expected and actual results.
Related topics
Written and reviewed against the current AQA specification. Spotted an error? Let us know.