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
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.
I'm John Allspaw, co-founder of Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs