Reputation: 6312
I have a question regarding maven.
I have got Unit Tests which have file name ending with *Test and integration test whose file name ends with *IT.
My understanding is that surefire will run the unit test and failsafe will run the integration test.
When I run: mvn clean install
Both unit test and integration tests are run.
When I run:
mvn verify
Both of these tests are run too.
Is there anyway I can configure maven so that when I use: mvn clean install, only the unit tests are run. And when I use mvn verify, only integration tests are run?
My build section of POM is as follows:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>failsafe-maven-plugin</artifactId>
<version>2.4.3-alpha-1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
Many thanks
Upvotes: 3
Views: 2515
Reputation: 1465
I have created a GitHub repository where you can see a possible Setup with maven. i post this here because i want to share my idee about this setup with others and i think this could be found when someone search about testing with maven on SO
The Repository contains a fully functional setup.
GitHub Repository: https://github.com/StefanHeimberg/maven3-unit_integration_systemtest-setup
Upvotes: 0