androidtestinggradleandroid-gradle-pluginandroid-testing

Gradle: How to run instrumentation test for class


I'm running an instrumentation test in Android Studio with Run Configuration defined as below (ignore the warning): enter image description here

So this is invoking the test suite for a specific class.

How can I achieve this with the command line?

I guess using ./gradlew command?


Solution

  • 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