2. about me
• Android Engineer @ Groupon
• Lead Engineer Android @ ebay Kleinanzeigen
• Team Lead Mobile @ Cortado
• C++ Developer @ PSI AG
• Started career as developer @ Alcatel
• Articles in: android360, mobile Technology, Java Magazin
• Speaker: DroidCon.de/nl, CONFESS, Blackberry DevCon
Believer in Testing
3. Sources: Internal Data; iTunes ranking for US stores available here - https://itunes.apple.com/WebObjects/
MZStore.woa/wa/viewFeature?id=500873243&mt=8&v0=www-itunes25Bcountdown-appstore
Nearly 70 million people worldwide
have downloaded our mobile app to
date; 9 million in Q4 2013.
One of the 25 most downloaded
free apps of all time
Nearly 50% of our global transactions
completed on a mobile device in
December 2013
a mobile company
Our mobile app is available in 43 countries
4. Android Testing?
Android Firewall by Uncalno, CC BY 2.0 flickr.com/photos/uncalno/8538679708
Robotium
Appium
Calabash
Robolectric
Espresso
Cloud
Crowd
Real Device?
uiautomator
monkeyrunner
Emulator
Selenium?
InstrumentationTest
5. Rockstar Testing?
• Fast! Faster!
• Reliable!
• Scalable!
Acrassicau 6 by Bruce Martin, CC BY 2.0, https://www.flickr.com/photos/shotbydarko/4692892946/
7. Android Activity Tests
• JUnit3 Tests
• Android Project (android application)
• Tight coupling to app under test (project needed)
• Direct access to activities (find element by id)
8. Android Activity Tests
public class MyActivityTest extends
ActivityInstrumentationTestCase2<MyActivity> {
...
public void testButtons() {
MyActivity activity = getActivity();
Button view = (Button)
activity.findViewById(R.id.button1);
assertEquals("My Button", view.getText());
}
9. Robotium
• Based on Intrumentation Tests
• Removes complexity
• Very popular (used to be the standard)
10. Robotium
public class SimpleActivityTest extends
ActivityInstrumentationTestCase2<MyActivity> {
...
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
public void testPressButton() throws Exception {
solo.clickOnButton("press me");
assertTrue(solo.waitForText("New Window"));
11. UIAutomator
• JUnit3 Tests
• Java Project
• Simple API
• Can access everything on device a user can
• Loose coupling to app under test
12. UIAutomator
public class LaunchSettings extends UiAutomatorTestCase {
public void testPressButton()
throws UiObjectNotFoundException {
getUiDevice().pressHome();
... find and start app
UiObject button = new UiObject(
new UiSelector().text(“clickMe");
button.clickAndWaitForNewWindow();
15. Other Basics...
• Calabash: BDD
Given I am a valid user
And I press "Login"
Then I see "Welcome to coolest app ever”
• Robolectric: unit testing
• Monkey Runner
17. What about Selenium?
• Any language
• Any test framework
• Selenium Client API (Json Wire Protocol)
• Scale and parallize via Selenium Grid
In Theory:
18. • Used by eBay, Facebook
source: https://github.com/selendroid/selendroid/blob/master/AUTHORS
• Open Source
19.
20. Appium
• Used by
Expedia, LinkedIn, Brands4friends
• Rising Star
• Open Source
• Cross platform
• Based on ui automator
46. mobile rockstars
• Michael Burton
Creator of Roboguice
Author of „Android Application Development for Dummies“
• Carlos Sessa
Author of „50 Android Hacks“
https://engineering.groupon.com/
https://github.com/groupon