Reputation: 809
We got following situation: We have unit and integration tests. Unit test classes end with Test
and integration tests end with ITest
. To execute only unit tests at Maven build we use following configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*ITest.java</exclude>
</excludes>
</configuration>
</plugin>
That's working in Maven build, but when I'm executing tests in Eclipse IDE via context menu > Run as > JUnit test it ignores these excludes and tests with ITest
at the end fail.
Is there a way to configure (in POM) that Eclipse follows maven-surefire-plugin configuration?
Upvotes: 0
Views: 1467
Reputation: 1638
Run as > JUnit test does not know about your pom.xml
.
But if you place your unit tests and integration tests in different directories (the Maven convention suggests src/test/java
and src/it/java
), then you can use Eclipse’s ability to run all tests in a package or source folder; simply click on the integration-test source folder and select Run as > JUnit test from its context menu.
Upvotes: 1