The unit test files generated under the gradle multi-module project are in the wrong location.


The project has two modules,I generate unit tests for HomeService,but in demo-app 's test cases,How to solve it?

Hi @jamie

This could be due to your test resource folders marked incorrectly.
You can either directly mark the desired directory as the test directory by right clicking on the desired test directory > Mark directory > Test Sources Root (see below)

Alternatively, you can set this up for the project in the Project Structure settings, the Test Source Root should be src/test/java - to see this; click File > Project Structure > Modules > Sources

Let us know how this goes, or if you have any further questions don’t hesitate to ask

Kind regards,

Jane @ Diffblue

1 Like

dcd9e7a4b807b1e770f7a212e9bc724fc6eebd8f_2_690x466

@Jane_Walls Thanks! The method you said is very useful !

  1. First, the original folder is excluded from marking the root of the test resource.
  2. Then mark the right test directory as a test resource

But it is better to mark in the gradle configuration, see https://youtrack.jetbrains.com/issue/IDEA-151925#comment=27-2355076

Thanks @jamie for the feedback!
I’m glad you got this working.

Kind regards,
Jane @ Diffblue