Search code examples
androidtestingrobotiumandroid-testing

How can I run a single instrumentation test with Gradle Android


I'm trying to run the tests with this line... but this launches all tests:

./gradlew -DconnectedAndroidTest.single=LandingActivityTests connectedAndroidTest

How can I launch a single test?


Solution

  • you can run the single android test in two steps:

    1. ./gradlew installDebugAndroidTest
    2. adb shell am instrument -w -e class com.example.MyInstrumentationTest#testFoo com.example.test/android.support.test.runner.AndroidJUnitRunner
      https://developer.android.com/tools/testing/testing_otheride.html