Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Testing

Expected vs actual

All topicsPractise exam questions
Knowledge organiser

Testing

301.13d

Compare predicted output.

What you need to know

Before running a test, predict the expected output. Then run the program and compare with the actual output. If they differ, there is a bug to investigate.

Key points

  • Expected: what the output should be based on the spec
  • Actual: what the program really outputs
  • Match = test passed, mismatch = bug found
  • Record both in a test table for documentation

Code examples

Expected vs actual
python
# Test: input 15 into age checker (pass mark >=18)
# Expected output: "Minor"
# Actual output: "Minor" ✓ PASS

# Test: input 18
# Expected: "Adult"
# Actual: "Minor" ✗ FAIL — bug in condition