Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Test optimization with Bamboo Clover plugin and automatic integration

sebastian meyer November 4, 2014

Hi there,

 

we're running a Bamboo server, measuring the test coverage of our multi module maven project with the Clover plugin and the automatic integration option. Because of the multiple modules clover is triggered in a separate stage and job in a Maven 3 task running the clean goal. Now we want to use the clover test optimization. Is that possible when using the plugins automatic integration and if yes, how is it achievable?

 

Thanks in advance and best regards

Sebastian

1 answer

1 accepted

0 votes
Answer accepted
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 4, 2014

Hi Sebastian,

Unfortunately there's no extra toggle to enable test optimization together with automatic Clover integration. Which means that you'd have to configure it manually. Steps:

 

1) Select "Clover is already integrated into this build" radio button

 

2) Edit your Maven Task and add goals like:

clover2:setup clover2:optimize test clover2:snapshot clover2:aggregate clover2:clover

 - note that there's no 'clean' goal as it will perform incremental compilation

 - note that instead of the 'test' goal you can use also 'integration-test' or 'verify'

 - note that in order to use short names for Clover's goals (e.g. 'clover2:setup' instead of the 'com.atlassian.maven.plugins:maven-clover2-plugin:4.0.2:setup') you'd have to define <pluginGroup> in ~/.m2/settings.xml - see Clover-for-Maven 2 and 3 Quick Start Guide

 

3) Ensure that clover.snapshot file is shared between builds

In case you run your builds on multiple agents, you have to ensure that clover.snapshot file is accessible by all of them. Otherwise, when new build will run on a different agent than before, clover.snapshot file will not be present and all tests will be executed. Note that artifact sharing is not sufficient as AFAIK it shares a file between jobs, not between builds. Which means that you'd have to upload/download this file to/from a shared location (network drive, FTP server, Amazon S3 etc).

Alternatively, you can limit your clover-optimized builds to be executed on a single, dedicated build agent. Thanks to this you wouldn't have to pass a snapshot file, as it would persist between builds (at the cost that such agent may become a bottleneck). In order to achieve this, define a capability on one agent (e.g "clover-optimize=true") and define the same requirement in a job.

 

4) Disable "This build will produce test results" option

Why? Because it may happen that thanks to Clover's test optimization 0 tests will be executed. And Bamboo would find no test results and fail the build.

Please note that JUnit test results will be still produced by Maven, so you can define an artifact collecting these XML files. Test results will be also available in Clover's HTML report.

 

Cheers
Marek

sebastian meyer November 5, 2014

Thank you. Looks like it works fine that way.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events