clover:check

Full name:

org.openclover:clover-maven-plugin:4.5.0:check

Description:

Verify Test Percentage Coverage (TPC) from an existing Clover database and fail the build if it is below the defined threshold. The check is done on main Clover databases and also on merged Clover databases when they exist.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: verify.

Required Parameters

Name Type Since Description
<cloverMergeDatabase> String - The location of the merged clover database to create when running a report in a multimodule build.
Default value is: ${project.build.directory}/clover/cloverMerge.db.
User property is: maven.clover.cloverMergeDatabase.
<cloverOutputDirectory> String - The directory where the Clover plugin will put all the files it generates during the build process. For example the Clover plugin will put instrumented sources somewhere inside this directory.
Default value is: ${project.build.directory}/clover.
<project> MavenProject -

The Maven project instance for the executing project.

Note: This is passed by Maven and must not be configured by the user.


Default value is: ${project}.

Optional Parameters

Name Type Since Description
<cloverDatabase> String - The location of the Clover database.
User property is: maven.clover.cloverDatabase.
<codeType> String - The type of code to log - APPLICATION, TEST or ALL code. Default is set to APPLICATION.
User property is: maven.clover.codeType.
<conditionalPercentage> String -

The Test Percentage Conditional Coverage (TPC) threshold under which the plugin will report an error and fail the build. If maven.clover.targetPercentage is not specified, then this value is ignored.

IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a conditionalPercentage.


User property is: maven.clover.conditionalPercentage.
<contextFilters> String - Comma or space separated list of Clover contexts (block, statement or method filers) to exclude before performing the check.
User property is: maven.clover.contextFilters.
<debug> boolean - If you wish to enable debug level logging in just the Clover plugin, set this to true. This is useful for integrating Clover into the build.
Default value is: false.
User property is: maven.clover.debug.
<failOnViolation> boolean - Do we fail the build on a violation? The default is true but there are some edge cases where you want to be able to check what would fail but without actually failing the build. For example you may want to let the build continue so that you can verify others checks that are executed after the Clover checks.
Default value is: true.
User property is: maven.clover.failOnViolation.
<flushInterval> int - When the Clover Flush Policy is set to "interval" or threaded this value is the minimum period between flush operations (in milliseconds).
Default value is: 500.
User property is: maven.clover.flushInterval.
<historyDir> File - The location where historical Clover data is located. 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.
Default value is: ${project.build.directory}/clover/history.
User property is: maven.clover.historyDir.
<historyThreshold> String - The percentage threshold to use if clover-check is checking coverage against historical clover data. This is the amount of leeway to use when comparing the current build's coverage with that of the last build.
Default value is: 0%.
User property is: maven.clover.historyThreshold.
<includeFailedTestCoverage> boolean 4.4.0 Specifies whether to include failed test coverage when calculating the total coverage percentage.
Default value is: false.
User property is: maven.clover.includeFailedTestCoverage.
<license> String - The full Clover license String to use. If supplied, this certificate will be used over licenseLocation. NB. newline chars must be preserved. If not provided, Clover will use a bundled license key.
User property is: maven.clover.license.
<licenseLocation> String - A Clover license file to be used by the plugin. The plugin tries to resolve this parameter first as a resource, then as a URL, and then as a file location on the filesystem. If not provided, Clover will use a bundled license key.
User property is: maven.clover.licenseLocation.
<methodPercentage> String - The Test Percentage Method Coverage (TPC) threshold under which the plugin will report an error and fail the build. If maven.clover.targetPercentage is not specified, then this value is ignored. IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a methodPercentage.
User property is: maven.clover.methodPercentage.
<singleCloverDatabase> boolean - If true, then a single cloverDatabase will be used for the entire project. This flag will be ignored if a custom cloverDatabase location is specified.
Default value is: false.
User property is: maven.clover.singleCloverDatabase.
<skip> boolean - A flag to indicate not to run clover for this execution. If set to true, Clover will not be run.
Default value is: false.
User property is: maven.clover.skip.
<snapshot> File - The location to store the clover snapshot file. This file needs to persist between builds to enable Clover's build optimization feature. If not specified, the snapshot will be stored next to the cloverDatabase.
User property is: maven.clover.snapshot.
<statementPercentage> String -

The Test Percentage Statement Coverage (TPC) threshold under which the plugin will report an error and fail the build. If maven.clover.targetPercentage is not specified, then this value is ignored.

IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a statementPercentage.


User property is: maven.clover.statementPercentage.
<targetPercentage> String -

The Test Percentage Coverage (TPC) threshold under which the plugin will report an error and fail the build.

IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a targetPercentage.

For example, if actual coverage value is 99.9% then for the targetPercentage="100%" it will PASS, whereas for the targetPercentage="100.000000%" it will FAIL.


User property is: maven.clover.targetPercentage.
<waitForFlush> boolean -

If true we'll wait 2*flushInterval to ensure coverage data is flushed to the Clover database before running any query on it.

Note: The only use case where you would want to turn this off is if you're running your tests in a separate JVM. In that case the coverage data will be flushed by default upon the JVM shutdown and there would be no need to wait for the data to be flushed. As we can't control whether users want to fork their tests or not, we're offering this parameter to them.


Default value is: true.
User property is: maven.clover.waitForFlush.

Parameter Details

<cloverDatabase>

The location of the Clover database.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.cloverDatabase

<cloverMergeDatabase>

The location of the merged clover database to create when running a report in a multimodule build.
  • Type: java.lang.String
  • Required: Yes
  • User Property: maven.clover.cloverMergeDatabase
  • Default: ${project.build.directory}/clover/cloverMerge.db

<cloverOutputDirectory>

The directory where the Clover plugin will put all the files it generates during the build process. For example the Clover plugin will put instrumented sources somewhere inside this directory.
  • Type: java.lang.String
  • Required: Yes
  • Default: ${project.build.directory}/clover

<codeType>

The type of code to log - APPLICATION, TEST or ALL code. Default is set to APPLICATION.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.codeType

<conditionalPercentage>

The Test Percentage Conditional Coverage (TPC) threshold under which the plugin will report an error and fail the build. If maven.clover.targetPercentage is not specified, then this value is ignored.

IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a conditionalPercentage.

  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.conditionalPercentage

<contextFilters>

Comma or space separated list of Clover contexts (block, statement or method filers) to exclude before performing the check.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.contextFilters

<debug>

If you wish to enable debug level logging in just the Clover plugin, set this to true. This is useful for integrating Clover into the build.
  • Type: boolean
  • Required: No
  • User Property: maven.clover.debug
  • Default: false

<failOnViolation>

Do we fail the build on a violation? The default is true but there are some edge cases where you want to be able to check what would fail but without actually failing the build. For example you may want to let the build continue so that you can verify others checks that are executed after the Clover checks.
  • Type: boolean
  • Required: No
  • User Property: maven.clover.failOnViolation
  • Default: true

<flushInterval>

When the Clover Flush Policy is set to "interval" or threaded this value is the minimum period between flush operations (in milliseconds).
  • Type: int
  • Required: No
  • User Property: maven.clover.flushInterval
  • Default: 500

<historyDir>

The location where historical Clover data is located. 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.
  • Type: java.io.File
  • Required: No
  • User Property: maven.clover.historyDir
  • Default: ${project.build.directory}/clover/history

<historyThreshold>

The percentage threshold to use if clover-check is checking coverage against historical clover data. This is the amount of leeway to use when comparing the current build's coverage with that of the last build.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.historyThreshold
  • Default: 0%

<includeFailedTestCoverage>

Specifies whether to include failed test coverage when calculating the total coverage percentage.
  • Type: boolean
  • Since: 4.4.0
  • Required: No
  • User Property: maven.clover.includeFailedTestCoverage
  • Default: false

<license>

The full Clover license String to use. If supplied, this certificate will be used over licenseLocation. NB. newline chars must be preserved. If not provided, Clover will use a bundled license key.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.license

<licenseLocation>

A Clover license file to be used by the plugin. The plugin tries to resolve this parameter first as a resource, then as a URL, and then as a file location on the filesystem. If not provided, Clover will use a bundled license key.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.licenseLocation

<methodPercentage>

The Test Percentage Method Coverage (TPC) threshold under which the plugin will report an error and fail the build. If maven.clover.targetPercentage is not specified, then this value is ignored. IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a methodPercentage.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.methodPercentage

<project>

The Maven project instance for the executing project.

Note: This is passed by Maven and must not be configured by the user.

  • Type: org.apache.maven.project.MavenProject
  • Required: Yes
  • Default: ${project}

<singleCloverDatabase>

If true, then a single cloverDatabase will be used for the entire project. This flag will be ignored if a custom cloverDatabase location is specified.
  • Type: boolean
  • Required: No
  • User Property: maven.clover.singleCloverDatabase
  • Default: false

<skip>

A flag to indicate not to run clover for this execution. If set to true, Clover will not be run.
  • Type: boolean
  • Required: No
  • User Property: maven.clover.skip
  • Default: false

<snapshot>

The location to store the clover snapshot file. This file needs to persist between builds to enable Clover's build optimization feature. If not specified, the snapshot will be stored next to the cloverDatabase.
  • Type: java.io.File
  • Required: No
  • User Property: maven.clover.snapshot

<statementPercentage>

The Test Percentage Statement Coverage (TPC) threshold under which the plugin will report an error and fail the build. If maven.clover.targetPercentage is not specified, then this value is ignored.

IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a statementPercentage.

  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.statementPercentage

<targetPercentage>

The Test Percentage Coverage (TPC) threshold under which the plugin will report an error and fail the build.

IMPORTANT: comparison of actual value with an expected percentage is performed with such numerical precision as number of fractional digits set for a targetPercentage.

For example, if actual coverage value is 99.9% then for the targetPercentage="100%" it will PASS, whereas for the targetPercentage="100.000000%" it will FAIL.

  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.targetPercentage

<waitForFlush>

If true we'll wait 2*flushInterval to ensure coverage data is flushed to the Clover database before running any query on it.

Note: The only use case where you would want to turn this off is if you're running your tests in a separate JVM. In that case the coverage data will be flushed by default upon the JVM shutdown and there would be no need to wait for the data to be flushed. As we can't control whether users want to fork their tests or not, we're offering this parameter to them.

  • Type: boolean
  • Required: No
  • User Property: maven.clover.waitForFlush
  • Default: true