我想知道使用 IntelliJ 是否可以在选择特定 Junit 类别的视觉环境中运行所有测试。
此时如果执行:
mvn clean test
你执行快速测试,但如何使用IntelliJ选择慢或快?
pom.xml的片段
<profiles>
<profile>
<id>SlowTest</id>
<properties>
<testcase.groups>YOUR.PROJECT.test.categories.Slow</testcase.groups>
</properties>
</profile>
<profile>
<id>FastTest</id>
<properties>
<testcase.groups>YOUR.PROJECT.test.categories.Fast</testcase.groups>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
非常感谢
胡安·安东尼奥
最佳答案
您的个人资料将测试运行重点放在特定类别上。 IntelliJ 中的 JUnit 运行/调试配置还允许您将 JUnit 运行集中在特定类别上。
您可以从运行>编辑配置
访问此配置窗口
这是一个屏幕截图,显示了名为 SlowTests
的已保存配置,它运行具有以下类别的所有测试:com.stackoverflow.surefire.SlowTests
:
您可以通过单击此窗口左上角的文件图标来保存任何此类配置,然后该配置将在运行
菜单中可用,并且您可以even associate a keyboard short cut with it 。
更多信息in the docs .
关于java - 如何使用 IntelliJ 对 POM.xml 中定义的特定类别运行 Junit 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46345425/