Thursday, April 30, 2015

Maven Unit and Integration testing

The surefire plugin automatically includes all test classes with the following wildcard patterns:

"**/Test*.java" - includes all of its subdirectories and all Java filenames that start with "Test".
"**/*Test.java" - includes all of its subdirectories and all Java filenames that end with "Test".
"**/*TestCase.java" - includes all of its subdirectories and all Java filenames that end with "TestCase".

The the failsafe plugin automatically includes all test classes with the following wildcard patterns:

"**/IT*.java" - includes all of its subdirectories and all Java filenames that start with "IT".
"**/*IT.java" - includes all of its subdirectories and all Java filenames that end with "IT".
"**/*ITCase.java" - includes all of its subdirectories and all Java filenames that end with "ITCase".

To run unit tests, run mvn clean test

To run integration tests, run mvn clean verify