Testing a Python program with test cases
A chosen input paired with the output you expect. Run the program with it, compare the real output to the expected result in your test table, then record pass or fail.
Understanding Testing a Python program with test cases in VCE Software Development U3O1
What it does: Two different inputs make the program go down both branches, so each branch gets tested. Boundary values sit on either side of the cut-off in a condition like score >= 50, where mistakes with > and >= often hide. A test case has an input and an expected output. You run the program, compare, then record the result. You never change the expected output to fit. At the boundary value 50, > and >= give different results. 75 gives the same result for both, so it would not reveal the mistake. Testing a single input leaves the else branch untested, so a bug there would be missed.
Common mistakes: A single = assigns a value. To compare the real result with the expected result you need ==, so it should be: if result == expected:. An if line must end with a colon. It should be: if mark >= 50:.
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.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
test caseFill in the Blanks
Spot the Error
Student with a class code? Join your class →