aspose file tools*
The moose likes Testing and the fly likes 0% code coverage using Clover! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "0% code coverage using Clover!" Watch "0% code coverage using Clover!" New topic
Author

0% code coverage using Clover!

krithika desai
Ranch Hand

Joined: Apr 02, 2003
Posts: 33
All,
I integrated clover into the build.
Enabled instrumentation of the source files while compiling and that went through.
When i run the unit tests, i see 0% code coverage in the clover reports.
While compiling I instrumented the test classes as well. ( I shall switch it off).
But i found that it is reporting the test code that got covered! instead of the code that the tests actually access:
ant runalltests clover.report
runalltests runs all the unit tests while clove.report generated the report.
What am i doing wrong here?
thanks.


thanks,<br />krithika
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by krithika desai:
All,
I integrated clover into the build.
Enabled instrumentation of the source files while compiling and that went through.
When i run the unit tests, i see 0% code coverage in the clover reports.
While compiling I instrumented the test classes as well. ( I shall switch it off).
But i found that it is reporting the test code that got covered! instead of the code that the tests actually access:

ant runalltests clover.report

runalltests runs all the unit tests while clove.report generated the report.

What am i doing wrong here?
thanks.


I know this is an ancient post, but I've been experiencing the same issues with Clover. The first thing I discovered is that the coverage data doesn't get written until the JVM running the tests complete. This means that you need to either fork the tests or run the report as a seperate Ant job. In some circumstances, which I haven't resolved yet, forking the JUnit tests doesn't fix the problem, but running the report seperately always does.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: 0% code coverage using Clover!