如何使用Gradle运行多个测试但不是所有的测试? [英] How to run more than one test but not all the tests in GEB using Gradle?
问题描述
我运行gradle从Windows命令行运行测试。我做单个测试的做法是:
I am running gradle to run the tests from Windows command line. What I do to run a single test is:
gradlew.bat chromeTest -DchromeTest.single=test1Spec
或所有测试:
or for all the tests:
gradlew.bat chromeTest
如果我尝试运行这样的两个测试类: p>
If I try to run only two test classes like this:
gradlew.bat chromeTest -DchromeTest=test1Spec,test2Spec--info
然后gradle开始运行所有的测试。
then gradle starts to run all the tests.
我需要的是:仅运行2或3个Groovy类。具体而言,既不是一个也不是全部。任何帮助将是非常有益的!对不起,再次重新发布这个问题。
What I need: is to run only 2 or 3 Groovy classes. To be specific, neither one nor all. Any help would be really beneficial! Sorry, for reposting this question again.
推荐答案
-DtestTaskName
支持通配符例如 Test * Spec
或 foo.bar。* Spec
,但仅限于单个模式。如果你需要支持多种模式,你必须实现自己的命令行参数(在最简单的情况下意味着读取一个系统属性)并使用它来配置 Test#include
或 Test#getFilter
。 (请参阅 Gradle Build Language中的 Test
)
-DtestTaskName
supports wildcards such as Test*Spec
or foo.bar.*Spec
, but is limited to a single pattern. If you need support for multiple patterns, you'll have to implement your own command line parameter (which in the simplest case means reading a system property) and use that to configure Test#include
or Test#getFilter
. (See Test
in the Gradle Build Language Reference for details.)
Gradle 1.10引入了 - tests
来代替 -DtestTaskName
,但同样只支持一种模式。
Gradle 1.10 introduced --tests
as a replacement for -DtestTaskName
, but again, only one pattern is supported.
这篇关于如何使用Gradle运行多个测试但不是所有的测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!