Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

aarondsouza June 12, 2014

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
Answer accepted
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 12, 2014

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.

aarondsouza June 20, 2014

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;classpath&gt;

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

&lt;/classpath&gt;

mechanism, then it works fine.

Thank you for your help

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events