Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Small dive into Android Testing

A Small dive into Android Testing

AWS device farm, Espresso, UiAutomator, Android July 2015

Renaud MATHIEU

August 03, 2015
Tweet

More Decks by Renaud MATHIEU

Other Decks in Technology

Transcript

  1. Android Test Strategy Harder, Better, Faster, Stronger • Strive for

    high coverage • Make it easy to get started and test • Run tests as much as possible • Get immediate test results • Understand and fix test results
  2. Testing Fundamentals Tests Run on the JVM Local unit tests

    Require Android Instrumentation tests app/src/test/java app/src/androidTest/java
  3. Testing Support Library AndroidJUnitRunner JUnit 4-compatible test runner for Android

    Espresso Suitable for functional UI testing within an app UI Automator Suitable for cross-app functional UI testing across system and installed apps
  4. Testing Support Library • JUnit Support @RunWith(AndroidJUnit4.class) • Access to

    instrumentation information (Context) • Test filtering @RequiresDevice, @SdkSuppress @SmallTest, @MediumTest, @LargeTest
  5. 2015 Android Testing /**
 * A simple integration test which

    checks the validity of the DummyActivity
 */
 @RunWith(AndroidJUnit4.class)
 @LargeTest
 public class DummyBaseTest {
 
 @Rule
 public ActivityTestRule<DummyActivity> mActivityRule = new ActivityTestRule<>(DummyActivity.class);
 
 @Before
 public void setup() {
 // You might want to do something else here
 }
 
 @Test
 public void testContext() {
 assertThat(mActivityRule.getContext(), notNullValue());
 }
 
 @After
 public void teardown() {
 // You might want to do something else here
 } }
  6. AWS Device Farm • Service that enables you to test

    your Android apps on real phones and tablets • Provide test reports containing high-level results, low-level logs, screenshot and performance data • Testing is performed in parallel
  7. AWS Device Farm Upload your app Configure your tests Select

    a device pool and configure your tests Run
  8. AWS Device Farm • AWS Device Farm plugin for Jenkins

    
 (August 2015) • AWS Device Farm plugin for Android Studio (October 2015)
  9. AWS Device Farm • Connect to the pre-prod or demo

    • Select a relevant device pool • Spoon integration • Jenkins credentials
  10. Continuous Integration for Android applications • Custom build logic •

    Manage dependencies, build variants, signing, testing Android Gradle plugin