My project contain unit and integration tests. As of the nature of integration tests, they take notable longer as a unit test, which is why I not want to execute them every time. Therefor I've created two maven profiles:
- unit-tests: only executing unit test (
.*Test.java
) - all-tests: executing all tests including integration tests (
.*IT.java
)
In my pom.xml
, this configuration looks like this:
<profile>
<id>unit-tests</id>
</profile>
<profile>
<id>all-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
When testing (Hitting Test
on the project root context menu in Netbeans) or building the whole project, the test execution happens as I expect for each profile.
If I select a single package and run Test Package
, only the unit test are executed, even if the current active profile is all-tests
. Why is that?
Aucun commentaire:
Enregistrer un commentaire