Nital
Nital

Reputation: 6084

Integration tests not getting executed

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

Junit Tests Here:

webstore\src\test\java\com\istore\dao\AddressTest.java

Integration Tests Here:

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

Answers (3)

Nital
Nital

Reputation: 6084

Problem resolved after executing following command:

mvn failsafe:integration-test

Upvotes: 0

MariuszS
MariuszS

Reputation: 31567

The problem is suffix 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 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.

Maven Failsafe Plugin is for integration tests and uses suffix IT. To invoke integration tests with Failsafe Plugin use

mvn verify

References:

Upvotes: 2

Robert Scholte
Robert Scholte

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

Related Questions