Gradle: how to list all "given tests"
I am trying the following code:
roroco@roroco ~/Dropbox/jvs/ro-idea $ gradle test --tests "ro.idea.ToggleTest.testIsAd"
:ro:compileJava UP-TO-DATE
:ro:processResources UP-TO-DATE
:ro:classes UP-TO-DATE
:ro:jar
:compileJava
:processResources UP-TO-DATE
:classes
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
:ro:compileTestJava UP-TO-DATE
:ro:processTestResources UP-TO-DATE
:ro:testClasses UP-TO-DATE
:ro:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ro:test'.
> No tests found for given includes: [ro.idea.ToggleTest.testIsAd]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Output result: "No tests found for given inclusions", my question is how to list all "specified tests" and how to specify "specified tests"
this is> my old question
I am not sure if the list of all given tests is executed until I believe it is known until the test is done.
What could you add to your build.gradle
file:
test {
beforeTest { descriptor ->
logger.lifecycle("Running test: ${descriptor}")
}
}
Then if you go:
gradle clean test
It will run all tests, but it will also print the test descriptor before it executes a command method(className)
that looks like this:
:test
Running test: test testC(org.gradle.MySecondTest)
Running test: test testD(org.gradle.MySecondTest)
Running test: test testA(org.gradle.MyFirstTest)
Running test: test testB(org.gradle.MyFirstTest)
Alternatively, you can simply run the previous command without changing the file build.gradle
and look at your file build/reports/tests/index.html
which will show all tests.
So, you can specify one test with:
gradle clean test --tests "org.gradle.MyFirstTest.testA"
Or all tests in the class:
gradle clean test --tests "org.gradle.MyFirstTest"
Or all tests in a package:
gradle clean test --tests "org.gradle.*"