[英]How to make integration tests and unit tests run separately through maven?
[英]Run unit tests and IT tests separately while launching pre-integration and post-integration
我希望能夠分別運行單元測試和集成測試。 我嘗試使用故障保護的不同配置,並在使用故障保護或在命令行中進行驗證時驗證它們是否可以工作(mvn failsafe:test,mvn surefire:verify等),但它不會啟動我的pre-集成和集成后階段,這是我進行集成測試所需的。
這是我的POM:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.nulogix.billing.App</mainClass>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<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>3.0.0-M3</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
您不能單獨運行一個階段或一堆階段。
您可以在命令行上進行所有插件調用,也可以從開始到集成后運行整個構建。
另一方面,如果您的主要目標是在構建過程中跳過某些插件,則可以通過skip
參數或配置文件來實現。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.