lnf.cymru stimulus sheet · Computer Science · Year 11

Sinema Aberlliw: the ticket price bug and Ifan’s commentary

The cinema, the program and Ifan are invented. This is practice with an invented program. It is not assessed work.

1. The brief

Sinema Aberlliw, a small community cinema, wants a program that tells customers the price of a ticket.

CustomerTicket price
Under 12£5.50
65 and over£6.00
Everyone else£8.50

2. Ifan’s program (Python)

1 age = int(input("Enter your age: ")) 2 if age < 12: 3 price = 5.50 4 elif age > 65: 5 price = 6.00 6 else: 7 price = 8.50 8 print("Your ticket costs £" + format(price, ".2f"))

3. Ifan’s test table (before the fix)

TestTypeInputExpectedActualResult
1Typical30£8.50£8.50Pass
2Boundary11£5.50£5.50Pass
3Boundary12£8.50£8.50Pass
4Boundary65£6.00£8.50Fail
5Extreme100£6.00£6.00Pass
6ErroneoustenA helpful messageProgram stops with a ValueErrorFail

4. Ifan’s first draft of his test commentary

1 When I tested the program it didnt work. 2 Test 4 was wrong because their was a sintax error on line 4. 3 The program gave £8.50 to someone who was 65 and it should of been £6.00. 4 I changed the thing on line 4 to fix it. 5 I then tested it again and it works now. 6 Also when you type a word it crashs, I dont no why. 7 The progam is now finished and has no bugs.

(The small numbers show the sentence numbers. They are not part of Ifan’s writing.)

5. Useful technical words

WordMeaning
syntax errorThe code breaks the rules of the language, so it will not run at all, for example a missing colon.
logic errorThe code runs, but gives the wrong result because the instructions are wrong.
runtime errorThe program starts but stops while running, for example when int() is given a word.
conditionA test that is True or False, such as age > 65.
comparison operatorA symbol that compares two values: <, >, <=, >=, ==, !=.
boundary dataValues at the edge of a range, where mistakes are most likely.
validationChecking that input is sensible before using it.
retestRunning the tests again after a change, including tests that passed before.

6. What a good test commentary does

  1. Says what went wrong: which test failed, the input, the expected and the actual result.
  2. Explains why, using the correct technical terms.
  3. Says exactly what was changed, and on which line.
  4. Says how it was retested, with evidence.
  5. Is honest about anything still not working.
  6. Is accurate: correct spelling, punctuation and grammar, in a consistent tense.