I'm running instrumentation test in Android Studio with Run Configuration defined as below (don't mind warning):
So this is invoking test suit for a specific class. How can I achieve this with command line, I guess using ./gradlew command ?
Run Gradle testsIn your Gradle project, in the editor, create or select a test to run. From the context menu, select Run <test name>. icon in the left gutter. If you selected the Choose per test option, IntelliJ IDEA displays both Gradle and JUnit test runners for each test in the editor.
In summary, an instrumentation test provides a special test execution environment as launched via the am instrument command, where the targeted application process is restarted and initialized with basic application context, and an instrumentation thread is started inside the application process VM.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With