How to run more than one test but not all the tests in GEB using Gradle?

旧街凉风 提交于 2019-12-10 12:13:42

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!