next up previous contents index
Next: Vocabulary Up: Testing Software Previous: Testing Software

A prefacing Example

   As an entrance into the area of software testing and to get a first impression of the difficulties met in this field, a small exercise  will be given here (taken from [Myers79]):

Assume there is a program which reads three integers. Those three values will be interpreted as the longitudes of the legs of a triangle. The program will determine if this triangle is equilateral, isosceles, or none of these and output its result.  

Now please take a sheet of paper and write down a set of inputs for this program which you think would be a good test for it.

Please check your answers. Here is a suggestion for a good set of inputs. Feel free to use it as a checklist:

  1. Do you have a test case that represents a valid scalene trianglegif?
  2. Do you have a test case for a valid equilateral triangle?
  3. Do you have a test case for a valid isosceles trianglegif?
  4. Do you have at least three test cases that represent valid isosceles triangles such that you have tried the three permutations of two equal sides (for instance (2, 2, 3), (2, 3, 2), and (3, 2, 2))?
  5. Do you have a test case in which one side has a zero value?
  6. Do you have a test case in which one side has a negative value?
  7. Do you have a test case with three positive integers so that the sum of two is equal to the thirdgif?
  8. Have you tried all permutations of category seven?
  9. Do you have a test case with three positive integers so that the sum of two is less than the third?
  10. Have you tried all permutations of category nine?
  11. Do you have a test case in which all sides are zero?
  12. Do you have at least one test case with noninteger values?
  13. Do you have one test case with the wrong number of values?
  14. Last, but not least, did you specify the expected output for each test case?

There is no doubt that this list is not able to detect all bugs  which might be in such a program, but since all fourteen points represent faults which have been found in various versions, your set of inputs should be able to detect those. Do not be frustrated, if you did not get a lot of points from this list, because even professional programmers get in the average only one half of them. And this example was designed to demonstrate how difficult it is to develop a good test for a simple program. Now just image how much worse it must be to do such a test for a huge program.


next up previous contents index
Next: Vocabulary Up: Testing Software Previous: Testing Software

Ingo Melzer
Mon Aug 5 15:12:01 MET DST 1996