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 votes

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 Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,033 views 6 18
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