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

Clover as code coverage tool to run on remote system.

Rocky Don May 4, 2015

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
Somnath Guha December 8, 2015

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!!

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 6, 2015

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

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 2015

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

Rocky Don May 5, 2015

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!!

 

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 2015

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events