我又要回到Java世界了...
我正在学习教程(https://spring.io/guides/gs/spring-boot/),当我使用 运行测试时mvn test,没有任何测试HelloControllerIT正在运行。似乎只考虑以“Test”结尾的类。我确信有一种方法可以添加其他模式,以便将HelloControllerIT其包含在内。
在哪里可以找到有关此主题的更多信息?
这看起来很简单,所以我可能没有在搜索中使用正确的关键字(例如,'java spring boot test pattern')。
更新
感谢 Yug Singh 的回答,我能够想出一个我感觉很好的解决方案。我将此添加到我的pom.xml文件中,现在我可以运行与集成测试分开的单元测试。
我忘记了简介...
+ <profiles>
+ <profile>
+ <id>integration</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*IT.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
运行单元测试
mvn test
运行集成测试
mvn test -Pintegration
呼啦一阵风
相关分类