Enabling Clover for Bamboo

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

This page describes how to enable and configure OpenClover 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.

As Clover manual integration produces instrumented classes, we recommend that you ensure that your job does not install them to production (for instance: 'mvn deploy' to public repository, 'scp' to an application server running on production, etc ...). Having instrumented code in such locations is usually not desired.

Common practices to ensure proper separation of instrumented and non-instrumented classes are:

  • create a dedicated plan or job with Clover integration enabled
  • enable Clover integration for jobs running tests only (e.g. "mvn verify")
  • use different location of local artifact cache if you need to install artifacts (e.g. ~/.m2/repository-clover and "mvn install")
  • use different URL for uploading artifacts if necessary (e.g. a separate repository for "mvn deploy")

Enabling manual code coverage integration

Manual code coverage integration works with any kind of task in which Clover can be called (Ant, Maven, Command, Grails). Use it when you already have OpenClover integration configured to generate a report in your build scripts:

  1. Go to your job. See Configuring jobs.
  2. Click the Other tab.
  3. In the 'Would you like to view code coverage for this plan?' settings, check Collect code coverage data for this job.
  4. Select I already integrated a code coverage tool in this job.
  5. In Coverage report, specify where Bamboo shall look for the XML report file generated. Specify the file path relative to your plan's root directory, e.g.:

     target/site/clover/clover.xml 
  6. Click Save.

  7. In the Artifacts tab, click Create artifact and complete the form as follows

    Name
    This should begin with with "Clover Report".
    Location
    This should point to the HTML report directory (e.g. target/site/clover)
    Copy Pattern
    Use **/*.*

  8. Configure OpenClover in your build script so that it generates both XML and HTML reports. See quick start guides how to do this:

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

Browsing code coverage results

For more information on Clover HTML report and Clover statistics for a job, see Viewing the Clover code-coverage for a plan

For more information on Clover code coverage summary for a plan, see Viewing the Clover code-coverage for a build.

For more information on Clover code coverage statistics across multiple plans, see Generating reports across multiple plans.

Troubleshooting

Clover Results Collector is unable to find the XML report file...

In the build log you may see a following warning: 

Failed to execute plugin 'Clover Results Collector' with error: No file matches the specified pattern ...

There are several possible reasons, see this article for more details: Failed to execute plugin 'Clover Results Collector'.



Last modified on Jul 1, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.