UT = Unit Tests IT = Integration Tests. All my Integration test classes are annotated with @Category(IntegrationTest.class)
My goal is:
mvn clean ins
The solution is this:
org.apache.maven.plugins
maven-surefire-plugin
2.19.1
org.apache.maven.plugins
maven-failsafe-plugin
2.19.1
org.apache.maven.plugins
maven-compiler-plugin
3.6.1
1.7
1.7
org.apache.maven.plugins
maven-failsafe-plugin
org.apache.maven.plugins
maven-surefire-plugin
${surefire.skip}
integration-test
verify
junit
junit
4.12
test
This will let you control which is executed.
running UT and IT's:
mvn clean verify
running IT's but NOT UT's
mvn clean verify -Dsurefire.skip=true
running UT but not IT's:
mvn clean verify -DskipITs=true
You need to follow the naming conventions of the plugins which makes life easier.
Naming conventions for maven-surefire-plugin (unit tests). Naming conventions for maven-failsafe-plugin (integration tests).