I try 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.
The output show "No tests found for given includes", my question is: how to list all "given tests" and how to specify "given tests"
this is my old question
I am unsure about list all the given tests prior to executing since I don't believe this is known until the testing actually executes.
What you could so is add this 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 will also print out the test descriptor before it executes providing the method(className)
which will look like so:
: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 just run the previous command without the build.gradle
file change and look at your build/reports/tests/index.html
file which will show all tests run.
So then you could specify a single test with:
gradle clean test --tests "org.gradle.MyFirstTest.testA"
Or all tests in a class:
gradle clean test --tests "org.gradle.MyFirstTest"
Or all tests in a package:
gradle clean test --tests "org.gradle.*"
You can also use:
test {
testLogging {
events "passed", "skipped", "failed"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With