mardi 28 juin 2016

Maven FailSafe Plugin runs both integration and unit tests

I'm using the Surefire plugin and Failsafe plugin for unit tests and integration tests, respectively. But when I run mvn integration-test it runs both unit and integration tests, and when I run mvn failsafe:integration-test no tests are run.

My pom.xml for the plugins looks as follows

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <excludedGroups>my.project.inittest.IntegrationTest</excludedGroups>
    </configuration>
</plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.19.1</version>
    <executions>
        <execution>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
            <configuration>
                <includes>
                    <include>**/*.class</include>
                </includes>
            </configuration>
        </execution>
    </executions>
    <configuration>
        <groups>my.project.inittest.IntegrationTest</groups>
    </configuration>
</plugin>

And my tests are packaged as:

test
    java
        my.project
            inittest
                IntegrationTest1.java
            service
                ServiceUnitTest1.java
            UnitTest1.java

How do I get it to run only integration tests?

Aucun commentaire:

Enregistrer un commentaire