GRAPH-BASED CLASS TESTING

Daniel Hoffman, Paul A. Strooper · Australian Computer Journal · 1994

In contrast to the explosion of activity in object-oriented design and programming, little attention has been given to object testing. Two tasks arise: (1) testing a base class C and (2) testing a class derived from C, assuming C has been thoroughly tested. We describe test inputs as traces: sequences of function calls. Testgraphs are used to specify the large number of traces typically required for thorough testing. A testgraph partially models the states and transitions of a class implementation. Testgraph traversal may be varied to produce different test inputs. Outputs are verified using an executable oracle: a class specifically developed to check output correctness. Surprisingly thorough testing is achievable with simple testgraphs and oracles. The key is designing the two together, to avoid inputs for which output checking is hard. In testing derived classes, we focus on reducing the cost of test development by reusing base class tests and test code. Testgraphs provide a convenient structure for such reuse. We illustrate our approach using detailed examples.

Read the paper · More papers on PaperTik