8 Measuring internal product attributes: structure


A. Törn - Contents - - Previous chapter - Next chapter - - Previous page - Next page

8.2 Test coverage measures

Suppose that program P has been produced for known specification S. To test P, we run it with an input i  and check to see that the output for i satisfies the specification for i. We can formalize this procedure by defining a test case to be a pair (i, S(i)). We expect P(i) = S(i). For an example, see Example 8.19.

Test strategies falls into two categories:

White-box testing includes statement (node) coverage and branch coverage, see Examples 8.20 and 8.21. Path coverage means covering each path, which normally is impossible (loops!). Simple path testing is a strategy requiring the execution of every simple path. Visit-each-loop testing is such that:

An infeasible path is program path that cannot be executed for any input, see Example 8.22.

Knowing the minimum number of test cases for some testing strategy can help when deriving test cases. A number of hierarchical measures for this are illustrated in Figures 8.15 and 8.16. The measures are given in Appendix 8.10.4.

Test effectiveness ratio can be defined as the ratio of certain objects covered by the test, see Example 8.29