testinglinebranchcontrol-flow-graphindependent-set

Difference between line, branch and independent path coverage?


What is the difference between line, branch and independent path coverage?

given the following scenario, how the paths will look like?

Image for control flow graph on the following link --> http://testerstories.com/files/Path.Test.011.png

Steps for finding true paths for each one is too much appreciated.

Thanks :)


Solution

  • If you mean statement instaed of line, you will need two cases to cover all of them: 1 -> 2 -> 3 -> 4 -> 6 and 1 -> 2 -> 3 -> 5 -> 6.

    To cover branches (decision) you will need to run through all if/else: 1 -> 2 -> 6, 1 -> 2 -> 3 -> 4 -> 6, 1 -> 2 -> 3 -> 5 -> 6.

    For path coverage you have to run throug all available paths, in your case it is the same as for branch coverage, because you do not have cycles in your graph.