How do I get coverage records after deploying and running the application?

Hello All,

We have a standalone application deployed on a different machine and the application jar (excluding the dependent jars) is instrumented using gradle.

We call the ant.clean followed by setup and then use javac to compile and the gradle nebula.rpm plugin to create an RPM.

This RPM is then deployed on a different machine where the clover.db file is copied and the path is set as JVM argument using -Dclover.initstring=path/to/clover.db.

However, when we run the tests, we see no coverage data in the path where clover.db is located(supplied via the init string)

We are not able to get any clover logs even after setting the JVM arguments for the same in order to debug and our application logs do not indicate any exceptions.

Steps ensured -

1. clean is called before setup task and then followed by compilation.(all done through gradle's ant builder)

2. Generated jar file was exploded and the resulting class files were decompiled to make sure that they were instrumented.

3. clover.jar is in the classpath of the application when we run the application(included the same under lib directory and also made sure that this path is made available using -classpath java option)

4. Init String is provided to the JVM as an argument at runtime.

 

Can anyone help us proceed further? If anyone can help provide information regarding how to generate clover logs, it would be help to debug this further from our end.

 

 

2 answers

0 vote

The only thing which come to my mind is the fact that coverage data might not be flushed to hard drive. How do you stop an application JVM  with Clover ?

Note it needs to be gracefully shutdown (e.g by kill -15) otherwise parts or all coverage data will be lost.  (Clover uses JVM shutdown hook and when JVM is killed those aren't invoked at all)

https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)

Beside that and the steps you've already mentioned I don't have any ideas why Clover might not work properly. But I don't know what exactly does it mean to package classes to RPM file and deploy it to JVM. (I don't know how to run RPM package in JVM). That solution might not work with Clover. 

You can also change a flush policy to "interval" or "threaded".

 

Using Ant: 

<clover-setup flushPolicy="interval" flushInterval="500">
<clover-instr flushPolicy="interval" flushInterval="500">

 

Using Maven:

<configuration>
  <flushPolicy>interval</flushPolicy>
<flushInterval>500</flushInterval>
</configuration>

 

References:

 

Cheers

Suggest an answer

Log in or Join to answer
Community showcase
Emilee Spencer
Published Friday in Marketplace Apps

Marketplace Spotlight: DeepAffects

Hello Atlassian Community! My name is Emilee, and I’m a Product Marketing Manager for the Marketplace team. Starting with this post, I'm kicking off a monthly series of Spotlights to highlight Ma...

66 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot