Configuring a coverage goal

Setting coverage threshold as a quality gate

You can check that your test coverage has reached a certain threshold, and fail the build if it has not by adding a targetPercentage tag to your plugin configuration in pom.xml:

<configuration>
  ...
  <targetPercentage>75%</targetPercentage>
  ...
</configuration>

You can then use the clover:check target to examine the Clover database and check that you have reached the coverage threshold.

If you want the build to succeed anyway (printing a warning to your log), use the command line option -DfailOnViolation=false.

Ratcheting Up Coverage

Clover can be configured to fail the build or warn you when the code coverage for a project drops relative to the previous build.

The steps to configure the clover-maven-plugin to do this are as follows:

You can also optionally specify a historyThreshold parameter which is the leeway used by clover:check when comparing the coverage with the previous build. 

最終更新日: 2015 年 12 月 8 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.