Find Those Bugs!
Beginning programmers have trouble imagining the invalid data the users of their programs could enter. So I created a program to help them understand the process of testing. I made the program into a game where they try to find all the bugs in a program 3 times as fast as possible.
I give the students some help in what to test...
* Common input validations to test for: (These are your test cases!)
* String entry, test for:
* - null (no entry at all)
* - space or spaces
* Numeric entry, test for:
* - null (no entry at all)
* - space or spaces
* - non-numeric data such as "abc"
* - negative numbers
* - zero
* - a number such as 3.1415
* - a number that is out of range. For example, entering 15 for the number of the month
* - a number that is not reasonable for the data. For example, entering an age of 345, or an age of -3
* Yes or No entry, test for:
* - null (no entry at all)
* - space or spaces
* - data that does not meet the program's expectation. For example, instead of Y or N, enter "abc"
* Common input validations to test for: (These are your test cases!)
* String entry, test for:
* - null (no entry at all)
* - space or spaces
* Numeric entry, test for:
* - null (no entry at all)
* - space or spaces
* - non-numeric data such as "abc"
* - negative numbers
* - zero
* - a number such as 3.1415
* - a number that is out of range. For example, entering 15 for the number of the month
* - a number that is not reasonable for the data. For example, entering an age of 345, or an age of -3
* Yes or No entry, test for:
* - null (no entry at all)
* - space or spaces
* - data that does not meet the program's expectation. For example, instead of Y or N, enter "abc"
Below are two files. One, the java file you can run. It runs the .class file on the right. Download the files into the same directory, compile the first file using an IDE such as DrJava or Eclipse or NetBeans or whatever.
|
|
Here is what happens when the student enters nothing (null) to the question:
At the end of each round the program tells the student how they did.