Açıklaması şöyle.
maven-failsafe-plugin is designed for running integration tests, and decouples failing the build if there are test failures from actually running the tests.
Hangi Testleri Koşturur?
Açıklaması şöyle. Yani test dosyasının ismine bakarak seçer.
By default, the Failsafe Plugin will automatically include all test classes with the following wildcard patterns:"**/IT*.java" - includes all of its subdirectories and all Java filenames that start with "IT"."**/*IT.java" - includes all of its subdirectories and all Java filenames that end with "IT"."**/*ITCase.java" - includes all of its subdirectories and all Java filenames that end with "ITCase".
Açıklaması şöyle
The maven lifecycle for integration test is made of 4 different phases:- pre-integration-test: used to set up the IT environment- integration-test: used for running the ITs
- post-integration-test: used to tearing down the IT environment
- verify: used to check the result of the ITs aa
The plugin runs during the integration-test and verify phases. Having said that, you can run your ITs by running mvn verify.
surefire vs failsafe
surefire mvn test ile çalıştırılır
failsafe mvn verify ile çalıştırılır
1. Eğer surefire çalışsın ama failsafe çalışmasın istersek şöyle yaparız
mvn install -DskipITs=true
2. Eğer şöyle yaparsak hem surefire hem de failsafe çalışmaz
mvn install -DskipTests
3. Sadece failsafe çalışsın ama surefire çalışmasın istersek şöyle yaparız
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>${skip.ut}</skipTests> </configuration> </plugin> </plugins> </build>
Daha sonra şöyle yaparız
mvn -Dskip.ut=true verify
Örnek
Şöyle yaparız.
<!-- runs tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/TomcatPingTest.java</include>
</includes>
</configuration>
</plugin>
Hiç yorum yok:
Yorum Gönder