GoalChoose normal, boundary and invalid test data, find a boundary bug with a test plan, and explain what validation checks do and do not prove.
New words
boundary data · test data on the edge of what is allowed, and just outside ittest plan · a table of tests with the expected outcome worked out by hand before the program is runvalidation · an automatic check that data is reasonable (it cannot prove it is true)field list · a table that lists each field of a database with its data type and validation rule
Explanation
A test plan lists the test data, its type, the outcome you expect and the outcome you actually get. The expected outcome is worked out by hand first, from the rule, so you do not copy what the program says. Normal data is an everyday value that should work. Boundary data sits at the limits of the allowed values and one step beyond them. Invalid data should always be rejected. Validation is the same idea built into the program: a presence check makes sure something has been typed, a range check keeps a number between two limits, a length check counts characters and a format check controls the pattern, such as DD/MM/YYYY. Validation checks that data is reasonable, not that it is true. A pupil who is 11 can type 14 and pass a range check of 9 to 15.
Normal
Boundary
Invalid
a typical value
on the edge and just outside
should be rejected
Worked examples
Test
Type of data
Test data
Expected outcome
Actual outcome
Pass/fail
1
normal
17
Gold badge
Gold badge
pass
2
normal
8
No badge
No badge
pass
3
boundary
15
Gold badge
No badge
fail
4
boundary
14
No badge
No badge
pass
5
boundary
20
Gold badge
Gold badge
pass
6
boundary
21
Invalid score
Invalid score
pass
7
invalid
35
Invalid score
Invalid score
pass
A badge program: a score out of 20 earns a gold badge from 15 upwards, and any score outside 0 to 20 is invalid. A pupil first wrote score > 15 by mistake. The plan was worked out by hand first (the Expected outcome column), then run with the wrong version. Only the boundary test 15 fails, because the normal tests 17 and 8 pass both versions.
Name typed
Age typed
Program prints
Ana
12
Saved
(nothing)
12
Name needed
Leo
16
Age not allowed
Leo
9
Saved
Leo
8
Age not allowed
Two validation checks in a registration program. The presence check makes sure the name is not empty. The range check lets only ages 9 to 15 through. Each row shows what the program prints.
Pupil name
Class year
Books read
Start date
Result
Mei
8
12
03/09/2025
accepted
Omar
10
5
15/01/2026
rejected: class year
(nothing)
7
0
01/10/2025
rejected: name
Lina
9
51
07/11/2025
rejected: books read
Tom
8
20
3/9/25
rejected: date format
Five records checked against a field list. The rules are: the pupil name is not empty, the class year is 7 to 9, the books read are 0 to 50, and the start date has the format DD/MM/YYYY. A record must pass every rule. The last record fails the format check, because 3/9/25 is not written DD/MM/YYYY. Different formats in one field also make a search miss records.
Class activity
Rule-breaker game (no computer). Write a rule on a card, such as Cinema seats are numbered 1 to 60. One player writes six test values on small papers and shuffles them: two normal, two boundary, two invalid. The other player sorts them into three piles and explains each choice, then says what the program should do for each value. Swap roles with a new rule. Finally invent a wrong version of the rule (for example 1 to 59) and show which pile of tests would catch it. If you have a computer or tablet, an adult can help you run the badge program and compare it with the plan.
Practice
1
A kitchen timer accepts 1 to 90 minutes. Put these test values into normal, boundary and invalid: 45, 90, 91, 1, 0, 200.
Normal: 45. Boundary: 1, 90 (the edges) and 0, 91 (just outside). Invalid: 200, which is far outside. A good plan includes at least one of each kind.
2
A museum rule says children aged 5 and under enter free. This program uses age < 5. Which test finds the mistake? What should the code be, and what kind of error is it?
The boundary value 5 finds the mistake: the rule expects Free, but the program prints Pay. It is a logic error, because the program runs but gives the wrong answer for one value. The condition should be age <= 5.
3
Look at the field list. Which checks reject (a) Class year 10, (b) Books read 51, (c) a blank pupil name, (d) the date 5 June 2025? Name the type of check each time.
Field
Data type
Validation rule
Pupil name
text
presence check: not empty
Class year
integer
range check: 7 to 9
Books read
integer
range check: 0 to 50
Start date
text
format check: DD/MM/YYYY
(a) the range check on class year (7 to 9). (b) the range check on books read (0 to 50). (c) the presence check on the pupil name. (d) the format check on the date, which must be DD/MM/YYYY, such as 05/06/2025.
4
A pupil aged 12 types 14, and the range check 9 to 15 accepts it. Does this mean the data is correct? Explain.
No. Validation only checks that data is reasonable, and 14 is inside the allowed range. It cannot know that the pupil is really 12. The data is reasonable but wrong, so important data is also checked by a person.