Gradle run only one test suite

2019-06-17 01:40发布

问题:

I have multiple classes under tests using junit and gradle. When I run "gradle test", all my classes are tested. How can I run just one test file?

回答1:

You can run a single test file from the cli like this:

gradle test --tests org.gradle.SomeTest

You can also run just a particular test method in a similar way:

gradle test --tests org.gradle.SomeTest.someSpecificFeature


回答2:

You need to use test.single system property. Have a look at this article.