views:

219

answers:

4

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.

+2  A: 

Try EMMA It's free. It is supported in eclipse and JetBrains IDEA support and also TeamCity build server.

Mike Two
+2  A: 

Cobertura is another popularly used tool.

aberrant80
A: 

Clover is a good tool.

Thomas Jung
Unfortunately 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
+3  A: 

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.

Rogerio
+1 for this good answer, the only one so far (all others are missing the real question of the OP)
Pascal Thivent