Reputation: 6084
I have some junit tests and htmlunit integration tests in one of my maven project. The problem is that my integration tests are not getting executed when I run
mvn clean test
webstore\src\test\java\com\istore\dao\AddressTest.java
webstore\src\test\java\com\istore\presentation\htmlunit\PageTests.java
How does mvn determines that AddressTest.java should execute and other one should not?
Upvotes: 3
Views: 503
Reputation: 6084
Problem resolved after executing following command:
mvn failsafe:integration-test
Upvotes: 0
Reputation: 31567
Tests
, should be Test
in your PageTests.java
!By default, the Surefire Plugin will automatically include all test classes with the following wildcard patterns:
**/Test*.java
- includes all of its subdirectories and all java filenames that start withTest
.
**/*Test.java
- includes all of its subdirectories and all java filenames that end withTest
.
**/*TestCase.java
- includes all of its subdirectories and all java filenames that end withTestCase
.
Maven Failsafe Plugin is for integration tests and uses suffix IT
. To invoke integration tests with Failsafe Plugin use
mvn verify
References:
Upvotes: 2
Reputation: 12335
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#includes describes the expected filepatterns.
btw, if you are talking about integration tests, have a look at the maven-failsafe-plugin. It uses *IT.java as file pattern
Upvotes: 3