gpt4 book ai didi

java - 如何使用 IntelliJ 对 POM.xml 中定义的特定类别运行 Junit 测试

转载 作者:行者123 更新时间:2023-11-30 06:30:04 25 4
gpt4 key购买 nike

我想知道使用 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:

enter image description here

您可以通过单击此窗口左上角的文件图标来保存任何此类配置,然后该配置将在运行菜单中可用,并且您可以even associate a keyboard short cut with it

更多信息in the docs .

关于java - 如何使用 IntelliJ 对 POM.xml 中定义的特定类别运行 Junit 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46345425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com