Selecting specific tests to run in gradle

折月煮酒 提交于 2019-12-03 12:14:49
Peter Niederwieser

By default, the test task runs all JUnit tests it can find, which includes any Spock tests. To make it run TestNG tests instead, configure the task as follows:

test {
    useTestNG()
}

If you have both JUnit and TestNG tests, you need two test tasks, one for each test framework.

To run a subset of tests, use the -Dtest.single system property. For more information, see the corresponding section in the Gradle User Guide.

$> gradle test -Dtest.single=YourTestClass

You may provide using the command line:

$> gradle test --tests org.somewhere.MyTestClass

Or even

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