The fundamental rule for testing functions requires that every function be tested in an already fully tested and debugged program. How can this be accomplished? Give a testing scenario for testing a program with main function that calls several functions.

What will be an ideal response?

The main function is tested with stub functions replacing each` function. Stubs should be small enough that their correctness is assured. Stubs return enough information to let the main function compile and run, so that it can be tested. Then test the main function. Having done this, each function in turn can be tested.

An alternative is to test the functions with driver functions. Drivers are functions that call the function to be tested. Drivers, like stubs, should be simple enough that their correctness is assured. Then the function is called and tested. Clearly the assumptions of ‘small enough’ that ‘correctness is assured’ are really questionable. However, this procedure is better than writing a 200 line program or worse a 2000 line program and then testing it.

Computer Science & Information Technology

You might also like to view...

The ____ command is a good choice when the object you are selecting is quite distinct from the background it is on, but may not work as well when the background has colors within the range of the object’s colors.

a. Select Background b. Select Adjacent c. Select Distinct d. Grow

Computer Science & Information Technology

Describe the format for the UPDATE command.

What will be an ideal response?

Computer Science & Information Technology