Are there any such code coverage tools in Java that give the different paths in the program. Basically the idea is to ensure that all loops and nested loops are covered during execution. That is to be able to ascertain if all the loops in a code base have been executed at least through one iteration.
-
Duplicate of http://stackoverflow.com/questions/39329/what-is-your-favourite-code-coverage-tools-free-and-non-free – Jim Ferrans Oct 05 '09 at 06:05
-
8No, it is not. He asked for *path* coverage tools. See http://en.wikipedia.org/wiki/Code_coverage for definitions. Most of the answers provided to this question don't answer the question as posed. – Ira Baxter Oct 10 '09 at 16:52
5 Answers
Cobertura, EMMA and even Clover only do branch/decision coverage (in addition to line/statement coverage, of course). Clover also provides method coverage (which simply measures if a method was entered at all during execution).
For path coverage (plus line/statement coverage), try JMockit Coverage.
A sample report can be found here.
Actually, as of now this is only an initial version of the new path coverage support, which I still need to improve.

- 16,171
- 2
- 50
- 63
-
+1 for this good answer, the only one so far (all others are missing the real question of the OP) – Pascal Thivent Nov 26 '09 at 03:29
I'd go with JaCoCo It's an open source tool (replacement for EMMA) distributed under Eclipse's public license.
Ref (05:05, 17 July 2013): http://en.wikipedia.org/wiki/Java_Code_Coverage_Tools

- 49
- 4
-
[EclEmma](http://www.eclemma.org/) provides good integration of JaCoCo with Eclipse. – Rangi Keen Dec 06 '13 at 17:08
Try EMMA It's free. It is supported in eclipse and JetBrains IDEA support and also TeamCity build server.

- 44,935
- 9
- 80
- 96
-
Note that code coverage is only supported in the Ultimate edition of IDEA, not the community edition. – Eponymous Aug 30 '13 at 19:40
Clover is a good tool.

- 32,428
- 9
- 84
- 114
-
2Unfortunately it is a commercial product :-( Other than that it is, still, currently maintained and in my experience it gives accurate result (emma, for example, did not allow me to get 100% coverage on an enum) It plugs into Eclipse, Hudson, Sonar, ... The report is really clean ( that makes a lot of difference at the end of the day ) – vdr Oct 05 '09 at 09:27
-
-
1