Game Development Reference
Minimum Path Generation
This strategy is designed to produce the smallest number of paths that will end up
covering all of the flows in the diagram. In this context, “covering�? means that a flow
is used at least once somewhere in the test.
The benefits of using a minimum path set are that you have a low test count and the
knowledge that you exercised all parts of the diagram at least once. The drawbacks are
that you tend to get long paths that may keep you from testing some parts of the dia-
gram until later in the project when something goes wrong early in the test path.
Here's how to come up with a minimum path for the TFD in Figure 11.13. Start at
the IN and take flow 1 to NoGunNoAmmo .Then go to HaveGun via flow 2. Since flow 3 loops
back to HaveGun , take that next and then exit HaveGun via flow 4. The minimum path so
far is 1, 2, 3, 4.
Now from HaveGunHaveAmmo , go back to HaveGun via flow 5. Since flow 6 also goes from
HaveGunHaveAmmo to HaveGun , take flow 4 again and this time use flow 6 to return to HaveGun .
At this stage, the minimum path is 1, 2, 3, 4, 5, 4, 6, but there are still more flows to cover.
Take flow 7 out from HaveGun to go back to NoGunNoAmmo . From here you can take flow 9
to HaveGunHaveAmmo and return back using flow 8. Now the path is 1, 2, 3, 4, 5, 4, 6, 7, 9,
8. All that remains now is to use the flows on the left side of the TFD.
You are at NoGunNoAmmo again so take flow 11 to HaveAmmo and then return to NoGunNoAmmo
via flow 10. Only flow 12 and 13 are left now, so take 11 back to HaveAmmo where you
can take 12 to HaveGunHaveAmmo and finally exit via flow 13 to the OUT box. The com-
pleted minimum path is 1, 2, 3, 4, 5, 4, 6, 7, 9, 8, 11, 10, 11, 12, 13. All thirteen flows
on the TFD are covered in fifteen test steps.
There is usually more than one “correct�? minimum path for any given TFD. For example,
1, 11, 10, 11, 12, 8, 9, 5, 7, 2, 3, 4, 6, 4, 13 is also a minimum path for the TFD in Figure
11.13. Diagrams that have more than one flow going to the OUT box will require
more than one path. Even if you don't come up with the smallest length path(s) math-
ematically possible, the purpose is to cover all of the flows in the smallest number of
paths, which is one for the Ammo TFD.
Baseline Path Generation
Baseline path generation begins by establishing as direct a path as possible from the
IN Terminator to the OUT Terminator that travels through as many states without
repeating or looping back. This is designated as the baseline path . Then, additional