There are different strategies about how to choose the path. The optimum would certainly be to follow each path through the module once, but this is not possible:
Assume there is a little program which consists of a loop
that is executed twenty times. Inside this loop are a case or
some if instructions
which allow ten different
routes. The total number of paths trough this little program would be
. Definitely nobody is able to trace this huge amount by hand
([Myers79] provides a more detailed example ).
Since the best solution is not possible, it is necessary to reduce the number of possibilities. There is no perfect solution to this problem, and those strategies should only be understood as hints for the ``scout'' -- a human tester :
It is also important to keep in mind that, due to the fact that conditions in a program are normally not completely independent of each other, not all paths are possible. For instance, there are only two different routes through the following program:
if (C) {
instruction block A1
} else {
instruction block A2
}
if (C) {
instruction block B1
} else {
instruction block B2
}
Assuming that the instruction blocks A1 and A2 do not influence the condition C then, regardless of whether the condition C is true or false, the paths A1-B2 and A2-B1 will never be used.