A travel card needs a top-up of at least £20, so why does the app reject £20?
Your travel card app takes top-ups in whole pounds, with a minimum of twenty pounds. You enter exactly twenty pounds, and the app rejects it. Where would you look for the mistake?
Use the brief to predict each result before testing. Twenty-five pounds is a normal, valid amount. Nineteen and twenty pounds test the boundary: just below it and exactly on it. Minus five pounds is erroneous because a top-up cannot be negative. The actual results show that only the twenty-pound test fails.
Follow the failing test in order. The input is twenty pounds, exactly what you entered. Then the code asks whether twenty is greater than twenty. That gives false, where the brief needs true. The rejection comes next. Following the values like this is called tracing.
For the twenty-pound test, the input reaches the program unchanged, but the app rejects the top-up. Pick the earliest point where an actual value differs from what the brief requires.
The original algorithm says to accept amounts greater than twenty. Change it to accept amounts greater than or equal to twenty because the brief includes twenty itself. Make the same change in the Python function. Type the greater-than sign followed by the equals sign.
Rerun the failed test first. Twenty equals the minimum, so the corrected rule accepts it. Now rerun the three tests that passed before. Nineteen is still rejected because it is below the minimum. Twenty-five is still accepted because it is above it. Minus five is still rejected.
A shop offers free delivery on orders of thirty pounds or more. You fix the rule after it wrongly rejects thirty pounds. Twenty-nine and thirty-five pounds both passed their tests before the fix. Pick which tests to run again.
A missing colon after a Python function header is a syntax error: Python cannot run that code. Using greater than for this minimum is a logic error: the code runs, but rejects twenty pounds. Don't treat one pass as proof. Even the original rule passed the twenty-five-pound test.
The top-up function validates an amount against a rule. This login function checks a claimed identity. It compares the entered username with the saved one, then checks the password. The word and means both must match. This is a classroom example; real apps should not store passwords as plain text.