9. Clover Target Reference

Clover provides a set of high level, preconfigured Ant targets. A target is a high-level, pre-configured set of functionality that you can use to quickly integrate Clover. They can be launched by adding them as values to Ant on the command line.

Each target contains a number of logically grouped lower-level pieces of functionality made up of Clover-specific Tasks and Types. These allow you to harness Clover's feature set, applying the concept of convention over configuration. This should help you avoid laboriously coding your own targets from scratch — allowing you to rapidly begin using Clover, no matter how complex your environment.

(info) To enable Ant targets in Clover, you need to firstly follow the Clover Quickstart Guide.

On this page:

Using a Target

Each Clover target typically has a name (and optional Ant properties) that can be used on the command line, as follows:

ant clover.all 

In the above example, we are running the clover.all target. This runs a 'clean' process, creates a build with Clover applied and then generates a Clover report.

with.clover (target)

Enables Clover on the current build. There are no properties for this target.

Example:

ant with.clover

clover.all (target)

Runs clover.clean, with.clover, <test.target>, clover.report, clover.log (in that order) from a single target.

clover.all Properties:

Property name

Description

Options

Dependency

test.target

Defines the name of a custom target to run the tests.

inheritrefs (TRUE/FALSE)

clover.clean, with.clover

Example:

ant clover.all -Dtest.target=run.tests

In the example above, we are specifying the test.target property. This is fed another value, ( shown as run.tests). Note that run.tests in this example could be replaced by the name of any custom target you may have created yourself in build.xml.

clover.clean (target)

Deletes the clover database and the clover.dest directory.
There are no properties for this target.

Example:

ant clover.clean

clover.current (target)

Generates HTML and XML reports to clover.dest using project.title.

clover.current Properties:

Property name

Description

Options

Dependency

project.title

A string value, the user-specified name for this project

None

None

clover.dest

A system path, the destination directory for clover reports for this project

None

None

clover.span

A time interval defining the time span to use when creating historical reports

None

None

Example:

ant clover.current -Dproject.title="MyProject"

clover.report (target)

This is the same as clover.current, i.e. it generates HTML and XML reports to clover.dest using project.title. Additionally, a history report will also be created using the historypoints in clover.project.historydir.

clover.report Properties:

Property name

Description

Options

Dependency

clover.historypoint.projectdir

A path location, where history points are stored.

None

None

clover.dest

A system path, the destination directory for clover reports for this project

None

None

clover.span

A time interval defining the time span to use when creating historical reports

None

None

Example:

ant clover.report -Dclover.historypoint.projectdir="\myprojects\project3\history\"

clover.save-history (target)

Saves a history point to clover.project.historydir.

clover.save-history Properties:

Property name

Description

Options

Dependency

clover.project.historydir

A path location, where history points are stored.

None

None

test.target

Defines the name of a custom target to run the tests.

inheritrefs (TRUE/FALSE)

clover.clean, with.clover

clover.span

A time interval defining the time span to use when creating historical reports

None

None

Example:

ant clover.save-history

clover.snapshot (target)

Saves a snapshot file to assist with Clover's Test Optimization feature. There are no properties for this target.

Example:

ant clover.snapshot

clover.snapshot Properties:

Property name

Description

Options

Dependency

clover.snapshot.file

Defines the location of the snapshot file to use when saving optimized data. For use with Clover's Test Optimization feature.

None

None

clover.snapshot.file (target)

Defines the location of the snapshot file to use when saving optimized data. For use with Clover's Test Optimization feature.
Example:

ant clover.snapshot.file

Custom Targets

Clover targets can be modified or overwritten. You can also create your own targets by specifying targets with the same names in build.xml.

Last modified on Aug 6, 2014

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.