Patrick Marchwiak
Patrick Marchwiak

Reputation: 1082

Is "mvn install" supposed to fail when an integration test does?

I have a maven project that has an integration test named, say, "BlahITCase". This test is currently failing and in turn causing "mvn install" to fail. Is this the expected behavior? My understanding was that unit test (surefire) failures will cause the build to fail but integration test (using failsafe) failures will not.

I have the following in the build plugins section of my pom:

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

Commenting out the verify goal seems to give me the desired behavior.

Upvotes: 3

Views: 946

Answers (1)

Adam Schreiner
Adam Schreiner

Reputation: 524

The failsafe:integration-test goal will run when verify lifecycle starts and then failsafe:verify which is failing the build. failsafe:verify is bound to verify lifecycle by default which will result in a failure and stop from proceeding to install

http://maven.apache.org/plugins/maven-failsafe-plugin/verify-mojo.html

You could try to tell failsafe plugin to ignore failed tests if absolutely required but a failed test case should be taken to mean the package is not ready for deployment.

http://maven.apache.org/plugins/maven-failsafe-plugin/verify-mojo.html#testFailureIgnore

Upvotes: 1

Related Questions