Android Testing Support Library
Continuous Integration
AWS Device Farm
Slide 3
Slide 3 text
Why is this hard?
Slide 4
Slide 4 text
Why is this hard?
Many devices
Slide 5
Slide 5 text
Why is this hard?
Many devices
Many options
Slide 6
Slide 6 text
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
Slide 7
Slide 7 text
Testing Fundamentals
ApplicationPackage
InstrumentationTestRunner
TestPackage
Test case classes
Instrumentation JUnit
Mock Objects
Slide 8
Slide 8 text
Testing Fundamentals
Tests
Run on the JVM
Local unit tests
Require Android
Instrumentation tests
app/src/test/java
app/src/androidTest/java
Slide 9
Slide 9 text
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
Slide 10
Slide 10 text
Testing Support Library
• JUnit Support
@RunWith(AndroidJUnit4.class)
• Access to instrumentation information (Context)
• Test filtering
@RequiresDevice, @SdkSuppress
@SmallTest, @MediumTest, @LargeTest
Slide 11
Slide 11 text
2015 Android Testing
/**
* A simple integration test which checks the validity of the DummyActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DummyBaseTest {
@Rule
public ActivityTestRule 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
}
}
Slide 12
Slide 12 text
AWS Device Farm
A step into
Slide 13
Slide 13 text
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
Slide 14
Slide 14 text
AWS Device Farm
Upload your app
Configure your tests
Select a device pool and configure your tests
Run
Slide 15
Slide 15 text
AWS Device Farm
• AWS Device Farm plugin for Jenkins
(August 2015)
• AWS Device Farm plugin for Android Studio
(October 2015)
Slide 16
Slide 16 text
AWS Device Farm
• Connect to the pre-prod or demo
• Select a relevant device pool
• Spoon integration
• Jenkins credentials
Slide 17
Slide 17 text
Continuous Integration
Getting around with
Slide 18
Slide 18 text
Continuous Integration for
Android applications
Automation
Ship reliable apps
Confidence