martin
martin

Reputation: 111

mvn failsafe:integration-test

I am using maven 2 and integration test are in *IT.java files. When I run command mvn failsafe:integration-test integration test run fines. But when I run mvn integration-test it does not run my integration tests. How can I remove prefix failsafe: ?

In pom.xml I use:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.12</version>
    <executions>
        <execution>
        <phase>integration-test</phase>
        <goals>
            <goal>integration-test</goal>
            <goal>verify</goal>
        </goals>
        </execution>
    </executions>
</plugin>

UPDATE
I also tried following pom.xml setup and then mvn clean verify. I got only surefire report of JUnit tests. There are still missing JUnit integration test on console output.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.12</version>
    <executions>
        <execution>
            <id>failsafe-integration-tests</id>
            <phase>integration-test</phase>
            <goals>
                <goal>integration-test</goal>
            </goals>
        </execution>
        <execution>
            <id>failsafe-verify</id>
            <phase>verify</phase>
            <goals>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Now I tied disable unit tests by plugin settings:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <!-- Disable unit tests -->
        <skip>true</skip>
    </configuration>
</plugin>

Wen I run mvn clean verify my failsafe integration test runs! But why it does not works together with surefire unit test? Any idea?

Upvotes: 0

Views: 1498

Answers (1)

diegomtassis
diegomtassis

Reputation: 3667

Do you have failing unit tests?

When you do mvn failsafe:integration-test you are explictly invoking failsafe, but when you do mvn integration-test you are invoking the phase, so unit tests are executed and, in case a unit tests fails, the integration phase is never reached. That would explain why mvn clean verify works when you skip by configuration the execution of the unit tests.

Upvotes: 2

Related Questions