【发布时间】:2019-08-29 14:04:17
【问题描述】:
我希望能够分别运行单元测试和集成测试。我已经尝试使用不同的故障安全配置并验证哪些确实有效,但是当使用故障安全或在命令行中验证时(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>
【问题讨论】:
-
使用 Spring Boot 运行集成测试需要什么样的预集成测试部分?
标签: java maven unit-testing spring-boot integration-testing