説明
The <clover-check> task tests project/package code coverage against criteria, optionally failing the build if the criteria are not met. This task needs to be run after coverage has been recorded.
パラメーター
属性 |
説明 |
必須 |
目標 |
The target percentage total coverage for the project. e.g. " |
At least one of |
methodTarget |
The target percentage method coverage for the project. |
At least one of |
statementTarget |
The target percentage statement coverage for the project. |
At least one of |
conditionalTarget |
The target percentage conditional coverage for the project. |
At least one of |
initstring |
The |
No; If not specified here, Clover will look in the default location ( |
haltOnFailure |
Specifies if the build should be halted if the target is not met. |
No; default is " |
failureProperty |
Specifies the name of a property to be set if the target is not met. If the target is not met, the property will contain a text description of the failure(s). |
いいえ。 |
filter |
comma or space separated list of contexts to exclude when calculating coverage. See Using Coverage Contexts. |
いいえ。 |
span |
Specifies how far back in time to include coverage recordings from since the last Clover build. See Using Spans. |
No; defaults to " |
includeFailedTestCoverage |
Specifies whether to include failed test coverage when calculating the total coverage percentage. |
No; defaults to " |
Nested elements of <clover-check>
<package>
Specifies a target for a named package.
パラメーター
属性 |
説明 |
必須 |
|---|---|---|
name |
The name of the package. |
Either (but not both) of |
regex |
Regular expression to match package names. |
Either (but not both) of |
目標 |
The target percentage total coverage for the package. e.g. "10%" |
At least one of |
methodTarget |
The target percentage method coverage for the package. |
At least one of |
statementTarget |
The target percentage statement coverage for the package. |
At least one of |
conditionalTarget |
The target percentage conditional coverage for the package. |
At least one of |
<testResults>
An optional Ant fileset containing a list of test result XML files.
<testresults> is generally not required by most users, as the built-in test results will provide all required information in the majority of cases. For more details please see 'Advanced Usage'.
例
<clover-check target="80%"/>
Tests if total percentage coverage is at least 80%. If not, a message is logged and the build continues.
<clover-check target="80%"
haltOnFailure="true"/>
Tests if total percentage coverage is at least 80%. If not, a message is logged and the build fails.
<clover-check target="80%"
failureProperty="coverageFailed"/>
Tests if total percentage coverage is at least 80%. If not, a message is logged and the project property coverageFailed is set.
<clover-check target="80%" <package name="com.acme.killerapp.core" target="70%"/> <package name="com.acme.killerapp.ai" target="40%"/> </clover-check>
Tests if:
- total percentage coverage for project is at least 80%.
- total percentage coverage for package
com.acme.killerapp.coreis at least 70%. - total percentage coverage for package
com.acme.killerapp.aiis at least 40%.
If any of these criteria are not met, a message is logged and the build continues.
<clover-check target="80%"
filter="catch">
<package name="com.acme.killerapp.core" target="70%"/>
<package name="com.acme.killerapp.ai" target="40%"/>
</clover-check>
As above, but doesn't include coverage of catch blocks when measuring criteria.
<clover-check target="80%" conditionalTarget="90%"
filter="catch">
<package name="com.acme.killerapp.core" target="70%"/>
<package name="com.acme.killerapp.ai" target="40%"/>
</clover-check>
As previous example, but also ensures that the project conditional coverage is at least 90%.
<clover-check> <package regex="com.acme.killerapp.core.*" target="70%"/> </clover-check>
Tests if coverage for com.acme.killerapp.core and all subpackages is at least 70%.