I'm a little bit confused about code coverage criteria; especially condition and edge coverage.As stated in this book, edge coverage does not subsume condition coverage; BUT my lecture material defines condition coverage in the following way:Edge Coverage Criterion: Select a test set T such that, by executing a program P for each d in T, each edge of Ps control flow graph is traversed at least onceCondition Coverage Criterion: Select a test set T such that, by executing P for each element in T, each edge of Ps control flow graph is traversed, and all possible values of the constituents of compound boolean conditions are exercised at least once.So, the first part of the definition of condition coverage is obviously the same as the whole definition of edge coverage. Hence, I thought condition coverage implies edge coverage ...Is the definition broken? What's correct?
Does condition coverage subsume edge coverage?
testing;test coverage
Based on your definitions, it looks like edge coverage does not imply condition coverage, but condition coverage does imply edge coverage. In other words, by covering all conditions, you will be guaranteed to cover every edge; but by covering every edge, you are not guaranteed to cover every condition.For example,int function(int arg1, int arg2){    if(arg1 < 0 || arg2 < 0)        return -1;    else        return arg1 + arg2;}Going by edge coverage, the edges here are return -1, and return arg1 + arg2; in order to cover both of those edges, you need only two invocations:function(-1, 0); function(0, 0);There are, however, three conditions (considering the Boolean short-circuiting logic): arg1 < 0, arg1 >= 0 && arg2 < 0, and arg1 >= 0 && arg2 >= 0, so you'd need something like the following to achieve complete condition coverage:function(-1, 0); function(0, -1); function(0, 0);The key distinction in the definitions you posted is and all possible values of the constituents of compound boolean conditions are exercised at least once. Covering all the conditions will ensure that you will hit all the edges. But as you see, covering all the edges does not ensure that you will hit all the conditions.