Clover for code coverage

Eman Jado August 21, 2012

Hi,

I configured bamboo and started using it to perform different project builds.

Our project manager want a way to track code churn and the number of lines of code for each build.

Would Clover be used to provide code coverage and report the lines of code changed for each build?

I downloaded a Clover trial license, but it seem that it supports :

Clover for IDEA - 3.1.6

Clover for Eclips - 3.1.6

Clover for Ant - 3.1.6

Cover for Maven 1

But we do not use any of these systems. We use legacy build systems such as Make and other custom build scripts to build our projects.

Can we use Clover to provides with code coverage?

Thank you,

Eman Jado

1 answer

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 27, 2012

Hello Eman,

In order to use Clover with Bamboo and a legacy build system (e.g. make), you have to:

1) Instrument sources and compile them

Call the https://confluence.atlassian.com/display/CLOVER/CloverInstr command line tool from your makefile and put instrumented files into some temporary directory. Modify your javac command so that it will use instrumented sources instead of the original ones.

2) Get coverage data

Run your unit tests (or any other kind of test you have in your build). Coverage files will be written to the same directory where clover.db is stored (which is defined in point 1).

3) Generate Clover XML report

Use the https://confluence.atlassian.com/display/CLOVER/XmlReporter command line tool for this task. Store report in a directory accessible by Bamboo build.

These three tasks above can be done by make called from Bamboo task. Now you have to tell Bamboo where the XML report is located:

4) Integrate Clover with Bamboo

Open Job configuration. Find "Miscellanous" tab. On this tab, enable the "Use Clover to collect Code Coverage for this build" checkbox. For "Integration Options" choose "Clover is already integrated into this build and a clover.xml file will be produced" option. In the "Clover XML Location" edit field enter a path to your clover.xml report file (generated in point 3).

Now you should see the "Clover" tab on the Plan Summary page (two graphs) and the Build Summary page (last build statistics).

The CloverInstr and XmlReporter command line tools are available in clover.jar in Clover-for-Ant.

Regards
Marek

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events