This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
Don't get me started about those stupid light bulbs.
 
subject: 0% code coverage using Clover!
 
Similar Threads
I don't like Junit.....
Code coverage by individual test case
Project Structure
Journal Article - Introduction to Code Coverage
Project directory structure that facilitates all kinds of developer testing