Bamboo 4.4 : Enabling the Clover add-on

This page contains instructions on enabling and configuring Atlassian's Clover add-on for a job in Bamboo.

When Bamboo is integrated with Clover, you can:

  • view code-coverage details (i.e. the percentage of code covered by tests) for each build result
  • view code-coverage trends for a job over a period of time
  • view the code-coverage summary for the job.

To enable the Clover add-on on a job:

  1. Navigate to the desired job, as described on Configuring jobs.
  2. Choose Actions > Configure Job.
  3. Click Miscellaneous.
  4. Select Use Clover to collect Code Coverage for this build and complete the following settings:

SettingDescription
Automatically integrate Clover into this buildYou will need to provide a Clover license (evaluation licenses are available), unless this has been configured globally in the Administration panel (Administration > Plugins > Clover Plugin).
Generate a Clover Historical ReportDisplays the current coverage results compared with previous Clover code coverage reports.
Generate a JSON reportProvides the Clover results in a format ready for embedding into applications or external report views.
Use plan-defined Clover license keyOverride the global Clover license for this particular plan.
Clover is already integrated into this build

Use this option when you already have Clover-for-Ant or Clover-for-Maven configured to generate a report.

Clover XML Location

Specify the location where Bamboo will look for the XML report file from Clover. Please specify the file path relative to your plan's root directory (e.g /home/bamboouser/bamboo-home/xml-data/build-dir/MY_PLAN/), i.e. do not specify an absolute path.

 target/site/clover/clover.xml 

Screenshot: Enabling Clover for a job

 

Automatic Clover integration

Automatic integration works with Ant, Maven 2.x and Maven 3.x tasks.

Steps:

  1. Enable "Use Clover to collect Code Coverage for this build".
  2. Select "Automatically integrate Clover into this build".
  3. Paste the global license key for Clover (Administration > Plugins > Clover Plugin) or enable "Use plan-defined Clover license key" and paste key into the text field below.

Optional steps:

  • enabling "Generate a Clover Historical Report",
  • enabling "Generate a JSON report"

Bamboo will:

initially:

  • create an artifact named "Clover Report (System)" visible on "Artifacts" tab

and during every build:

  • extract global or plan license key into temporary file during the build and pass it to
    • Ant task as -Dclover.license.path=/<bamboo-home>/xml-data/build-dir/<your-job>/.clover/clover.license
    • Maven task as -Dmaven.clover.licenseLocation=/<bamboo-home>/xml-data/build-dir/<your-job>/.clover/clover.license
  • enhance tasks by adding
    • Ant targets
    • Maven goals like "clover2:setup verify clover2:aggregate clover2:clover"
  • generate Clover XML and HTML reports (by default)
  • generate statistics and charts for plan summary

 

Manual Clover integration

Manual Clover integration works with any kind of task in which Clover can be called (Ant, Maven 2.x, Maven 3.x, Command, Grails).

Steps:

  1. Enable "Use Clover to collect Code Coverage for this build".
  2. Select "Clover is already integrated into this build ...".
  3. Specify the location where Bamboo will look for the XML report file from Clover in "" field.
  4. Define a following artifact (go to "Artifacts" tab)
    1. Name - beginning with "Clover Report"
    2. Location - point to HTML report directory (e.g. target/clover/report)
    3. Copy pattern - "**/*"
  5. Configure Clover in your build script so that it generates both XML and HTML reports.
  6. Configure Clover license in your build script or pass it as proper task parameter in job configuration

 

ad 4. Defining Clover Report artifact

 

ad 5. Configuring HTML and XML reports

Example for Ant:

<clover-report initstring="target/clover/database/clover.db">			
    <current outfile="target/clover/report/clover.xml" />
    <current outfile="target/clover/report/html">
        <format type="html"/>
    </current>
</clover-report>

 

Example for Maven:

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-clover2-plugin</artifactId>
    <configuration>
        <generateHtml>true</generateHtml>
        <generateXml>true</generateXml>
    </configuration>
</plugin>

 

ad 6. Configuring license

  • save Clover license key in a file (for example in /opt/bamboo/clover.license)
  • pass location of the license key to the build task
    • define it in the build script or
    • passing as Java property for Ant/Maven task in plan configuration

 

Example - declare license location in pom.xml (Maven)

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-clover2-plugin</artifactId>
    <version>3.1.8</version>
    <configuration>
        <licenseLocation>/opt/bamboo/clover.license</licenseLocation>
        <generateXml>true</generateXml>
        <generateHtml>true</generateHtml>
    </configuration>
</plugin>

 

Example - declare license location in build.xml (Ant)

<project>
  <property name="clover.license.path" location="/opt/bamboo/clover.license"/>
  <!-- ... -->
</project>

 

Example - pass license location for Ant task:

clean with.clover test clover.report -Dclover.license.path=/opt/bamboo/clover.license

 

Example - pass license location for Maven task:

mvn clean clover2:setup verify clover2:aggregate clover2:clover -Dmaven.clover.licenseLocation=/opt/bamboo/clover.license

 

 

After every build Bamboo will parse Clover XML file and generate statistics and charts for a plan summary. Plan summary and job summary pages will contain "Clover" tab. 

 

Browsing Clover results

Clover HTML report and Clover statistics for a job

See Viewing the Clover code-coverage for a build.

 

Clover code coverage summary for a plan

See Viewing the Clover code-coverage for a plan.

 

Clover code coverage statistics across multiple plans

See Generating reports across multiple plans.