3 Control-flow/Coverage Testing
Another way to devise a good set of white-box test cases is to consider the control flow of the
program. The control flow of the program is represented in a flow graph, as shown in Figure
1. We consider various aspects of this flowgraph in order to ensure that we have an adequate
set of test cases. The adequacy of the test cases is often measured with a metric called
coverage. Coverage is a measure of the completeness of the set of test cases. To
demonstrate the various kinds of coverage, we will use the simple code example shown in
Figure 2 as a basis of discussion as we take up the next five topics.