Clover as code coverage tool to run on remote system.

Hi,

I want attach a code coverage tool against code that can be executed on remote systems which can provide metrics on a regular basis, either at build time or weekly. Also it should be automated within Jenkins jobs either triggered at build time, deploy time or at some regular interval.

Please advice whether we are capable of measuring the code coverage of the remote Application in this case using Clover.

3 answers

0 votes

Hi Rocky,

can be executed on remote systems

Could you please specify what do you mean by "executed on remote systems". I'm asking, because Clover supports measuring code coverage of distributed applications, but I'd like to ensure that we have the same understanding of the "remote" term.

can provide metrics on a regular basis, either at build time or weekly

Clover must run during a build in order to measure code coverage and to generate reports. You can later access these reports at any time. Some customers also integrate Clover with Sonar.

it should be automated within Jenkins jobs either triggered at build time, deploy time or at some regular interval.

It's up to you how you'd like to configure Jenkins jobs.

 

Cheers
Marek

Hi Marek,

Thanks for reply. We want to measure code coverage of web service that is running on remote server. So we need a code coverage tool that can run on remote system and provide us with metrics.

Also please give me the information on how to setup the whole installation process.

Thanks!!

 

Hi Rocky, there's no single page for this, I'm afraid. I'd like to suggest to read the following articles: * https://confluence.atlassian.com/display/CLOVER/Using+Clover+for+web+applications - how to measure code coverage in web applications in general * https://confluence.atlassian.com/display/CLOVER/Using+Clover+in+various+environment+configurations - there are many deployment options, you may look for one which fits best your needs * https://confluence.atlassian.com/display/CLOVERKB - in case you got stuck at some point

0 votes

Hi Rocky,

Shortly speaking what you have to do is:

  • compile your web app with Clover (to have classes instrumented by Clover)
    • optional: use 'threaded' or 'interval' flush policy to have coverage data being written to disk continuously; thanks to this you will not need to shut down application server
  • deploy web app to remote server
    • ensure that clover.db file(s) is copied as well as Clover needs it at runtime
    • ensure that clover.jar is available on class path (bundle it into WEB-INF/lib or put into application server's /lib directory)
  • run your tests; as soon as application starts, Clover will write coverage files to disk
  • after tests are finished:
    • optional: shut down your application server if you did not use 'threaded' or 'interval' flush policy
    • copy coverage recording files (clover.db*) back to your build machine
    • run report generation

Cheers
Marek

Hi Marek,

I have followed the same steps what you have described in previous post. In my case I have multi module ant project. In each project I have added following in the build.xml file:

 

<!-- Clover Setup -->
<property name="clover.jar" location="../javalibs/clover-4.0.4.jar"/>
<property name="coverage.results.dir" location="D:\installed\Atlasian\clover\mergeddb"/>
<property name="coverage.flush.interval" value="1000"/>

<taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>

<property name="coverage.db" value="${coverage.results.dir}/coverage.db"/>

<target name="with.clover" >
<clover-setup initstring="${coverage.db}" flushpolicy="interval" flushinterval="500" />
</target>
<!-- Clover Setup -->

I am compiling all the projects using following ant command:

ant clean with.clover jar

It is creating coverage.db file in specified location.

Then I am starting my jboss application server with following command

run.bat -Dclover.initstring.basedir=D:\installed\Atlasian\clover\mergeddb

Then I am executing my unit test cases. JBOSS lib folders contains clover jar file.

I want to generate colver recorder files without shutting down the jboss server. But recorder files getting generated only when I am shutting down the jboss application server. 

 

Please help!!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Jira Ops

Jira Ops Early Access Program Update #2: Let’s talk severity levels

Welcome to your weekly Jira Ops Early access program update, where we’re sharing news and updates on Jira Ops' progress as we work toward our 1.0 release. If you ever want to drop us feedback or idea...

25 views 0 0
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