clover-optimized-testset
Description
The <clover-optimized-testset>
type is designed to be used within JUnit and Ant's <batchtest/>
task (which is used to feed JUnit a list of .java files that map to the test classes to be run). This type accepts other resource collection elements (e.g. <fileset/>
), filters and reorders their resources for Test Optimization. To use this type, you must first include cloverlib.xml
.
Parameters
Attribute | Description | Required |
---|---|---|
snapshotfile | Snapshot file path if not in the default location. | No; defaults to (initstring + ".snapshot"). |
enabled | Boolean value that specifies whether the selector should optimize. If set to false no optimization occurs, if true, then optimization occurs as per the other attributes. | No; defaults to " |
minimize | Boolean value that (when true) tells Clover to restrict the set of tests, running only those that caused coverage in a changed file. When set to false, this will cause Clover to run all tests. this attribute can be used to force a full test run if, for instance, some important configuration files change and the build system decides that a full test run should be executed | No; defaults to " |
fullrunevery | Specifies how many optimized builds can run before a full run should be performed (to re-calibrate the optimization). | No; defaults to " |
ordering | Specifies how tests should be ordered during an optimized build. Accepts values "failfast", "original" or "random". The "failfast" setting runs the previously failed test first then shortest to longest test. The "original" setting orders the tests as they were found by the underlying fileset. The "random" setting applies a random ordering to the tests. | No; defaults to " |
Elements:
<*/> - any Ant resource collection: anything that implements org.apache.tools.ant.types.ResourceCollection
.
Example
<junit ...>
<batchtest todir="${outdir}/${testresultsprefix}" fork="true">
<clover-optimized-testset fullrunevery="${max.optimized.builds}">
<fileset dir="${test.location}" includes="**/*Test.java"/>
</clover-optimized-testset>
<formatter type="xml"/>
<formatter type="plain"/>
</batchtest>
</junit>