Gradle: How to run instrumentation test for class

Adam Styrc picture Adam Styrc · Sep 16, 2015 · Viewed 12.1k times · Source

I'm running instrumentation test in Android Studio with Run Configuration defined as below (don't mind warning): enter image description here

So this is invoking test suit for a specific class. How can I achieve this with command line, I guess using ./gradlew command ?

Answer

rciovati picture rciovati · Sep 16, 2015

As stated in the AndroidTestingBlueprint you can use the android.testInstrumentationRunnerArguments.class property:

./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.android.testing.blueprint.ui.espresso.EspressoTest