Designing and Testing

Inspired by a talk I heard at the 1999 Northeastern Consortium on Computing in Small Colleges.
  1. Design the program and specify how it will be tested

  2. For each version in turn...

    1. Design the version and specify how it will be tested

      • Specify what functions will be implemented in this version.
      • Write down a collection of test cases to confirm that all the functions in this version actually work.
      • Choose the important classes of objects and diagram their relationships.
    2. For each class (or each closely-related group of classes, like List, Cons, and Empty)...

      1. Design the class and specify how it will be tested

        • Describe clearly in English what the class is supposed to represent.
        • Write one or more sample sequences of events that might happen to an object of the class, together with what should happen as a result.
        • List the services and behaviors the class should provide for other objects.
        • Write testbed code to test the sequence(s) of events.
        • Write skeleton code for the class.
      2. For each method...

        1. Design the method and specify how it will be tested
          • Write a contract specifying what type(s) of data the method takes and what type(s) of data it returns
          • Write several examples of how it would be called, together with what should happen in each case
        2. Write code for the method.
          • Write a header (aka skeleton code)
          • Write a template for the body (whatever you can fill in simply based on knowing the input and output types)
          • Write the details of the body, which may involve using design recipes for loops, recursive methods, etc.
        3. Test and debug the method
          Try each of your examples and make sure they do what they should.
      3. Test and debug the class

        Run your testbed code (as well as any other test cases you've developed while writing the class), and make sure they do what they should.
    3. Test and debug the version

      Try the test cases for this version, as well as any test cases you came up with while writing individual classes, to make sure all the functions intended for this version work correctly. Also do regression testing: try all the test cases for previous versions, to make sure that you haven't broken something that worked before.
  3. Test and debug the program

    Try the sample scenarios (as well as any other scenarios you came up with along the way) and make sure they do what they should.

Last modified: Thu Mar 9 10:50:30 EST 2000
Stephen Bloch / sbloch@boethius.adelphi.edu