This page explains how to set up Clover's Test Optimization feature in the Eclipse development environment.
On this page:
Before using Test Optimization with Clover-for-Eclipse, be aware of the following.
To establish Test Optimization in Clover-for-Eclipse, carry out one of the following actions:
Screenshot: Launching a Build with Test Optimization from the Context Menu
Screenshot: Launching a Build with Test Optimization from the Drop-Down Menu
Screenshot: Launching a Build with Test Optimization from the Configuration Dialog
When the Run Optimized button is used, Clover will run the configuration that was most recently run optimized.
When Optimized tests are being run, the JUnit view displays additional info about savings (as shown in the screenshot below).
Screenshot: Pop-up Notification of Time Savings With Test Optimization
After Optimized tests run, Clover saves a snapshot file with coverage information that is used to optimize the following test runs.
This file may be deleted using the Delete Snapshot icon in the Coverage View (next to Delete Coverage Recordings button; you need to select a project first).
The 'Delete Coverage Recordings' button also clears the snapshot file.
The Delete Snapshot icon is disabled when the selected project does not have the snapshot file.
Test Optimization would run all tests (no optimization) when the snapshot file is deleted or absent.
The list below shows the settings available for Test Optimization.
Screenshot: Setting Global Preferences
These are global (workspace-scope) preferences of Test Optimization; they are used as a template for per-launch configuration preferences, or used when launch configuration uses default settings.
Screenshot: Running Optimized Configurations
Screenshot: The Run Optimized Drop-Down Menu
Allows overriding the workspace settings for single launch config.
Unfortunately not all configurations are suitable for Test Optimization. Please see the following points for specific details.
Clover does not aggregate data across projects, so it is not possible to detect changed sources in projects other than the one the test is in. As a result, if your project contains tests that are dependent on other projects, any change in those projects would not be detected by Test Optimization and some tests that should be run will unfortunately be 'optimized' too aggressively, resulting in their removal.
For more information, see this JIRA issue: CEP-297.
Clover does not recognise test suites as entities that should be optimized away.
As the result test suites are always run (never optimized).
If your test launch configuration includes both test suite and the test case (which is probably an incorrect configuration), then the test case would be run twice (normal behavior) or once (via test suite) when the test case is optimized away.
Resolution: Do not include test suites in launch configuration, add test cases directly.
For more information, see this JIRA issue: CEP-299.
Test Optimization is only supported with JUnit tests at this time.
To troubleshoot Test Optimization in Clover-for-Eclipse, check through the following solutions:
Next chapter: 8. Launching an Ant build from Eclipse.