lundi 18 mai 2020

Automatically creating tests in intellij idea with multiple test directories

in my project I decided to split unit and integration tests into separate packages and my project structure basically looks like this:

├── main
│   ├── java
│   │   └── ...
│   └── resources
│       └── ...
├── test
│   └── java
│       └── ...
└── test-integration
    ├── java
    │   └── ...
    └── resources
        └── ...

It is a good choice to easily separate two kinds of tests, and intellij refactoring works fine with this solution. Everything is set up correctly, both test directories are marked as test sources roots using gradle's idea plugin, gradle recognizes both source sets, I have two separate tasks created to run each test suite etc. The only problem I have is that intellij automatic create test wizard doesn't differentiate between these two directories, and the only thing I can modify is the Destination package classpath, which obviously is identical for both test directories, and there is no option to choose which one I'd like to use.

Is there any way to configure IDEA to give me an option to choose between directories the test will be generated in? Or maybe some kind of gradle plugin that will move test files based on their suffix (e.g. *Test classes go to test directory, and *IT classes go to test-integration directory)? Or maybe there simply is no such option :D

IDEA create test wizard

Aucun commentaire:

Enregistrer un commentaire