Reputation: 5518
I have a simple Maven project, and have a test class called IntegrationTest.
When I execute: mvn surefire:test
, the test gets executed. However, the same test is completely ignored when I execute a standard Maven build: mvn package
Am I missing anything?
ADDITIONAL INFORMATION (May 24th):
I tried to follow advice by @dragan-bozanovic, but inexplicably, without any changes, my tests are not called under any condition anymore. I'm stumped. I committed a project here: https://github.com/javalite/activeweb The tests are not invoked in this module: https://github.com/javalite/activeweb/tree/master/activeweb-lessc-integration-test
I tried JUnit 3 style, JUnit4 style, changed names of classes, moved to different package - no avail. When I execute mvn install
, I do not see that surefire plugin is called. When I call it explicitly: mvn surefire:test
, it puts out a message: No tests to run
Any help is much appreciated!
Upvotes: 0
Views: 1762
Reputation: 5518
The real reason for surefire plugin not be able to find tests, is because my pom.xml
file had <packaging>pom</packaging>
. As soon as I switched it to <packaging>jar</packaging>
, surefire plugin picked up the tests. In any case, Dragan - thank you for pushing me in the right direction!
Upvotes: 3
Reputation: 23562
According to Maven default build lifecycle, integration tests come after the package phase. It may be that a naming convention is used here, because your test class name ends with IntegrationTest
.
If this is really not an integration test, then rename the class accordingly. If it is, then it seems that Maven behaves as described.
EDIT
It may also be that a wrong combination of versions of surefire, JUnit and JUnit-style of tests is used. More info about this can be found here.
Upvotes: 1