问题
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
If I try to run only two test classes like this:
gradlew.bat chromeTest -DchromeTest=test1Spec,test2Spec--info
then gradle starts to run all the tests.
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.
回答1:
-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 introduced --tests
as a replacement for -DtestTaskName
, but again, only one pattern is supported.
来源:https://stackoverflow.com/questions/22433908/how-to-run-more-than-one-test-but-not-all-the-tests-in-geb-using-gradle