【发布时间】:2018-07-20 08:41:15
【问题描述】:
使用 Gradle 及其对 JUnit 4 的支持,我可以使用 --tests 选项选择特定测试,如下所示:
$ ./gradlew test --tests de.mp.BarMT
此选项在使用 JUnit 5 Gradle 任务时无效。从命令行使用 test 任务时,它会被静默忽略。反正真正的工作是junitPlatformTest做的,不支持选项:
$ ./gradlew clean junitPlatformTest --tests de.mp.BarMT
…
Problem configuring task :junitPlatformTest from command line.
> Unknown command-line option '--tests'.
JUnit 5 插件是否支持选择特定测试?
【问题讨论】:
-
确实如此。我会说几乎是重复的(我保证我有真正的测试)。奇怪的是,它在创建问题时没有出现在搜索中。
-
原生 Gradle 支持即将到来。目前的计划是将其包含在 Gradle 4.6 中(参见github.com/gradle/gradle/pull/4116)