# Using Cover CLI in Eclipse

See our YouTube video for a walkthrough of using Cover CLI as an external tool in Eclipse. The video covers setup and test creation.

{% embed url="<https://www.youtube.com/watch?v=jiUgMs21NNE>" %}

## 1. Download install and license Cover CLI

If you haven't done so already, download, install, and license Cover CLI - see [Get started - Cover CLI](/get-started/get-started/get-started-cover-cli.md) for details.

## 2. Prerequisites

Please ensure all of the [prerequisites](/get-started/specs-and-reqs.md#prerequisites) for using Diffblue Cover have been met.

## 3. Configure Diffblue Cover CLI

1. Go to `Run > External Tools > External Tools Configuration…` and enter a **Name** for the new configuration (e.g. Cover).
2. Enter or browse to select the **Location** of the Cover executable.
3. Enter or browse to select the **Working Directory** for the location of your project.
4. Enter the following command:

```
create ${java_type_name} --class-name-template=$"{CLASS_NAME}Tests"
                         --merge --batch
```

<table><thead><tr><th width="278.79699248120306">Component</th><th>Description</th></tr></thead><tbody><tr><td><code>create</code></td><td>The create command for Cover.</td></tr><tr><td><code>${java_type_name}</code></td><td>The class you wish to run Cover on. This is a variable that eclipse replaces with the selected class when run.</td></tr><tr><td><code>--class-name-template=</code><br><code>$"{CLASS_NAME}Tests"</code></td><td>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 <code>{CLASS_NAME}</code> are required so that Eclipse does not interpret this as one of its own variables.</td></tr><tr><td><code>--merge</code></td><td>This merges these tests with your existing classes (instead of replacing them).</td></tr><tr><td><code>--batch</code></td><td>To make the output cleaner.</td></tr></tbody></table>

5\. Select the option **Refresh resources upon completion** so that you see the new tests in your IDE once Cover has run.

## 4. Running Diffblue Cover CLI

1. Select a Java class and then open it.
2. Then click **Run External Tool** in the top toolbar.
3. The Cover output is now seen in the console below.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cover-docs-preview.diffblue.com/features/cover-cli/cover-cli-admin/using-dcover-in-eclipse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
