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

Deleted user April 25, 2012

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
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2012

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;
&lt;/clover-merge&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="${clover.report.dir}" title="Current status of my Project"/&gt;
    &lt;historical outfile="${clover.report.dir}" title="History of my Project"
        historyDir="${clover.history.dir}"&gt;
        &lt;overview/&gt;
        &lt;chart&gt;
            &lt;columns&gt;
                &lt;totalPercentageCovered/&gt;
            &lt;/columns&gt;
        &lt;/chart&gt;
        &lt;movers interval="30d"/&gt;
    &lt;/historical&gt;
&lt;/clover-report&gt;

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events