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.

6 of 6 still to sort.

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?

Testing · What a test plan is for

Is testing just trying to break it?

Priya has written the 18-to-65 age check. She's about to test it and says: "Testing is about trying to break it, so I'll only use data that should make it fail."

Which is closest to what you think right now?
How sure are you?

Testing · Both sides of the edge

Find the wrong prediction

Sam is testing a program that should accept ages between 18 and 65, with 18 and 65 both valid. Here are Sam's boundary tests. Which line predicts the wrong result?

Sam's boundary tests — which line goes wrong?

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.

1ID Description Data Expected
2T1 normal: a typical age 45 accepted
3T2 boundary: lowest valid age 18 accepted
4T3 boundary: highest valid age 65 accepted
5T4 erroneous: age as a word "twenty" rejected
Test
Actual output
How it was fixed
Press Start to run the first line.
·

Ready when you are — step through one line at a time.

Your turn · Write it

Describe boundary data

A program accepts an age between 18 and 65. Describe what is meant by boundary test data, and give one normal value and one boundary value for this program. [3 marks]

0 words · your answer stays on this page and is not sent anywhere.

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

1Thorough testing uses a range of test data: normal, boundary and erroneous (invalid).
2Normal data is valid and should be accepted; erroneous data should be refused, because accepting it would cause an error.
3Boundary data is on the edge of being valid: values on or just within the boundary should be accepted, values slightly outside rejected.
4For an age check of 18 to 65, 45 is normal data and 18 is boundary data.
5A good test plan has clear tests with predicted outcomes; the test table records ID, description, test data and expected result, then actual output and any fix.

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?
Normal, boundary and erroneous (invalid) data.
What is normal test data?
Data that is valid and should be accepted by the program.
What is erroneous test data?
Data the program should not accept, because accepting it would cause an error.
What is boundary test data?
Values that are on the edge of being valid.
A program accepts ages between 18 and 65. Why is 45 normal data?
It's a value between 18 and 65, so it's valid and should be accepted.
A program accepts ages between 18 and 65. Why is 18 boundary data?
It's right at the edge of the valid range.
What should happen to a value just on, or just within, the boundary?
Accept it. On the edge, or just inside it, still counts as valid.
What should happen to a value slightly outside the boundary?
Reject it. Slightly outside the edge means invalid, however close it is.
Why isn't a test plan of only 'break it' data good enough?
It never checks that valid data is accepted. A test plan needs a range: normal, boundary and erroneous.
What does every test in a good test plan need?
To be clear, with a predicted outcome.
Which four things does a test table set out for each test before it runs?
A unique identifier, a description, the test data and the expected result.
Which test table entries are completed as the testing is done?
The actual output, and how it was fixed if the test was unsuccessful.

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 posted

More OCR GCSE Computer Science topics

See the full OCR Computer Science curriculum →

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.