[clover-html-report] No coverage recordings found. No report will be generated.

I am using clover with ant to generate coverage reports to an existing java project that already has unit test cases.

My ant target first runs clover-setup then builds the code using javac and then runs the tests using junit. I have added clover.jar to the runtime classpath for the test cases.

When i run the build target i see clover logs saying that classes have been instrumented

[clover] Clover all over. Instrumented 28 files (3 packages).

However when i run the <clover-html-report> task no report is generated. Instead the log shows

[clover-html-report] No coverage recordings found. No report will be generated.

If code coverage is being collected/logged what log messages am i expected to see when junit is executing?

1 answer

1 accepted

0 votes
Accepted answer

1) Please check in which order your targets are being called. A common mistake is to call <javac> first, followed by <clover-setup>. As a consequence, sources are instrumented, but not compiled. Assuming that you're using Clover-for-Ant, a typical sequence is:

  • clean (to ensure all sources will be recompiled)
  • instrument sources (<clover-setup> or <clover-instr>)
  • compile (<javac>)
  • test (<junit> or other)
  • reporting (<clover-report> or <clover-html-report>

2) Please double check if the clover.jar is on the classpath. In case it's missing you may find "NoClassDefFoundError" exceptions in the junit log.

3) Please check if clover.db is accessible by your application during test execution. It may happen that instrumented classes cannot find the database, especially when unit tests are ran from a working directory different than the build directory or on another machine.

In such case you shall find warning messages in the junit log about it.

How to fix it? You can:

* use an absolute path in <clover-setup initstring="..."> or

* run unit tests from the same working directory as build or

* copy clover.db to a proper location/machine and pass -Dclover.initstring=/path/to/clover.db JVM property

4) Please check what flush policy do you have in <clover-setup> set. You may change the default setting in case you're running your code on an application server.

The problem was that clover.jar was not on the classpath.

I had used a <classpath refid=""> in my junit task but that did not seem to work. If use the


	&lt;pathelement location=""/&gt;


mechanism, then it works fine.

Thank you for your help

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Feedback & Announcements

How do you analyze GC logs, thread dumps and head dumps?

Hi awesome community!  In this article, I would like to describe the one of the toolset (service) for the analyze some problems on different Java-based instances, of course, as Atlassian admini...

108 views 0 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you