← VCE Software Development U3O1

Constructing test data for validation checks

Values chosen to test each validation rule: empty for existence, text for type, and values just inside and just outside range limits, each with an expected result.

Understanding Constructing test data for validation checks in VCE Software Development U3O1

What it does: 100 is the highest value still inside the range 1 to 100, so the range check should accept it. A type check is tested with text where a number is expected. The rule should reject it, so the expected result is rejected. Boundary tests use values just outside and just inside each limit: -1 and 101 are rejected, while 0 and 100 are accepted. Values in the middle do not test the limits. An empty string has no content, so it is the test value used to check that an existence rule rejects missing input.

Common mistakes: Boundary test data for a range of 18 to 65 needs values just outside the limits (17 and 66) as well as on them. This list only has accepted values, so it never tests rejection. It should be [17, 18, 65, 66]. An existence check must accept a value only when it is not empty. Using == 0 reverses the rule, so the empty test value would be accepted. It should be len(name) > 0.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 168–177) and word search (Modules 168–193).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A form requires a username (existence check). Which test value checks the rule?
The string "Sam" - expected result: rejectedAn empty string "" - expected result: rejected
Matches
Range 1-100 tests: 50, 60, 70
↓
All values are well inside the range. There are no boundary values (1, 100) and no invalid values (0, 101) to test the limits.
Applying
Meanings
Term
test data
Meaning
Values chosen to test each validation rule: empty for existence, text for type, and values just inside and just outside range limits, each with an expected result.
Practice
def valid_age(text):
Testing
Gaps
testBelow = # just outside the limit
Check Answer
Spots
1ages = [17, 18, 65, 66]
2ages = [18, 19, 64, 65]

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Bear' badge — Forest Guardian, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A form requires a username (existence check). Which test value checks the rule?
A. An empty string "" - expected result: rejected ✓
B. The string "Sam" - expected result: rejected
An existence check is tested with an empty value. It should be rejected. A normal value like "Sam" is valid, so it should be accepted.
2. An age field must hold a whole number (type check). Which test value checks the rule?
A. "abc" (text instead of a number) - expected result: accepted
B. "abc" (text instead of a number) - expected result: rejected ✓
A type check is tested with text where a number is expected. The rule should reject it, so the expected result is rejected.
3. A mark must be between 0 and 100 inclusive (range check). Which set tests the boundaries best?
A. 5, 50, 60, 70
B. -1, 0, 100, 101 ✓
Boundary tests use values just outside and just inside each limit: -1 and 101 are rejected, while 0 and 100 are accepted. Values in the middle do not test the limits.
4. A range check allows quantities from 1 to 10. What is the expected result for the test value 10?
A. Accepted - it is the upper boundary and is inside the range ✓
B. Rejected - it is the upper boundary so it is outside the range
The limits 1 and 10 are included in the range, so 10 is valid and should be accepted. 11 would be rejected.
5. Which is a good test plan for a validation rule?
A. One test per rule, each with an expected result of accepted or rejected ✓
B. One valid value for all rules, with no expected result written down
Each rule needs its own test data, and the expected result (accepted or rejected) must be decided before running the test so you can compare it with the actual result.

Match the Pairs

age = "" → Test data for an existence check: an empty value that should be rejected
age = "abc" → Test data for a type check: text instead of a number that should be rejected
Boundary test just inside the upper limit of a range of 1 to 100: expected result accepted → test_value = 100
Boundary test just outside the upper limit of a range of 1 to 100: expected result rejected → test_value = 101
Range 1-100 tests: 50, 60, 70 → All values are well inside the range. There are no boundary values (1, 100) and no invalid values (0, 101) to test the limits.
Type check test: 25 (expected: rejected) → 25 is a number, so a type check for numbers would accept it. The test needs text such as "abc" to be rejected.

Key Term

test data
Values chosen to test each validation rule: empty for existence, text for type, and values just inside and just outside range limits, each with an expected result.

Fill in the Blanks

1. # Range rule: 13 to 18 inclusive testBelow = 12 # just outside the limit
Hint: Type the whole number just below the lower limit
2. # Type rule: age must be a whole number testText = "twelve" # Expected result: rejected
Hint: Type the expected result when text is entered instead of a number
3. # Existence rule: name must not be empty testName = "" hasValue = len(testName) > 0
Hint: Type the length that a present value must be greater than
4. # Range rule: 13 to 18 inclusive testUpper = 18 # just inside the limit
Hint: Type the highest value that is still valid for the range
5. # Range rule: 13 to 18. Test value: 13 expected = "accepted"
Hint: Type the expected result for a value on the lower boundary

Spot the Error

Question 1
A ages = [17, 18, 65, 66]
B ages = [18, 19, 64, 65]
C ok = 18 <= a <= 65
D print(a, ok)
Line B — Boundary test data for a range of 18 to 65 needs values just outside the limits (17 and 66) as well as on them. This list only has accepted values, so it never tests rejection. It should be [17, 18, 65, 66].
Question 2
A name = ""
B valid = len(name) == 0
C print("Expected: rejected")
D print("Actual:", valid)
Line B — An existence check must accept a value only when it is not empty. Using == 0 reverses the rule, so the empty test value would be accepted. It should be len(name) > 0.
Question 3
A entry = "25"
B valid = entry.isdigit()
C print("Expected: rejected")
Line A — Test data for a type check on a number must be text that is not a number, such as "abc". The value "25" is all digits, so it would be accepted and the expected result of rejected would be wrong.
Question 4
A lo = 1
B hi = 10
C test = 10
D print(lo <= test < hi)
Line D — The range check must include the upper limit. Using < hi rejects 10, which is a valid boundary value. It should be lo <= test <= hi.
Question 5
A test = ""
B ok = len(test) > 0
C expected = False
D print(ok = expected)
Line D — To compare the actual result with the expected result, use the comparison operator ==. A single = is assignment, so inside print() it causes an error. It should be print(ok == expected).

Student with a class code? Join your class →