Cover IntelliJ plugin test classes location
The tests created by Diffblue Cover will be placed in a location within the project according to the following:
- If a test source directory (
src/test/java) exists in the current project module, Diffblue Cover will add the tests there (
- 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 (
- 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 (
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
We recommend to always explicitly create a test source directory, in the relevant module or one of its dependent modules, so that Diffblue Cover knows where to put new test classes.
Please note that in the final case described above the created test class may not compile, as Diffblue Cover 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 to always explicitly create a test source directory in the module or one of its dependent modules such that Cover knows where to put new test classes.