Unit tests are fast, and integration tests are slow. Unit tests are also executed more frequently than integration tests. Tests ending with "*IT" are automatically executed by the failsafe plugin:
Unit tests ending with "*Test" are executed by the standard surefire plugin
<dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.8.1</version> <scope>test</scope> </dependency>
Now you can execute all unit tests with
mvn install(or test) and integration tests with
mvn failsafe:integration-tests. You will get immediate feedback after the execution of unit tests. The integration tests will be executed afterwards (in a separate Jenkins job). [All x-ray unit tests are separated this way in separate Jenkins jobs. See page 131 "Build and Deployment" and page 136 "Continuous Integration and QA" in Real World Java EE Night Hacks--Dissecting the Business Tier.]
NEW workshop: Building HTML 5 Applications Without Frameworks, Full week in December 2016: from Java EE 7 Bootstrap, Effective, Architectures over Testing to Microservices
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.