GCSE · Computer Science · OCR · Spec J277
Boundary test data
An 18-to-65 age check accepts 45. Job done? Not yet. The value that really tests the rule is 18, sitting right on the edge.
Computer Science · Testing
Sort the test data
Pick a value, then pick the kind of test data it is. Commit first, then read why.
Still to sort
Normal (0)
Valid data the program should accept.
Boundary (0)
Values on the edge of being valid.
Where the line is: Boundary values here are still valid, just like normal ones. The difference is position: a boundary value sits right on the edge of the range.
Erroneous (invalid) (0)
Data the program should not accept, because accepting it would cause an error.
One rule: the program should accept an age between 18 and 65, with 18 and 65 both counted as valid. Which kind of test data is each value?
Computer Science · Algorithms
Trace table — dry run the code
The dark panel is the test plan, written before a single test was run. Step through to carry out each test and watch the results get filled in underneath.
Ready when you are — step through one line at a time.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Which values really tell you whether a program sticks to its own rule? Hint: not the obvious ones.
What you need to know
- To test a program thoroughly, use a range of test data: normal, boundary and erroneous.
- A test plan isn't only data that should make the program fail. It needs a range.
Have a goJay tests his 18-to-65 age checker with 7, -2 and 300. All three are rejected. "Bug-free!" he announces. What hasn't Jay found out yet?
Whether it accepts the ages it should.
Every value Jay chose should be refused, so his tests only show the program can say no. It might wrongly reject every age and his tests would never notice.
- Normal data is valid: the program should accept it.
- Erroneous (invalid) data should be refused, because accepting it would cause an error.
- Boundary data sits on the edge of being valid.
- For an age check of 18 to 65, 45 is normal: it's a value between 18 and 65.
- In that same check, 18 is boundary data: it's right at the edge of the valid range.
Have a go18 is one edge of the 18-to-65 rule. Where's the other edge?
65.
A range has two ends. It's easy to fixate on the bottom one, but 65 sits right at the top edge, so it's boundary data as well.
- Check both sides of an edge: on or just within should be accepted, slightly outside rejected.
Have a goA quiz program accepts scores from 0 to 10. Predict what should happen to 10, and to 11.
10 accepted, 11 rejected.
10 is on the edge, so it's valid. 11 is only one more, but it's slightly outside the boundary, and being close to the edge doesn't make a value valid.
- Every test in a good test plan is clear and has a predicted outcome.
- A test table lists each test's ID, description, test data and expected result. Actual output and any fix come during testing.
The big picture
To test a program thoroughly you use a range of test data: normal, boundary and erroneous. Normal data is valid and should be accepted. Erroneous data should not be accepted, because accepting it would cause an error. Boundary data sits on the edge of being valid: values on or just within the edge should be accepted, values slightly outside it rejected. A good test plan sets out clear tests with predicted outcomes, and a test table records each test's identifier, description, test data and expected result, then the actual output and any fix as testing is done.
Key points
Worked example
Problem
A cinema's booking program should accept from 1 to 8 tickets per booking, typed in as a number. Plan four tests: one normal, one boundary value on an edge, one boundary value just outside an edge, and one erroneous. Give the expected result for each.
⚠ Watch out
Calling 18 erroneous in an 18-to-65 check because it's at the very end of the range. 18 is valid: it's boundary data, and the expected result is accepted. Values only become invalid once they're slightly outside the boundary.
Memory hook
On the edge? In. One step over? Out. In an 18-to-65 check, 18 is the interesting number, not 45.
Check yourself
Cover the page. A program accepts shoe sizes from 3 to 12. Give a normal, a boundary and an erroneous value, and predict each result.
Flashcards
(12)Which three kinds of test data should a thorough test plan include?
What is normal test data?
What is erroneous test data?
What is boundary test data?
A program accepts ages between 18 and 65. Why is 45 normal data?
A program accepts ages between 18 and 65. Why is 18 boundary data?
What should happen to a value just on, or just within, the boundary?
What should happen to a value slightly outside the boundary?
Why isn't a test plan of only 'break it' data good enough?
What does every test in a good test plan need?
Which four things does a test table set out for each test before it runs?
Which test table entries are completed as the testing is done?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore OCR GCSE Computer Science topics
How this lesson was checked. This OCR GCSE Computer Science (specification J277)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 3 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.