read

For JUnit 3

For AWS Device farm you need to upload both apk, your app apk and your tests apk.

  1. Run assemble task for AndroidTest.
# ./gradlew assembleDebugAndroidTest

NOTE: Debug is the buildType.

  1. Check generated apks:
    • app.apk: app/build/output/apk/app-debug.apk.
    • test.apk: app/build/output/apk/app-debug-androidTest-unaligned.apk.

For JUnit 4 and Testing Support Library support

Oficial JUnit tags are not supported so you need to format names with:

  1. Your test class should end with “Tests”.
  2. 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.

Blog Logo

Daniel Gomez Rico


Published

Image

MakinGIANTS

The findings and tips records of an Android-iOS-TheWholeShabang group

Back to Overview