# Test Directory

The tests created by Cover Plugin for IntelliJ will be placed in a location within the project according to the following:

1. If a test source directory (e.g `src/test/java`) exists in the current project module, Cover Plugin will add the tests there.
2. If no existing test source directory could be found for the current project module, Cover Plugin will add tests to `src/test/java` in the same module as the class for which tests are written (`project_root/module/src/test/java`).

**We recommend always explicitly creating a test source directory** `src/test/java` in the relevant module so that Cover Plugin knows where to put new test classes.

Cover Plugin does not add a duplicate test if exactly the same test already exists.

### Override Test Directory

If you have multiple test source directories set up for a module, you can use the `Override Test Directory` setting to ensure that Cover Plugin creates tests in your preferred directory - go to `Diffblue > Change Settings` and expand the `Diffblue Cover` settings menu on the left. Note that this is a project setting.

For example, you may have a Gradle configuration similar to the following:

```groovy
sourceSets {
    test {
        java {
            srcDir "src/test/java"
            srcDir "src/diffblueTest/java"
        }
    }
}
```

Use the `Override Test Directory` setting to make sure that Cover Plugin adds tests to the `src/diffblueTest/java` directory:

<figure><img src="/files/ckrhBJ4dQxbP2sW1sUzD" alt="" width="563"><figcaption></figcaption></figure>


---

# 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-plugin/cover-plugin-settings/test-directory.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.
