This answer describes a way to run a specific espresso test:
./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.my.tests.MyTest
But I would like to create a gradle task to run it like this:
./gradlew app:runMyTest
But when I try to define runMyTest
task:
task runMyTest {
finalizedBy connectedDAT
project.extensions.add("android.testInstrumentationRunnerArguments.class", "com.my.tests.MyTest")
}
and run it, all my tests run, not only the specified one.