This page explains how to set up Clover's Test Optimization feature in the IDEA development environment.
On this page:
Before using Test Optimization with Clover-for-IDEA, be aware of the following.
To establish Test Optimization in Clover-for-IDEA, 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
skitch
When Optimized tests are being run, Clover 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 Clover Toolbar.
The Delete Snapshot icon is invisible when the 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 (IDE-scope) preferences of Test Optimization where it is defined how Clover notifies about empty test runs, i.e. ones that have all tests optimized out.
Screenshot: Running Optimized Configurations
Test Optimization specific configuration options for specific JUnit configurations.
The defaults copied to new configurations may be set using Edit Defaults button.
Unfortunately not all configurations are suitable for Test Optimization. Please see the following points for specific details.
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: CIJ-249.
Due to bug CLOV-1084, in case when you execute optimized run and next add new test method to a class, such class will be always executed in next optimized runs. In order to fix it, you have to delete optimization snapshot (see button in tool bar menu).
To troubleshoot Test Optimization in Clover-for-IDEA, check through the following solutions:
Next chapter: 9. IDEA Advanced topics.