Overview

The Clover Eclipse Plugin allows you to instrument your Java code easily from within the Eclipse Java IDE, and to view your coverage results inside Eclipse.

Using the plugin

Enabling Clover for your project

Clover can be enabled for any of your Java-based Eclipse projects.

  1. From the Project Explorer view, right click on your Java project.
  2. Select "Clover | Enable Clover capabilities...".
  3. With Clover now enabled, your project will now be automatically rebuilt. If you have upgraded from a previous version of Clover you will need to perform a clean build of all your Clover-enabled projects.
  4. Open the Clover Coverage Explorer View by selecting "Window | Show View | Other..." and selecting Clover > Coverage Explorer. This view is designed for horizontal placement. You should see your project listed with 0% coverage against it.
  5. Open the Clover Test Contributions View by selecting "Window | Show View | Other..." and selecting Clover > Test Contributions. The view is designed for vertical placement. As your project has no coverage yet, this view won't tell you anything interesting.

The Clover Coverage Explorer

The Coverage Explorer view allows you to control Clover's instrumentation of your Java projects, and shows you the coverage statistics for each project. The tree shows the project, package and class coverage and complexity information for all Clover-enabled projects. Summary statistics are displayed alongside the tree for the selected project/package/class.

 
The Coverage Explorer viewer is automatically added to the workbench when you enable Clover for your project. If the viewer is closed, you can open it again using "Window | Show View | Other..." and selecting "Clover | Coverage Explorer".

The viewer allows the following actions:

Viewing Coverage Results

The Clover plugin shows coverage data in five ways:

Instrumenting your code

You can use the Clover Eclipse plugin to instrument the Java source in your project each time it is built. This option is activated on a per-project basis by toggling the "Compile with Clover" button in the Clover Viewer.

Disabling Clover in your project

You can disable Clover instrumentation using the "Compile with Clover" button. You can prevent coverage information from being displayed in the Java editors by toggling the "Show Coverage in Editor" button although this will apply to all Clover-enabled projects in the workspace.

If you want to completely de-activate Clover support in a project, then un-check "Enable Clover plugin in the project" on the Clover page of the project's properties dialog. You can also achieve this by right clicking on the project and selecting "Clover | Remove Clover capabilities...".

Configuration options

The Clover Eclipse plugin's configuration can be accessed in two places:

Project Properties - Instrumentaton

These options control how Clover instrumentation works when "Compile with Clover" is selected on your project.

Project Properties - Compilation

These options control the compilation of the instrumented source code that Clover generate.

Project Properties - Contexts

Coverage contexts allow you to marks some parts of your code so that you can later filter out the coverage for these in the Coverage Explorer. See Using Coverage Contexts.

Project Properties - Source Files

Clover Preferences - General

These options control how Clover works across all projects which have "Compile with Clover" enabled.

Clover Preferences - License

This option allows you to view and change the license you use with Clover.

FAQ

See the Eclipse Plugin FAQ