How do I get clover history when I can't maintain the same coverage databases from build to build?

I want to use the clover history feature, but I am building our product and running the regression tests on a CI server (TeamCity). We have about 30 different components, each with it's own clover DB. When the compile build starts, it downloads all our current source, then compiles it with ant, using the appropriate <clover-setup> ant tasks to gather coverage data in those different DBs. Then the regression tests run, and clover creates a bunch of reporting files. At the end, the CI server packages up all the coverage databases and report files, I then extract them on my PC and run the <clover-html> ant tasks to generate the HTML reports.

The problem is that the CI server builds on a completely empty system when it starts any compiles. There is no place to have it restore earlier coverage reports so that clover can update anything that already exists. I can hold on to older coverage databases and report files, but they would exist in completely separate directories for each run. I can't see how I can get <clover-html-report> to compare two completely separate sets of coverage files to generate a historical report. I looked at <clover-historypoint>, but that only allows me to choose a particular point in time as the starting point for historical comparisons. Since I can only pass it one init string, it seems that there is no way for me to tell it that I want to compare two different sets of databases.

How can I do this?

1 answer

1 accepted

1 vote
Answer accepted

Very good question. Actually, you have touched several topics:

1) Merging of dabases

You've mentioned that you have 30 different components, each with it's own clover.db. Please note that you can merge all these databases into one, which makes it very convenient for reporting as you can get a single report. See clover-merge task for details.

2) Files to be preserved between builds

In order to generate a historical report, you have to keep historys file only (clover-*.xml.gz) between builds. There is no need to keep clover databases (as they will be recreated during compilation).

3) Comparison of build results

Clover does not compare databases (*.db) to generate a historical report. Instead of this, it compares history points (*.xml). History point file contains metric information (like number of statments, test results etc). During report generation you can choose whether it should compare two last history points (default) or some longer period of time.

I would recommend a following approach:

1. Merge all components' clover.db files into one at the end of build in order to get a single database:

&lt;clover-merge initstring="${clover.merged.db}"&gt;
    &lt;cloverDb initstring="module-a/build/clover.db"/&gt;
    &lt;cloverDb initstring="module-b/build/clover.db"/&gt;

2. Create a history point for a merged database:

&lt;clover-historypoint initstring="${clover.merged.db}" historyDir="${clover.history.dir}"/&gt;

3. Create a 'current' and 'historical' report for a project. Use the <clover-report> target instead of <clover-html-report/>, because it provides more options. Define a <movers> section with a time period which interests you (unless you wish to compare last two builds):

&lt;clover-report initstring="${clover.merged.db}"&gt;
    &lt;current outfile="${}" title="Current status of my Project"/&gt;
    &lt;historical outfile="${}" title="History of my Project"
        &lt;movers interval="30d"/&gt;

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Opsgenie

Getting the Most out of Atlassian and Opsgenie Together

We’re excited to invite you to this action-packed webinar where we will demonstrate how to integrate Opsgenie’s powerful alerting and on-call management tools with your entire Atlassian stack. Mar...

24 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