0
votes

Maven build process finishes with success even though that integration test fails. Why does it happen? I use Maven failsafe plugin Here is the output of the log:

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 4.235 sec <<< FA
ILURE! - in Case1IT
testCase(Case1IT)  Time elapsed: 4.235 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<Hello java world![!]> but was:<Hello java
world![]>
    at Case1IT.testCase(Case1IT.java:36)
Results :

Failed tests:
Case1IT.testCase:36 expected:<Hello java world![!]> but was:<Hello java world!
[]>

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[INFO]
[INFO] --- jetty-maven-plugin:9.2.2.v20140723:stop (stop-jetty) @ webcont ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Multi Chapter Simple Parent Project ................ SUCCESS [  0.000 s]
[INFO] hellojavaworld ..................................... SUCCESS [  7.422 s]
[INFO] webcont ............................................ SUCCESS [ 13.313 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Generally it is false.

There is the pom.xml source:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.19</version>
            <executions>
                <execution>
                    <id>integration-tests</id>
                    <goals>
                        <goal>integration-test</goal>
                    </goals>
                </execution>
            </executions>
</plugin>
<plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.2.2.v20140723</version>
            <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
                <stopPort>9966</stopPort>
                <stopKey>abc</stopKey>
                <webApp>
                    <contextPath>/hellojavaworld</contextPath>           
                </webApp>    
            </configuration>
            <executions>
                <execution>
                    <id>start-jetty</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>run-war</goal>
                    </goals>
                    <configuration>
                        <daemon>true</daemon>
                        <scanIntervalSeconds>0</scanIntervalSeconds>
                    </configuration>
                </execution>
                <execution>
                    <id>stop-jetty</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
1

1 Answers

0
votes

Based on the documentation you should use it like this:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.19</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>