configuring clover with selenium

Hi ,

Please some body can share configuration of clover with a web app .

after instrumenting the source code how to deploy instrumented  code to a webserver (say tomcat) and run selenium tests against it and find code coverage .

it will really helpfull if some one can provide step by step instructions for a sample web app

1 answer

1 accepted

0 vote

Please have a look at these guidelines:


The exact setup depends on whether you want to collect global code coverage only (i.e. from all tests executed) or do you want to collect per-test code coverage as well (i.e. to be able to track coverage from every single single selenium test).

I recommend to start with the global coverage only as it's easier to set up. Steps:

1. Instrument code with Clover. The best is to have one clover.db as it will be easier to copy (use singleCloverDatabase=true or use absolute path to clover.db to create one database). Also use the 'interval' or 'threaded' flushPolicy.

2. Copy clover.db file to web server. If you have many clover.db files, then you must keep their relative location (e.g. gzip and unzip all of them).

3. Start your application server with -Dclover.initstring=/path/to/clover.db parameter if you have one database or -Dclover.initstring.basedir=/path/to/all/clover.db/folder if you have many databases.

4. Run tests.

5. Stop the server, especially if you did not change flushPolicy (i.e. 'directed' is used).

6. Copy clover.db* files (these are coverage recording files) back to build server (put in the same folder where clover.db is located), run clover:clover to generate reports.


If you succeed, then you can configure per-test coverage as a next step. In order to achieve this, you have to run with 'clover.server=true' flag, see the manual linked above for more details.

Thanks Marek . It works fine .

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

28 views 0 4
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