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

configuring clover with selenium

jayadev mishra November 22, 2017

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

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.

jayadev mishra December 6, 2017

Thanks Marek . It works fine .

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events