How can Clover be configured, via maven build running in Bamboo, to instrument and report on only changed files?

Eliot Eliot March 29, 2012

I'm working in a large, legacy project that does not have good code coverage, but I want to require the development team to have a certain level of code coverage for any classes that they touch or create. How can maven/clover/bamboo be used to report percent code covered only on classes changed since the last successful build, and fail the build if the code coverage goal is not acheived?

Currently using Bamboo 3, Maven 2

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.
May 8, 2012

Unfortunately such feature is not available. One of the reasons is that Bamboo can run builds using multiple agents, each of them checking out/updating source code when necessary - and you never know which agent will be used for build and thus how many files will be updated. Another reason is that our experience shows that such kind of report is not very reliable, because number of executed test classes and number of business classes in scope and thus coverage threshold varies very much from one commit to another. It's much better to have relatively stable set of classes in scope.

Instead of this, I recommend using the historical report feature, which will report about new classes since the last Clover run, show classes for which coverage has changed as well as present general trends in coverage on graphs.

Alternatively, you might consider limiting set of files for instrumentation to those being under active development. A Maven clover2:setup goal with includes/excludes options can be used for this purpose. See clover2:setup mojo reference. A list of files can be prepared manually or based on svn log, for example.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events