Using Cover CLI in Eclipse
Last updated
Last updated
See our YouTube video for a walkthrough of using Cover CLI as an external tool in Eclipse. The video covers setup and test creation.
If you haven't done so already, download, install, and license Cover CLI - see Get started - Cover CLI for details.
Please ensure all of the prerequisites for using Diffblue Cover have been met.
Go to Run > External Tools > External Tools Configuration…
and enter a Name for the new configuration (e.g. Cover).
Enter or browse to select the Location of the Cover executable.
Enter or browse to select the Working Directory for the location of your project.
Enter the following command:
5. Select the option Refresh resources upon completion so that you see the new tests in your IDE once Cover has run.
Select a Java class and then open it.
Then click Run External Tool in the top toolbar.
The Cover output is now seen in the console below.
Component | Description |
---|---|
create
The create command for Cover.
${java_type_name}
The class you wish to run Cover on. This is a variable that eclipse replaces with the selected class when run.
--class-name-template=
$"{CLASS_NAME}Tests"
This will change the class names so that the classes have the same names as the existing ones (provided that the existing test classes use a standard naming convention). The quotes around {CLASS_NAME}
are required so that Eclipse does not interpret this as one of its own variables.
--merge
This merges these tests with your existing classes (instead of replacing them).
--batch
To make the output cleaner.