Skip to content

    Test Track

    Year 4 Testing & Fixing

    Test programs properly: compare what you expected with what happened, try tricky values and tell a syntax error from a logic error.

    • Ages 8–10
    • 3 quests
    • Beginner → Getting stronger → Challenge

    A program that runs is not the same as a program that works. Professional programmers spend as much time testing as they do writing. On the Test Track, Year 4 coders learn to test on purpose, rather than hoping for the best.

    What your child will learn

    • Compare the expected result of a test with the actual result
    • Test often, and test again after every fix
    • Tell a syntax error from a logic error
    • Choose test values at the edges of what is allowed

    Try to break it

    A good tester tries to make the program fail. If a game accepts ages 5 to 12, the interesting values are right at the edges: 4, 5, 12 and 13. Unusual input matters too — what happens if someone types a word where a number should be?

    Example questions

    Here are a few questions like the ones in the first quest. Can you solve them?

    1. 1. What is the “expected result” of a test?

      • What the program should do if it is correct
      • How long the program is
      • What the program really did
      • The name of the program
      Show answer

      Answer: What the program should do if it is correct. You decide the expected result before running the test.

    2. 2. You expect a program to show 10, but it shows 12. What have you found?

      • A sprite
      • A feature
      • A bug
      • A password
      Show answer

      Answer: A bug. The actual result does not match the expected result.

    3. 3. After fixing a bug, what should you do next?

      • Assume it now works
      • Add more sprites
      • Delete the test
      • Test again to make sure it is fixed
      Show answer

      Answer: Test again to make sure it is fixed. A fix can fail — or cause a new bug somewhere else.

    Tips for grown-ups

    • Write down what you expect before you press Run.
    • Swap projects with a friend and try to break each other’s programs.
    • Fix one thing at a time, and test after each change.