I'm trying to run a single integration tests using gradle's -Dtest.single
flag. I have added another source set, src/integrationTest
and put the tests in there. I have an integration test task
task integrationTests(type: Test) {
dependsOn 'assemble', 'integrationTestClasses'
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
This runs fine, but if I try to run a single test it tells me it cannot find a matching test. I don't want to have to run every integration test each time I am writing a new one. Is there a way to do this?
The correct syntax is:
gradle testTaskName -DtestTaskName.single=...
In this case:
gradle integrationTest -DintegrationTest.single=...
Since Gradle 1.10 you can write:
Read more here http://www.gradle.org/docs/1.10/release-notes#executing-specific-tests-from-the-command-line