read
For JUnit 3
For AWS Device farm you need to upload both apk, your app apk and your tests apk.
- Run assemble task for AndroidTest.
# ./gradlew assembleDebugAndroidTest
NOTE: Debug is the buildType.
- Check generated apks:
- app.apk:
app/build/output/apk/app-debug.apk
. - test.apk:
app/build/output/apk/app-debug-androidTest-unaligned.apk
.
- app.apk:
For JUnit 4 and Testing Support Library support
Oficial JUnit tags are not supported so you need to format names with:
- Your test class should end with “Tests”.
- Your tests method should start wiht “test”.
Example:
@RunWith(AndroidJUnit4.class)
@LargeTest
public class LoginActivityTests {
@Rule
public ActivityTestRule<LoginActivity> mActivityRule = new ActivityTestRule(LoginActivity.class);
@Before
public void setup() {
}
@Test
public void testShowsRightDataOnCreate() {
org.junit.Assert.assertEquals("asd", "asd");
}
}
Links
Tested and working.