GCSE · Computer Science · AQA · Spec 8525

Test data: boundary

A program can pass test after test and still turn away someone it should let in, and one wrong character is all it takes.

Computer Science · Testing

Catch the bug at the edge

A youth club's sign-up program should accept ages 11 to 16, and both 11 and 16 are allowed. The programmer typed one character wrong. Step through the test plan and find where it shows.

Before you press Next: every expected result is already written. Which of the five tests do you think will fail?

1 age = INPUT()
2 IF age >= 11 AND age < 16 THEN
3 OUTPUT "Accepted"
4 ELSE
5 OUTPUT "Rejected"
6 ENDIF
testageexpectedactualresult
typical13AcceptedAcceptedpass

Output

 

Step 1: 13 is a typical age, well inside the range. We wrote Accepted in the expected column before running anything. 13 >= 11 is true and 13 < 16 is true, so the program accepts it. A pass, and the bug is still hiding.

1 / 5

Press Next to run one test at a time. Each expected result was decided before its test ran.

Step 1 of 5: 13 is a typical age, well inside the range. We wrote Accepted in the expected column before running anything. 13 >= 11 is true and 13 < 16 is true, so the program accepts it. A pass, and the bug is still hiding..

Watch out: Passing tests don't prove a program is right. They only show it's right for the values you tried.

Computer Science · Testing

Draw the range, then find its edges

The club accepts ages from 11 to 16, and both 11 and 16 are allowed. Set the two ends of the accepted range, and decide whether each end is included.

Computer Science · Testing

Your turn: plan the boundary tests

A cinema's booking system lets you buy from 1 to 8 tickets in one order, and both 1 and 8 are allowed. Choose the boundary test data and the expected result for each test.

  1. The rule accepts whole numbers from 1 to 8. The limits are 1 and 8, and both are allowed.Always start here: find the two limits and ask whether each one is included.
  2. missing step
Which line is step 2?

Computer Science · Testing

Normal, boundary or erroneous?

Pick a test value, then choose the kind of test data it is.

Still to sort

Normal (0)

Typical values well inside the range. Expected: Accepted.

Boundary (0)

The limits (expected Accepted) and the values just beyond them (expected Rejected).

Where the line is: A boundary value is on an edge or one step past it. A value far outside, or data of the wrong type, is erroneous.

Erroneous (0)

Data the program should reject: far outside the range, or the wrong type of data altogether.

8 of 8 still to sort.

The sign-up check again: whole-number ages from 11 to 16, both included. In this lesson, the values just outside the limits count as boundary data, expected to be rejected. Some books file them under erroneous data instead. Whatever the label, you still test them and expect them to be rejected.

Computer Science · Testing

What does boundary testing really mean?

A friend is writing tests for a range check that should accept whole numbers from 1 to 100, with 1 and 100 both allowed.

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

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Why bugs hide at the edges of a range, and the four tests that find them

What you need to know

  • Boundary data tests a range at its edges: the lowest and highest values that should be accepted, and the values just outside them that should be rejected.
  • For whole numbers from 11 to 16 inclusive, the boundary tests are 11 and 16 (expected Accepted) and 10 and 17 (expected Rejected).
  • Write each test's expected result before you run it. A test finds a bug when the actual result disagrees with the expected one.
  • Errors are most likely at the limits, because a wrong comparison, such as < where <= was needed, only changes the result right at the edge.
  • Resources label the values just outside the limits differently. In this lesson they are boundary data, expected to be rejected.

The big picture

Boundary data tests a range check at its edges: the lowest and highest values that should be accepted, and the values just outside them that should be rejected. You decide the expected result for each test before you run it. Errors are most likely at the limits because that's where a single wrong comparison, such as < instead of <=, changes the outcome, and a typical value in the middle never touches it.

Key points

1Start by finding the two limits, and check whether each one is included.
2For a range with two limits, that's four boundary tests: each limit (Accepted) and one step beyond each limit (Rejected).
3A typical value can pass while an edge is broken, so passing tests don't prove a program is correct.
4An off-by-one mistake, like < for <=, is exactly the kind of bug boundary tests exist to catch.

Worked example

Problem

A greenhouse controller accepts whole-degree temperatures from −10 °C to 40 °C, and both −10 and 40 are allowed. Write the boundary test data, with the expected result for each test.

⚠ Watch out

Treating 'boundary' as 'wrong'. In an inclusive range the limits themselves are allowed, so their expected result is Accepted. Only the values just beyond them should be rejected.

🧠

Memory hook

On the edge, and one step over it, at both ends.

✓

Check yourself

A booking form accepts from 2 to 12 guests, and both 2 and 12 are allowed. Without looking back, write the four boundary test values and the expected result for each.

Flashcards

(11)
What is boundary test data?
Values at the edges of a range: each limit, and the value just beyond each limit.
In an inclusive range, what is the expected result when you test a limit?
Accepted. The limits are inside the range.
What is the expected result for the value just outside a limit?
Rejected.
Why are errors most likely at the limits of a range?
A wrong comparison, like < instead of <=, changes the result only at the edge. Values in the middle behave the same either way.
When should you write down a test's expected result?
Before you run the test, so you can judge whether the actual result is right.
How does a test show that there's a bug?
The actual result is different from the expected result.
Why can't the value 13 prove that a range check for 11 to 16 works?
It's far from both edges, so it gives the same result whether the check uses < or <=.
Whole numbers from −5 to 5 are allowed. What value is just below the lower limit?
−6. Below a negative limit means more negative.
What is normal test data?
Typical values well inside the range, expected to be accepted.
What is erroneous test data?
Data the program should reject: far outside the range, or the wrong type of data.
Some books call 17 erroneous data for the range 11 to 16. Does it change the test?
No. Whatever the label, you test 17 and expect it to be rejected.

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 AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)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 30 September 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.