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

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

Anirudh Venkatesh August 23, 2017

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 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 15, 2017

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

0 votes
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 24, 2017

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. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events