This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

0% code coverage using Clover!  RSS feed

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!