What's this?
This is the sample command to run specific Android Instrument test case coded by Espresso against Android app.
How?
Assume this the test code stored under app/src/androidTest/java/com/hoget/testCases/
.
sampletest.kt
package com.hoget.instrumenttest.testcases.accountTest
......
@RunWith(AndroidJUnit4::class)
class HogetAccountTest {
@Test
fun LoginLogoutTest() {
// test code in here
}
}
To run LoginLogoutTest()
method
$ ./gradlew connectedAndroidTest -P android.testInstrumentationRunnerArguments.class=com.hoget.instrumenttest.testcases.accountTest.HogetAccountTest#LoginLogoutTest;
or
$ ./gradlew connectedAndroidTest -P android.testInstrumentationRunnerArguments.class=com.hoget.instrumenttest.testcases.accountTest.HogetAccountTest.LoginLogoutTest;
So, the template for the command is like this:
$ ./gradlew connectedAndroidTest -P android.testInstrumentationRunnerArguments.class=<App's Test Package Name>.<Test Class Name>#<TestMethodName>;
To Run All of Espresso Test
Add --continue
option for prevent stop the test by fail of the test.
$ ./gradlew connectedAndroidTest --continue