100% coverage sounds great, but is it c0, c1, c2, c3 or path coverage ? If you do not know, here is the answer:
- C0 = every instruction
- C1 = every branch if(i=1) a; even if there is no actual instruction in the i!=1 path it needs 2 tests
- i = 1
- i != 1
- C2 + C3 ~= is every condition inside an ‘if’ is once true and once false (personally, i could not care less…)
- C4: Path-coverage = every possible path was taken, if(a) x else b; if(c) y requires 4 tests
- a true c true
- a true c false
- a false c true
- a false c false
Try to aim for ~95% C0 and ~70% C1. C2 and C3 in my opinion add no value(except that they cover more paths) and C4 is often not possible, since a loop can have infinite paths (go through 1,2,3,4… times).

2 comments
Comments feed for this article
August 9, 2008 at 5:54
Record Gettext at Test Runtime « My Pragmatig life
[...] solution: collect all phrases that were used during testing. Since the testsuite often hasĀ 100% C0 coverage and any phrase that is not found will signals missing [...]
September 8, 2009 at 2:22
Sibi
Good explanation. Simple and useful