It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Per-test coverage does not work if the test loads the classes into multiple class loader

Binod Gupta May 05, 2013

Hi,

We have a unit test that loads classes into another classloader. although we have the coverage data for those classes. Clover is unable to link the per-test coverage data to the unit test. Can you please help.

Regards,

Binod

5 answers

0 votes
Marek Parfianowicz Atlassian Team May 05, 2013

Hi Binod, could you give more details how your project and tests are organized? Which Clover version do you use? Do you use Clover-for-Ant or Clover-for-Maven (or other)? How your unit test works exactly - does it spawn another process? Have you tried to use the Clover's "distributed coverage" feature?

0 votes
Binod Gupta May 05, 2013

Hi Marek,

Thanks for the quick reply. We use clover-for-ant and the clover version is 3.1. We are running the unit test in one jvm only and do not spawn a new process, but we do use multiple classloaderd within the same jvm to load the same classes in multiple class loader so that we can simulate 2 similar env in the same jvm.

It does not spawn a new process therefore I am not sure how to use the distributed coverage features.

0 votes
Marek Parfianowicz Atlassian Team May 06, 2013

It might be a problem with availability of Clover runtime classes in your custom class loader. If classes are not found, then coverage will not be recorded. Does your class loader have the clover.jar on classpath? Do you have any exceptions in the log like NoClassDefFoundError? Have you tried to run your application with -Dclover.logging.level=debug to get more information?

0 votes
Binod Gupta May 06, 2013

I am getting the coverage in the overall report but the per-test code coverage information that is generated is not correct. I want that per-test coverage report to point me to classes that were covered in the other classloader.

0 votes
Marek Parfianowicz Atlassian Team May 07, 2013

It might be a problem that per-test coverage files written by Clover's coverage recorders from two different class loaders have the same file name and they're being overwritten, resulting in loss of coverage data. This might explain why you see incorrect per-test coverage in the report. I'll be happy to investigate it further - could you raise a support ticket at http://support.atlassian.com (in the 'Clover Support' project) and attach some code samples and build logs?

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Opsgenie

Handling Opsgenie Alerts

Hi everyone, welcome to the kb articles for Opsgenie FAQs. I'm one of the Technical Support Engineers for Opsgenie who will be providing weekly posts on FAQs from customers.   All alerts are ...

72 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you