how do I get historyThreshold to work

I have configured maven witht he clover plugin and I REALLY like it so far. But I seem to have issues with the <historyThreshold/> tag.

This is my configuration:

<configuration>
<licenseLocation>/Users/bclarance/Downloads/clover.license</licenseLocation>
<!-- How to specify the coverage threshold -->
<targetPercentage>70%</targetPercentage>
<!-- How to specifiy historical threshold -->
<historyThreshold>1%</historyThreshold>
<!-- How to specify what typeds of reports to generate -->
<generateJson>true</generateJson>
<generatePdf>true</generatePdf>
<generateXml>true</generateXml>
<generateHtml>true</generateHtml>
<!-- how to evaluate coverage -->
<instrumentation>statement</instrumentation>
<!-- when using context you have to add the filters -->
<contextFilters>private,log</contextFilters>
<!-- how to generate historical code coverage and define a dir for it -->
<generateHistorical>true</generateHistorical>
<historyDir>${user.home}/history/${project.artifact}</historyDir>
</configuration>

When I build my clover report at 90% code covereage and then build a subsequent one 85% I would expect it to fail, but it doesn't. Firstly, becasue it meets the targetPErcentage, but I still need it to fail if there is a code coeverage drop too large, in this case only 1% to validate the failure.

Pelase help if you have any ideas.

Bilal

1 answer

This widget could not be displayed.

Hi Bilal,

Please have a look at documentation of historyDir and historyThreshold attributes:

Allows you to specify a location for historical build data, along with a configurable threshold expressed as a percentage used to cause the build to fail if coverage has dropped. This attribute is passed down to specified packages, then the same test is done for these at the package level. This will only be used if there is no targetPercentage parameter set.

As you can see you cannot use targetPercentage and historyThreshold in the same configuration. However, you can create two separate profiles with different configurations:

  • one for clover2:check with targetPercentage defined
  • one for clover2:check with historyThreshold defined

This will work.

Regards
Marek

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

139 views 2 0
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you