mardi 31 octobre 2017

Surefire test configured for active profile no executed when "Test Package" in Netbeans

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:

  1. unit-tests: only executing unit test (.*Test.java)
  2. 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