Knowledge Base > IntelliJ Plugin > Test classes location

Test classes location

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

  1. If a test source directory (src/test/java) exists in the current project module, Diffblue Cover will add the tests there (project_root/module_for_MUT/src/test/java, where MUT = method-under-test).
  2. Otherwise, it will explore the modules in the project which depend on the module for which a test has been written. If any dependent module contains a test source directory, Diffblue Cover will put the generated test classes there (project_root/dependent_module/src/test/java).
  3. If no existing test source directory could be found in any dependent module, Diffblue Cover will generate a new test source directory in the same module as the class for which tests are generated (project_root/module_for_MUT/src/test/java).

Exception: The only exception to point 3 above is if the module is named in a fashion that suggests a different project hierarchy (e.g. the path to the MUT contains main), in which case the tests will be copied to project_root/src/test/java. In this situation it is possible that the created test classes will not compile, as the existing root module may not have a dependency on the module in which the MUT is located.

We recommend always explicitly creating a test source directory, in the relevant module or one of its dependent modules, so that the Diffblue Cover IntelliJ plugin knows where to put new test classes.

Please note that in the final case described above the created test class may not compile, as the Diffblue Cover plugin for IntelliJ does not create new modules and the existing root module may not have a dependency on the module in which the class under test is located. We recommend always explicitly creating a test source directory in the module or one of its dependent modules so that the Diffblue CoverĀ  plugin for IntelliJ knows where to put new test classes.