Test Informed Learning with Examples

Logo

Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.

Menu

LinkedIN Community

Join our LinkedIN Community.

Cite this work

Use the following BibTeX entry to cite this work:

@INPROCEEDINGS{DVMB2023,
  author={Doorn, Niels and Vos, Tanja and MarĂ­n, Beatriz and Barendsen, Erik},
  booktitle={2023 IEEE Conference on Software Testing, Verification and Validation (ICST)}, 
  title={Set the right example when teaching programming: Test Informed Learning with Examples (TILE)}, 
  year={2023},
  volume={},
  number={},
  pages={269-280},
  doi={10.1109/ICST57152.2023.00033}
}

Phone costs calculator

Implement a program that reads the duration in seconds of a phone call and determines the total amount to be paid. The business rule is: if the call lasts less than 1 minute it costs 10 cents, and each additional minute from the first one costs 5 cents.

For example, if the call lasts 35 seconds, the cost will be 10 cents. If it lasts 3 minutes and 40 seconds (that is, the user will enter the value 220), it will cost 20 cents: 10 cents for the first minute plus 5 cents for the next 2 minutes. The remaining 40 seconds are free.


>>> %Run 
    Enter the number of seconds the call has lasted: 0
    The call has a cost of 0 cents
>>> %Run 
    Enter the number of seconds the call has lasted: 5
    The call has a cost of 10 cents
>>> %Run 
    Enter the number of seconds the call has lasted: 59
    The call has a cost of 10 cents
>>> %Run 
    Enter the number of seconds the call has lasted: 125
    The call has a cost of 15 cents
>>> %Run 
    Enter the number of seconds the call has lasted: 200
    The call has a cost of 20 cents
>>> %Run 
    Enter the number of seconds the call has lasted: -5
    Please enter a correct value

What other tests have you run to ensure that your program has the desired behaviour?

Insist that the students test their programs by giving them example
test executions and ask them to think about more tests.