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
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
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:
- specify the clover:historyDir configuration for clover:check
- save a history point using the clover:save-history goal at report time. This will be used by the subsequent build.