SlideShare una empresa de Scribd logo
1 de 47
Descargar para leer sin conexión
Danny Preussler | Groupon
Rockstar Android Testing
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
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
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
Rockstar Testing?
•  Fast! Faster!
•  Reliable!
•  Scalable!
Acrassicau 6 by Bruce Martin, CC BY 2.0, https://www.flickr.com/photos/shotbydarko/4692892946/
InstrumentationTests
vs uiautomator
•  Base for most frameworks
•  Understand the differences!
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)
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());
}
Robotium
•  Based on Intrumentation Tests
•  Removes complexity
•  Very popular (used to be the standard)
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"));
UIAutomator
•  JUnit3 Tests
•  Java Project
•  Simple API
•  Can access everything on device a user can
•  Loose coupling to app under test
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();
UIAutomator
•  Blackbox Testing
•  Can only access what is visible
•  API 16+
InstrumentationTests
vs uiautomator
•  Understand the differences
Device
Application
Under Test
uiatuomator
Device
Instrumentaion
Application
Under Test
apps
apps
apps
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
That‘s
not
rock star
testing!
Guitar Hero!!! By JoshBerglund19, CC BY 2.0
What about Selenium?
•  Any language
•  Any test framework
•  Selenium Client API (Json Wire Protocol)
•  Scale and parallize via Selenium Grid
In Theory:
•  Used by eBay, Facebook
source: https://github.com/selendroid/selendroid/blob/master/AUTHORS
•  Open Source
Appium
•  Used by
Expedia, LinkedIn, Brands4friends
•  Rising Star
•  Open Source
•  Cross platform
•  Based on ui automator
Rock
without
Selenium?
•  Used by: Groupon
•  Open Sourced recently
•  Remote Control your tests
RoboRemote
RoboRemote Architecture
Page 23
Computer/Build Server Device/Emulator
Application
Under Test
RoboRemoteServer
Robotium
UIAutomatorClient
Legend
Groupon Test Engineering Application Developer/Tester Open Source
RoboRemoteClient
UIAutomatorServer
UIAutomator
Tests
RoboRemote Sample
•  RoboRemote: UIAutomator
UiObject myLabel = new UiObject(
new UiSelector()
.call(“className”, ”android.widget.TextView”)
.call(“text”, “My Text”));
myLabel.call(“click”);
UiObject myLabel = new UiObject(
new UiSelector()
.className(”android.widget.TextView”)
.text(“My Text”));
myLabel.click();
•  UIAutomator
•  Man in the Middle HTTP Proxy
with REST API
•  Single war-file
•  Open Sourcing planned
RoboRemote + Odo
Response Override
•  Custom (stub) response
•  Modify response contents
•  Change HTTP response code
•  Add Delay
Odo-ed
(…“soldOut”:“false”,…)(“soldOut”:“true”,…)
RoboRemote
•  RoboRemote Github:
https://github.com/groupon/robo-remote
•  Maven:
http://search.maven.org/ - search|ga|1|
roboremote
This was QA view.
What about
developers?
•  Used by:
Google, XING, mobile.de,
eBay Kleinanzeigen
•  Open Sourced October 2013
•  Based on Instrumentation
Simple! Reliable! Fast!
ViewMatcher
->ViewAction
->ViewAssert
Simple
onView(withId(R.id.myview))
.perform(click())
.check(matches(isDisplayed()));
Simple
Use Power of Hamcrest Matcher
Simple
Waiting is the root of all evil!
Evil face in Ninnaji Temple, Kyoto by MrHicks46, CC BY 2.0, http://www.flickr.com/photos/teosaurio/10138704345/
•  No „wait()“ in Espresso API!
Speed
•  Instead:
– Operation on UIThread
– Wait until idle
– Action on UI Thread
– Wait until idle
– Check Result
Speed
•  What is idle?
– UI Thread
– AsyncTask
– ???? via IdleResource
Speed
•  Removed flakyness of sleeping
•  Improved Testrunner
Reliable
•  Used by: Google, Paypal, facebook,
Cisco, LinkedIn, eBay, BMW, Intel,
Evernote (source http://testdroid.com/products/success-stories)
•  Real devices in the cloud
•  Works with:
Espresso, uiautomator, Calabash,
Appium, Robotium + x
•  Example via Gradle:
...
apply plugin: 'testdroid‘
testdroid {
...
deviceGroup "10_inch_tablets"
deviceLanguageCode "de-DE"
fullRunConfig {
instrumentationRunner =
“... GoogleInstrumentationTestRunner"
}
http://testdroid.com/testautomatisierung
Try it and get a free shirt:
So what is the
ultimate
rock star test
tool now?
Fazit?
Check your needs and your Resources!
Let’s rock test!
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
More Links
•  http://developer.android.com/tools/testing/testing_ui.html
•  https://code.google.com/p/robotium/
•  https://github.com/calabash/calabash-android
•  http://selendroid.io/
•  https://github.com/appium/appium
•  https://plus.google.com/+StephanLinzner/posts/HhXutBz7tcV-
•  https://code.google.com/p/android-test-kit/wiki/Espresso
•  https://code.google.com/p/hamcrest/
•  https://cloud.testdroid.com

Más contenido relacionado

La actualidad más candente

Using JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsUsing JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsYakov Fain
 
手機自動化測試和持續整合
手機自動化測試和持續整合手機自動化測試和持續整合
手機自動化測試和持續整合Carl Su
 
React Nativeの光と闇
React Nativeの光と闇React Nativeの光と闇
React Nativeの光と闇Yukiya Nakagawa
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react nativeModusJesus
 
Effective Android Development
Effective Android Development Effective Android Development
Effective Android Development Sergii Zhuk
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Adrian Philipp
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetupSyam Sasi
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsYakov Fain
 
Using Android Studio and Genymotion for improved productivity
Using Android Studio and Genymotion for improved productivityUsing Android Studio and Genymotion for improved productivity
Using Android Studio and Genymotion for improved productivitySowmya Guru
 
The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016Matt Raible
 
Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...
Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...
Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...Burin Asavesna
 
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
React-Native for multi-platform mobile applications @ Codemotion Rome 2017React-Native for multi-platform mobile applications @ Codemotion Rome 2017
React-Native for multi-platform mobile applications @ Codemotion Rome 2017Matteo Manchi
 
Rapid Android Development for Hackathon
Rapid Android Development for HackathonRapid Android Development for Hackathon
Rapid Android Development for HackathonCodePolitan
 
Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.UA Mobile
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Matt Raible
 
Build Your First Android App Session #1
Build Your First Android App Session #1Build Your First Android App Session #1
Build Your First Android App Session #1Troy Miles
 
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...Matt Raible
 
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020Matt Raible
 
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Matt Raible
 
Docker.key
Docker.keyDocker.key
Docker.keyjwausle
 

La actualidad más candente (20)

Using JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsUsing JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot apps
 
手機自動化測試和持續整合
手機自動化測試和持續整合手機自動化測試和持續整合
手機自動化測試和持續整合
 
React Nativeの光と闇
React Nativeの光と闇React Nativeの光と闇
React Nativeの光と闇
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react native
 
Effective Android Development
Effective Android Development Effective Android Development
Effective Android Development
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetup
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
Using Android Studio and Genymotion for improved productivity
Using Android Studio and Genymotion for improved productivityUsing Android Studio and Genymotion for improved productivity
Using Android Studio and Genymotion for improved productivity
 
The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016
 
Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...
Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...
Automating Your Way out of the Dark Ages: Our Experience with (And Without) P...
 
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
React-Native for multi-platform mobile applications @ Codemotion Rome 2017React-Native for multi-platform mobile applications @ Codemotion Rome 2017
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
 
Rapid Android Development for Hackathon
Rapid Android Development for HackathonRapid Android Development for Hackathon
Rapid Android Development for Hackathon
 
Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
 
Build Your First Android App Session #1
Build Your First Android App Session #1Build Your First Android App Session #1
Build Your First Android App Session #1
 
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
 
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
 
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
 
Docker.key
Docker.keyDocker.key
Docker.key
 

Similar a Rockstar Android Testing (Mobile TechCon Munich 2014)

Android Unit Testing With Robolectric
Android Unit Testing With RobolectricAndroid Unit Testing With Robolectric
Android Unit Testing With RobolectricDanny Preussler
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Bitbar
 
Mobile developer is Software developer
Mobile developer is Software developerMobile developer is Software developer
Mobile developer is Software developerEugen Martynov
 
[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...BeMyApp
 
Selendroid - Selenium for Android
Selendroid - Selenium for AndroidSelendroid - Selenium for Android
Selendroid - Selenium for AndroidDominik Dary
 
Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014
Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014
Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014Danny Preussler
 
2012 java one-con3648
2012 java one-con36482012 java one-con3648
2012 java one-con3648Eing Ong
 
Lecture #3 activities and intents
Lecture #3  activities and intentsLecture #3  activities and intents
Lecture #3 activities and intentsVitali Pekelis
 
Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Tabăra de Testare
 
2012 star west-t10
2012 star west-t102012 star west-t10
2012 star west-t10Eing Ong
 
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxNgLQun
 
Hieu Xamarin iOS9, Android M 3-11-2015
Hieu Xamarin iOS9, Android M  3-11-2015Hieu Xamarin iOS9, Android M  3-11-2015
Hieu Xamarin iOS9, Android M 3-11-2015Nguyen Hieu
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversingEnrique López Mañas
 
Android testing
Android testingAndroid testing
Android testingBitbar
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011sullis
 
Automating the Gaps of Unit Testing Mobile Apps
Automating the Gaps of Unit Testing Mobile AppsAutomating the Gaps of Unit Testing Mobile Apps
Automating the Gaps of Unit Testing Mobile AppsGeoffrey Goetz
 
Android studio
Android studioAndroid studio
Android studioAndri Yabu
 

Similar a Rockstar Android Testing (Mobile TechCon Munich 2014) (20)

Android Unit Testing With Robolectric
Android Unit Testing With RobolectricAndroid Unit Testing With Robolectric
Android Unit Testing With Robolectric
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?
 
Mobile developer is Software developer
Mobile developer is Software developerMobile developer is Software developer
Mobile developer is Software developer
 
[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...
 
Selendroid - Selenium for Android
Selendroid - Selenium for AndroidSelendroid - Selenium for Android
Selendroid - Selenium for Android
 
Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014
Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014
Bye Bye Charles, Welcome Odo, Android Meetup Berlin May 2014
 
2012 java one-con3648
2012 java one-con36482012 java one-con3648
2012 java one-con3648
 
Lecture #3 activities and intents
Lecture #3  activities and intentsLecture #3  activities and intents
Lecture #3 activities and intents
 
Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19
 
Android development first steps
Android development   first stepsAndroid development   first steps
Android development first steps
 
2012 star west-t10
2012 star west-t102012 star west-t10
2012 star west-t10
 
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
 
Appium overview
Appium overviewAppium overview
Appium overview
 
Hieu Xamarin iOS9, Android M 3-11-2015
Hieu Xamarin iOS9, Android M  3-11-2015Hieu Xamarin iOS9, Android M  3-11-2015
Hieu Xamarin iOS9, Android M 3-11-2015
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
Android testing
Android testingAndroid testing
Android testing
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
 
Automating the Gaps of Unit Testing Mobile Apps
Automating the Gaps of Unit Testing Mobile AppsAutomating the Gaps of Unit Testing Mobile Apps
Automating the Gaps of Unit Testing Mobile Apps
 
Android class provider in mumbai
Android class provider in mumbaiAndroid class provider in mumbai
Android class provider in mumbai
 
Android studio
Android studioAndroid studio
Android studio
 

Más de Danny Preussler

We aint got no time - Droidcon Nairobi
We aint got no time - Droidcon NairobiWe aint got no time - Droidcon Nairobi
We aint got no time - Droidcon NairobiDanny Preussler
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Danny Preussler
 
TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)Danny Preussler
 
TDD on Android (Øredev 2018)
TDD on Android (Øredev 2018)TDD on Android (Øredev 2018)
TDD on Android (Øredev 2018)Danny Preussler
 
Junit5: the next gen of testing, don't stay behind
Junit5: the next gen of testing, don't stay behindJunit5: the next gen of testing, don't stay behind
Junit5: the next gen of testing, don't stay behindDanny Preussler
 
Demystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and ToothpickDemystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and ToothpickDanny Preussler
 
Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016
Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016
Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016Danny Preussler
 
Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Danny Preussler
 
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)Danny Preussler
 
All around the world, localization and internationalization on Android (Droid...
All around the world, localization and internationalization on Android (Droid...All around the world, localization and internationalization on Android (Droid...
All around the world, localization and internationalization on Android (Droid...Danny Preussler
 
(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016
(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016
(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016Danny Preussler
 
Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)Danny Preussler
 
Clean code on Android (Droidcon Dubai 2015)
Clean code on Android (Droidcon Dubai 2015)Clean code on Android (Droidcon Dubai 2015)
Clean code on Android (Droidcon Dubai 2015)Danny Preussler
 
More android code puzzles
More android code puzzlesMore android code puzzles
More android code puzzlesDanny Preussler
 
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, BerlinAbgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, BerlinDanny Preussler
 
Android Code Puzzles (DroidCon Amsterdam 2012)
Android Code Puzzles (DroidCon Amsterdam 2012)Android Code Puzzles (DroidCon Amsterdam 2012)
Android Code Puzzles (DroidCon Amsterdam 2012)Danny Preussler
 

Más de Danny Preussler (16)

We aint got no time - Droidcon Nairobi
We aint got no time - Droidcon NairobiWe aint got no time - Droidcon Nairobi
We aint got no time - Droidcon Nairobi
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)
 
TDD on Android (Øredev 2018)
TDD on Android (Øredev 2018)TDD on Android (Øredev 2018)
TDD on Android (Øredev 2018)
 
Junit5: the next gen of testing, don't stay behind
Junit5: the next gen of testing, don't stay behindJunit5: the next gen of testing, don't stay behind
Junit5: the next gen of testing, don't stay behind
 
Demystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and ToothpickDemystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and Toothpick
 
Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016
Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016
Unit Testing on Android: why and how? DevFest Romania, Bucharest 2016
 
Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016
 
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
 
All around the world, localization and internationalization on Android (Droid...
All around the world, localization and internationalization on Android (Droid...All around the world, localization and internationalization on Android (Droid...
All around the world, localization and internationalization on Android (Droid...
 
(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016
(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016
(Android) Developer Survival in Multiscreen World, MobCon Sofia 2016
 
Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)
 
Clean code on Android (Droidcon Dubai 2015)
Clean code on Android (Droidcon Dubai 2015)Clean code on Android (Droidcon Dubai 2015)
Clean code on Android (Droidcon Dubai 2015)
 
More android code puzzles
More android code puzzlesMore android code puzzles
More android code puzzles
 
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, BerlinAbgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
 
Android Code Puzzles (DroidCon Amsterdam 2012)
Android Code Puzzles (DroidCon Amsterdam 2012)Android Code Puzzles (DroidCon Amsterdam 2012)
Android Code Puzzles (DroidCon Amsterdam 2012)
 

Último

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Rockstar Android Testing (Mobile TechCon Munich 2014)

  • 1. Danny Preussler | Groupon Rockstar Android Testing
  • 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/
  • 6. InstrumentationTests vs uiautomator •  Base for most frameworks •  Understand the differences!
  • 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();
  • 13. UIAutomator •  Blackbox Testing •  Can only access what is visible •  API 16+
  • 14. InstrumentationTests vs uiautomator •  Understand the differences Device Application Under Test uiatuomator Device Instrumentaion Application Under Test apps apps apps
  • 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
  • 16. That‘s not rock star testing! Guitar Hero!!! By JoshBerglund19, CC BY 2.0
  • 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
  • 22. •  Used by: Groupon •  Open Sourced recently •  Remote Control your tests RoboRemote
  • 23. RoboRemote Architecture Page 23 Computer/Build Server Device/Emulator Application Under Test RoboRemoteServer Robotium UIAutomatorClient Legend Groupon Test Engineering Application Developer/Tester Open Source RoboRemoteClient UIAutomatorServer UIAutomator Tests
  • 24. RoboRemote Sample •  RoboRemote: UIAutomator UiObject myLabel = new UiObject( new UiSelector() .call(“className”, ”android.widget.TextView”) .call(“text”, “My Text”)); myLabel.call(“click”); UiObject myLabel = new UiObject( new UiSelector() .className(”android.widget.TextView”) .text(“My Text”)); myLabel.click(); •  UIAutomator
  • 25. •  Man in the Middle HTTP Proxy with REST API •  Single war-file •  Open Sourcing planned RoboRemote + Odo
  • 26. Response Override •  Custom (stub) response •  Modify response contents •  Change HTTP response code •  Add Delay Odo-ed (…“soldOut”:“false”,…)(“soldOut”:“true”,…)
  • 27. RoboRemote •  RoboRemote Github: https://github.com/groupon/robo-remote •  Maven: http://search.maven.org/ - search|ga|1| roboremote
  • 28. This was QA view. What about developers?
  • 29. •  Used by: Google, XING, mobile.de, eBay Kleinanzeigen •  Open Sourced October 2013 •  Based on Instrumentation Simple! Reliable! Fast!
  • 32. Use Power of Hamcrest Matcher Simple
  • 33. Waiting is the root of all evil! Evil face in Ninnaji Temple, Kyoto by MrHicks46, CC BY 2.0, http://www.flickr.com/photos/teosaurio/10138704345/
  • 34. •  No „wait()“ in Espresso API! Speed
  • 35. •  Instead: – Operation on UIThread – Wait until idle – Action on UI Thread – Wait until idle – Check Result Speed
  • 36. •  What is idle? – UI Thread – AsyncTask – ???? via IdleResource Speed
  • 37. •  Removed flakyness of sleeping •  Improved Testrunner Reliable
  • 38.
  • 39. •  Used by: Google, Paypal, facebook, Cisco, LinkedIn, eBay, BMW, Intel, Evernote (source http://testdroid.com/products/success-stories) •  Real devices in the cloud •  Works with: Espresso, uiautomator, Calabash, Appium, Robotium + x
  • 40. •  Example via Gradle: ... apply plugin: 'testdroid‘ testdroid { ... deviceGroup "10_inch_tablets" deviceLanguageCode "de-DE" fullRunConfig { instrumentationRunner = “... GoogleInstrumentationTestRunner" }
  • 41.
  • 43. So what is the ultimate rock star test tool now?
  • 44. Fazit? Check your needs and your Resources!
  • 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
  • 47. More Links •  http://developer.android.com/tools/testing/testing_ui.html •  https://code.google.com/p/robotium/ •  https://github.com/calabash/calabash-android •  http://selendroid.io/ •  https://github.com/appium/appium •  https://plus.google.com/+StephanLinzner/posts/HhXutBz7tcV- •  https://code.google.com/p/android-test-kit/wiki/Espresso •  https://code.google.com/p/hamcrest/ •  https://cloud.testdroid.com