You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was previously talked about in #134 and I’ll reproduce my answer below:
I think this is best illustrated with an example.
Let's say we have a while loop that can loop up to 100 times.
For us to achieve a 100% statement coverage - we just need to test one iteration of the while loop. That executes all the statements within the while loop's code block - thereby achieving full statement coverage.
To achieve full path coverage, we have to test for every possible path - that means that we test the while loop for 1, 2, 3 ... 99, 100 iterations each time, to ensure that it produces the correct result each time. That's a far more comprehensive test, and only when all paths have been exhausted through testing can it be considered full path coverage. And definitely a lot more work to be done, testing-wise.
This applies to any form of conditionals or loops within a program - you'd have to test all possible number of iterations and/or all possible branches to ensure 100% path coverage, as compared to once for statement coverage.
Lecture 7 Quiz Part 2
Aren't paths a subset of statements? Thus if you have executed all statements, you would have executed all the paths.
The text was updated successfully, but these errors were encountered: