A GAA ticket app charges you €8 instead of €5 on your 16th birthday. Why?
You’re sixteen, and the GAA club’s ticket offer says anyone aged sixteen or younger pays five euro. The app charges you eight. It runs without an error message, so what would you look at first?
Read the test results from the top. At fifteen, you expect five euro and get five. At sixteen, you still expect five euro because the offer includes sixteen, but you get eight. That mismatch tells you which test failed. It doesn’t yet tell you which line caused it.
Watch what happens to the input sixteen. The program asks whether sixteen is less than sixteen. That’s false, so it keeps the standard fare and prints eight euro. This record of the path is a trace. It points you to the condition that chose the fare.
You’ve traced the failed test. The program reads sixteen correctly, takes the false branch, and prints the standard fare it was told to keep. Which part should you inspect first? Pick one.
If an if statement is missing its colon, Python reports a syntax error before the script runs. Converting the word ‘sixteen’ to an integer raises a value error during execution: check the traceback. If the fare is wrong, trace the condition. If a linter flags an unused variable, check whether you meant to use it.
Set a breakpoint on line three, then run the program and enter sixteen. The first two lines store the age and set the standard fare. The debugger pauses before testing the condition. Inspect age: it’s sixteen. Step over the condition and watch the debugger skip line four and move to print.
The old comparison is false at sixteen. Change less than to less than or equal to, written in Python as a less-than sign followed by an equals sign. Now sixteen passes the condition. Rerun the same test: the actual fare is five euro, matching the expected fare.
A different club offers a discount to anyone aged twelve or younger. Its code checks whether age is less than twelve, so a twelve-year-old pays full price. Which option fixes the cut-off without giving thirteen-year-olds a discount, and reruns the test that failed? Pick one.
The traceback points to the conversion. Inspect its input: Python can’t convert the word ‘sixteen’ to an integer. If you catch the exception and do nothing, the user gets no useful feedback. Make the app catch the exception and ask for digits. Retest with the word, then enter sixteen in digits to check recovery.
If asked to explain stages of testing, start with a unit test of the fare function on its own. Then use a function test to check the discount on the ticket screen. In a system test, check the whole booking through to the receipt. Keep these tests to catch faults after future changes.