English subtitles

← 03-23 Path Coverage Solution

03-23 Path Coverage Solution

Get Embed Code
1 Language

Showing Revision 2 created 07/16/2014 by Udacity Robot.

  1. The answer to the quiz is 8, and let me show you why that's the case.
  2. We came into the program, the paths fork based on the value of x.
  3. So, now we have two paths at this point.
  4. Assuming that this code doesn't have any paths that we care about,
  5. We now come to another decision point--if y is true with fork execution.
  6. But we also do it on the other path.
  7. So, now we come down here and test on z,
  8. and we fork again.
  9. This illustrates, in addition to loops, y conditionals make path coverage hard,
  10. because we get an exponential number of paths on the number of conditional tests.
  11. Of course this is going to be completely impractical but on the other hand
  12. it could be that a bug lurks only here. We need path coverage to find a certain bug.
  13. This is a valuable weapon to have in our testing arsenal,
  14. even if we're not going to be achieving path coverage in practice.