排除在IntellIJ中运行的测试 [英] Excluding tests from being run in IntellIJ
问题描述
在IntelliJ IDEA Ultimate中排除某些测试是不是可以吗?我想在IntelliJ中运行单元测试,但不包括集成测试。我用 * IT.java
命名集成测试,因此Maven故障安全插件可以从单元测试中单独运行它们。
Is it no option to exclude some tests in IntelliJ IDEA Ultimate? I want to run unit tests in IntelliJ but exclude the integration tests. I name the integration tests with *IT.java
so the Maven failsafe plugin can run them seperatly from the unit tests.
推荐答案
在 JUnit
运行配置中将测试种类
设置为模式,将以下正则表达式指定为模式:
In the JUnit
Run configuration set the Test kind
to Pattern, specify the following regular expression as the pattern:
^(?!.*IT$).*$
它与班级名称匹配,因此您无需匹配 .java
扩展名。如果类名以<$ h $ c> IT 结尾,使用负面预测。
It matches against the class name, so you don't need to match .java
extension. Regular expression will not match if the class name ends with IT
using the negative lookahead.
这篇关于排除在IntellIJ中运行的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!