Testing and documenting solutionsTesting and documenting solutions
When code is easy to read, a programmer is less likely to make a mistake. Legible code also allows programs to be checked for errors more easily before they are released.
To thoroughly test a program, you should test it using normal, extreme and exceptional data. The data that falls into each of these categories depends on what your program is designed to do.
For example, if you designed a program to process students' test scores out of 50, then normal, extreme and exceptional data might be as follows:
Test Case
Explanation
Example where a score should be between 0 and 50
Normal
Data that you would expect to work or be accepted and that lies within the range
2,
45
Extreme
Data at the lower and upper limits of the range
0,
50
Exceptional
Data that should not be accepted by the program
-7,
Yaney
Test Case
Normal
Explanation
Data that you would expect to work or be accepted and that lies within the range
Example where a score should be between 0 and 50
2,
45
Test Case
Extreme
Explanation
Data at the lower and upper limits of the range
Example where a score should be between 0 and 50
0,
50
Test Case
Exceptional
Explanation
Data that should not be accepted by the program
Example where a score should be between 0 and 50
-7,
Yaney
When testing programs, it is good practice to set up a test plan where you plan to test at least two cases of data from each category.
It is also important to know that extreme test data is NOT boundary testing. Sometimes extreme data is referred to as ‘boundary testing’ but this is a little inaccurate. In the above example, boundary testing would test the extreme data of 0 and 50 but would also include -1 and 51.
Extreme data is only concerned with the lower and upper values in a range, in this case 0 and 50.