On your 18th birthday, does a Galway bus app charge you €2 or €4?
On your eighteenth birthday, you try a Galway bus booking app. Its fare rule says two euro if you're under eighteen and four euro from eighteen on. The app accepts whole-number ages from zero to one hundred and twenty. Anything else should show ‘Invalid age’. What would you test first?
Your browser sends the age you entered in a request, just as you saw with HTTP. The app checks the age and applies the fare rule. The response gives you something you can check: a price if the age is accepted, or a message if it's rejected.
Watch what happens at seventeen, eighteen and nineteen. The price changes from two euro at seventeen to four euro at eighteen, then stays at four euro at nineteen. Eighteen is the threshold. We call the threshold and its closest neighbours boundary data.
Suppose another bus app switches to its adult fare from age sixteen. You can run three tests to check the exact threshold and the closest whole-number age on either side. Which set would you choose? Pick an answer.
Before running the app, predict from the rule. Seventeen should give two euro. Eighteen, nineteen and the normal input thirty should give four euro. Minus one should show ‘Invalid age’. Now test age eighteen. The app gives two euro. Record that as the actual result and mark fail because you expected four euro.
Back to the app where the adult fare starts at sixteen and costs four euro. You test age sixteen. The app displays two euro. Which entry correctly records both the expected result and the test outcome? Pick an answer.
Now look at a sample test run for the Galway app. For each input, record what the app actually returns beside your prediction. Mark a pass when they match. Here, eighteen is the only failure. Without testing eighteen itself, these other four tests would all pass.
A screenshot shows two euro at eighteen. Compare it with the expected four euro to confirm the fail. Your editor flags an unused limit variable set to eighteen. The child fare condition says ‘age less than or equal to eighteen’. Change it to ‘age less than limit’. This uses the variable. Rerun the tests.
In a unit test, you check the fare calculation on its own. In a function test, you check whether a feature meets its requirements, such as quoting the right fare or rejecting an invalid age. You can check feature behaviour at different levels. A system test checks the whole booking from entry to confirmation.
If asked to state a limitation and describe an improvement, name a specific gap. The plan could miss a fault at the upper age limit. Add ages one hundred and nineteen, one hundred and twenty, and one hundred and twenty-one. Expect four euro, four euro and ‘Invalid age’. Save the tests for future changes.