You are right that src/it
is intended to be used for integrations test of plugins. This is mentioned in the Standard Directory Layout.
The maven-failsafe-plugin
, by default, will look for your integration tests inside ${project.build.testSourceDirectory}
, which is the same as the maven-surefire-plugin
for unit tests. By default, this corresponds to src/test/java
. The integration tests are made distinct by following a naming convention:
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
which is different than the naming convention for unit-tests:
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*TestCase.java</include>
</includes>
So while they would reside in the same source folder (src/test/java
), the difference in names clearly distinguishes them. Also, this is the default set-up so no extra configuration would be needed.
That said, you can have other options:
- Place the integration tests inside a different source folder. This will require some configuration to make it work: you will need to use the
build-helper-maven-plugin:add-test-source
goal to add the custom folder as a test source folder.
- Use a different module (if you have a multi-module Maven project) that would only contain the integration tests.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…