← ACARA Digital Technologies Years 9–10

Judging whether a set of test cases is enough

Test cases are enough when they use normal, boundary and invalid data and run every branch and loop. Missing any leaves the program only partly validated, and passing tests never prove no bugs.

Understanding Judging whether a set of test cases is enough in ACARA Digital Technologies Years 9–10

What it does: Both tests are 50 or more, so only the Pass branch runs. The else branch is never tested, so the coverage is incomplete. One passing test shows the code works for that data only. Empty lists and other cases are untested, so bugs could remain. Enough tests need normal, boundary (0, 100) and invalid data (like -1 or 101). Counting tests is not the same as covering the types. Missing any one data type leaves a gap. Without invalid data, you do not know if the program rejects bad input. This list ticks every box on the data checklist, so it is much closer to being enough to validate an age check.

Common mistakes: The list is called tests, not test. Using test causes a NameError, so no test data is looped over. It should be for t in tests:. An if statement must end with a colon. Without it Python gives a SyntaxError, so neither branch can be tested. It should be if grade >= 50:.

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 591–622) and word search (Modules 536–622).

Take this worksheet further — free with Cloodit

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

Learning
Duo
A program checks if a mark is 0 to 100. A student tests only 50, 60 and 75. Is this test set enough?
Yes, three tests is plentyNo, it only has normal data
Matches
# Tests: 5, 10, 20, 30, 40 # All passed, so the program is fully tested!
↓
Five normal values were all passed, but there is no boundary or invalid data. Passing tests never prove the program has no bugs.
Applying
Meanings
Term
test coverage
Meaning
Test cases are enough when they use normal, boundary and invalid data and run every branch and loop. Missing any leaves the program only partly validated, and passing tests never prove no bugs.
Practice
tests = ["normal", "boundary"]
Testing
Gaps
= [-5, 101]
Check Answer
Spots
2count = 0
3for t in test:

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

The 'Moose' badge — Tundra Champion, 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 program checks if a mark is 0 to 100. A student tests only 50, 60 and 75. Is this test set enough?
A. Yes, three tests is plenty
B. No, it only has normal data ✓
Enough tests need normal, boundary (0, 100) and invalid data (like -1 or 101). Counting tests is not the same as covering the types.
2. Which checklist makes a test set complete for a range check?
A. Normal, boundary and invalid data ✓
B. Three different normal values
A complete set mixes data types. Extra normal values do not test the edges or the rejection of bad input.
3. Code has if score >= 50: print('Pass') else: print('Fail'). Tests used: 70, 85, 90. What is missing?
A. A test that runs the else branch ✓
B. Nothing, all the tests passed
Every test goes down the if branch, so the else branch was never run. Add a test like 30, plus boundary values 49 and 50.
4. A loop runs from 1 to 10. Which test set covers the loop better?
A. Zero, one and many repeats ✓
B. Only many repeats every time
Good coverage runs the loop zero times, once, and many times so the loop bounds are actually tested.
5. All 8 of your test cases passed. What can you correctly conclude?
A. The program has no bugs at all
B. No bugs were found by these tests ✓
Passing tests never prove there are no bugs. They only show the program works for the data you tried.

Match the Pairs

tests = [15, 18, 17] # age check: >= 18 → Weak test set: no invalid data (like -5 or 'abc') and only one value on the boundary side, so it is not enough yet
tests = [25, 18, 17, -5, 'abc'] → Stronger test set: normal (25), boundary (18 and 17) and invalid (-5, 'abc') data are all included
An untested branch leaves the program partly validated: every if and else path needs at least one test that runs it → if mark >= 50: print('Pass') else: print('Fail') # tests: 80, 90
Passing tests do not prove there are no bugs: a loop that is never run with an empty list could still hide an error → total = 0 for n in nums: total = total + n # tested with [1, 2, 3] only
# Tests: 5, 10, 20, 30, 40 # All passed, so the program is fully tested! → Five normal values were all passed, but there is no boundary or invalid data. Passing tests never prove the program has no bugs.
while count < 3: count = count + 1 # Test plan: skip the loop, run once → The test plan never runs the loop several times, so the loop is untested and the code is only partly validated.

Key Term

test coverage
Test cases are enough when they use normal, boundary and invalid data and run every branch and loop. Missing any leaves the program only partly validated, and passing tests never prove no bugs.

Fill in the Blanks

1. normal = [40, 75] boundary = [0, 100] invalid = [-5, 101]
Hint: Type the variable name for the third kind of test data, which the program should reject.
2. if mark >= 50: print("Pass") else: print("Fail")
Hint: Type the keyword for the branch that only runs when a failing mark is tested.
3. assert grade(50) == "Pass" assert grade(49) == "Fail"
Hint: Type the boundary value just below the pass mark, so the test checks the edge.
4. passed = 9 total = 10 print(passed < total)
Hint: Type the comparison operator that is True when fewer tests passed than were run.
5. for score in scores: count = count + 1 print(count)
Hint: Type the keyword that starts this loop. Test it with an empty list so the loop body never runs.

Spot the Error

Question 1
A tests = [50, 0, 100, -1]
B count = 0
C for t in test:
D count = count + 1
Line C — The list is called tests, not test. Using test causes a NameError, so no test data is looped over. It should be for t in tests:.
Question 2
A grade = 55
B if grade >= 50
C print("Pass")
D else:
E print("Fail")
Line B — An if statement must end with a colon. Without it Python gives a SyntaxError, so neither branch can be tested. It should be if grade >= 50:.
Question 3
A def grade(m):
B if m => 50:
C return "Pass"
D return "Fail"
E assert grade(50) == "Pass"
F assert grade(49) == "Fail"
Line B — The operator => does not exist in Python. The boundary test needs >=, so the line should be if m >= 50:.
Question 4
A tests = [(50, 1), (49, 0)
B for mark, want in tests:
C got = int(mark >= 50)
D print(got == want)
Line A — The list is missing its closing square bracket, which causes a SyntaxError. It should end with )].
Question 5
A have = ["norm", "edge")
B need = ["norm", "edge", "bad"]
C for n in need:
D if n not in have:
E print("Missing", n)
Line A — The list opens with [ but closes with ), a mismatched bracket that causes a SyntaxError. It should end with ].

Student with a class code? Join your class →