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:

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:

Last updated