2015-11-25 6 views
6

Ich habe ein Multi-Modul-Projekt und ich habe ausfallsicher in der Wurzel pom wie folgt definiert:Warum führt "mvn verify" nicht meine Integrationstests durch?

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-failsafe-plugin</artifactId> 
    <version>2.19</version> 
    <configuration> 
     <includes> 
      <include>**/*IntegrationTest.java</include> 
      <include>**/*JourneyTest.java</include> 
      <include>**/*CucumberFeatureTest.java</include> 
     </includes> 
    </configuration> 
    <executions> 
     <execution> 
      <goals> 
       <goal>integration-test</goal> 
       <goal>verify</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 
<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.19</version> 
    <configuration> 
     <excludes> 
      <exclude>**/*IntegrationTest.java</exclude> 
      <exclude>**/*JourneyTest.java</exclude> 
      <exclude>**/*CucumberFeatureTest.java</exclude> 
     </excludes> 
    </configuration> 
</plugin> 

Failsafe nirgendwo sonst in meinem anderen Poms definiert ist. Wenn ich mvn verify ausführen, überspringt es Integrationstests (es führt Komponententests). Aber wenn ich mvn test-compile failsafe:integration-test ausführen, führt es Integrationstests aus.

Ich bin unter der Annahme, dass Failsafe in beiden dieser Situationen ausgeführt werden soll. Warum läuft es nicht, wenn ich mvn verify eintippe?

UPDATE: habe gerade bemerkt, dass dieser um diese Tags gewickelt war:

wie diese
<build> 
    <pluginManagement> <!-- oops --> 
     <plugins> 
      <plugin> 

ich die Ursache, aber ich bin nicht sicher, warum Einheit Tests immer noch laufen, wie Sie fühlen würde, erklärt erwarten Sie mit mvn verify und mvn test. Warum funktioniert todsichere Arbeit in dieser Hinsicht anders als fehlersicher?

+0

ich todsichere glauben ist im Standard POM enthalten, aber Failsafe ist es nicht. – chrylis

Antwort

5

Sie müssen das Integrationstestziel von fail safe mit der Überprüfungsphase von maven verbinden.

<plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-failsafe-plugin</artifactId> 
     <version>2.19</version> 
     <configuration> 
      <includes> 
       <include>**/*IntegrationTest.java</include> 
       <include>**/*JourneyTest.java</include> 
       <include>**/*CucumberFeatureTest.java</include> 
      </includes> 
     </configuration> 
     <executions> 
      <execution> 
      <goals> 
       <goal>integration-test</goal> 
       <goal>verify</goal> 
      </goals> 
      </execution> 
     </executions> 
    </plugin> 
+0

Diese Änderung hatte keinen Einfluss auf das Ergebnis. Ich werde die ursprüngliche Frage aktualisieren, um diese zu beinhalten –

+0

Ja, die Bindung des Failsafe-Plugins an die Ausführung ist die richtige Lösung. Leider wird, wie bei vielen Maven-Dokumenten, nicht genug darauf hingewiesen. Dieses Setup ist in den [offiziellen Dokumenten des Failsafe-Plugins] dokumentiert (https://maven.apache.org/surefire/maven-failsafe-plugin/usage.html). – rdguam

0
To activate plugin for IntegrationTest, 
add declaration maven-surefire-plugin at plugins/plugin: 

    <plugins> 
      ... 
      ... 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
      </plugin> 
    </plugins> 
</build> 
Verwandte Themen