I want to add some integration tests to a spring boot application. The resulting structure would be this
MyProject
├── myapp.iml
├── pom.xml
└── src
├── integration-test (integration test sources root)
│ ├── java
│ │ └── com
│ │ └── mysite
│ │ └── myapp
│ │ └── AppTestIT.java
│ └── integration-test.iml
│
├── main (sources root)
│ ├── java
│ │ └── com
│ │ └── mysite
│ │ └── myapp
│ │ └── App.java
│ └── main.iml
│
└── test (test sources root)
├── java
│ └── com
│ └── mysite
│ └── myapp
│ └── AppTest.java
└── test.iml
Is this possible? I'm doing this in Intellij 15 Ultimate
and it doesn't recognise the package as com.mysite.myapp
in my integration tests. Instead it recognises this java.com.mysite.myapp
. It doesn't follow the convention as it does with main
and test
, which is expected. Is there a way to add more folders alongside main
and test
and follow the same conventions (java folder not taken into consideration for the package declaration)?
If not, what is the best practice regarding the project structure when including integration tests? Should they be in the test folder? I would like to avoid that if possible.
This should be as easy as right clicking the integration-test
folder, scrolling down to "Mark Directory As..." and selecting "Test Sources Root".
Note that if you have other developers working on this project they will have to do the same thing (unless you share IDEA files).