Closed Zhilin-Huang closed 4 years ago
Good question @Zhilin-Huang Consider a case of a while-loop in the code. An execution path that does only one iteration through the loop executes all statements in the loop, achieving 100% statement coverage. But that does not mean all unique paths through the loop have been executed because a path that does only one iteration in the loop is different from another path that does two iterations in the loop.
Good question @Zhilin-Huang Consider a case of a while-loop in the code. An execution path that does only one iteration through the loop executes all statements in the loop, achieving 100% statement coverage. But that does not mean all unique paths through the loop have been executed because a path that does only one iteration in the loop is different from another path that does two iterations in the loop.
I see! So does this mean that in the case that we have a while-loop, we can never achieve 100% path coverage because executing 1, 2, 3... n iterations are considered different paths?
I see! So does this mean that in the case that we have a while-loop, we can never achieve 100% path coverage because executing 1, 2, 3... n iterations are considered different paths?
Yes, if the possible number of loops is not a fixed number of possibilities. In other cases it is not impossible but the number of paths can be too big for 100% path coverage to be feasible.
I see! So does this mean that in the case that we have a while-loop, we can never achieve 100% path coverage because executing 1, 2, 3... n iterations are considered different paths?
Yes, if the possible number of loops is not a fixed number of possibilities. In other cases it is not impossible but the number of paths can be too big for 100% path coverage to be feasible.
Thanks for the clarification Prof!
Understood from the explanation that 100% path coverage gives the highest intensity, but why doesn't 100% statement coverage give highest intensity as well? Doesn't all statements being executed mean all paths are executed?
Any help is appreciated!