SlideShare a Scribd company logo
1 of 45
Different Android Test
Automation Frameworks –
What works you the best?

21 November 2013
Ville-Veikko Helppi
Technical Product Manager
ville-veikko.helppi@bitbar.com

1
Agenda
• Different Ways to Automate Your App Testing
• The Benefits and Characteristics of the Top 5
Android Test Automation Frameworks
• 10 Tips for Professional Mobile App Testing
• Testdroid Update
• Q&A

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

3
Agenda
• Different Ways to Automate Your App Testing
• The Benefits and Characteristics of the Top 5
Android Test Automation Frameworks
• 10 Tips for Professional Mobile App Testing
• Testdroid Update
• Q&A

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

4
Different Approaches To Testing

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

5
Different Ways of Doing Test Automation
Hand written test scripts

Record and Playback

Automatic test exercisers

Fast to create, accurate, not as
sensitive to human-errors as
hand-written tests, tools avail’ty

Fastest & extremely automated,
excellent for smoke testing/quick
testing, availability

Benefits:
Accurate, specific to your testing
needs, plenty of options with
frameworks, tools
Tradeoffs:
Takes a lot of time, ties resources Compelling Recorder+Playback
to write test cases/scripts, error- tools available for only few test
prone (humans)
automation frameworks

Not accurate as real test cases

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

6
Option #1: Cloud-Based Testing
Users / Consumers

Successful
build

Build
failed

Commit

Repository

Test Cases
Application
QA & Testers

Error reporting

Source code
Developers

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

7
Option #2: Continuous Integration
Users / Consumers

Successful
build

Build
failed

Commit

Repository

Test Cases
Application
QA & Testers

Error reporting

Source code
Developers

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

8
Manual

Automation
Large
coverage, quick
ly
completed, Less
money & time
wasted, Exact
results.

Smaller coverage, More
money burnt & time
wasted, Error-prone
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

9
How to Improve the App Quality
• Automate generic things as much as you can
• During the development your app changes –
the same must apply for testing!
• Carefully select (testing) technology & partner
• Use all 24 hours per day with test automation
• Cloud-based platform is the only solution to
get you quickly covered in the global markets
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

10
Agenda
• Different Ways to Automate Your App Testing
• The Benefits and Characteristics of the Top 5
Android Test Automation Frameworks
• 10 Tips for Professional Mobile App Testing
• Testdroid Update
• Q&A

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

11
Android Instrumentation Framework
• InstrumentationTestRunner – the
primary plumbing for running tests
on Android
• Android Instrumentation
Framework is built on top of JUnit
– a standard test framework on for
any Java development
• Mock objects – methods for
creating mock system objects such
as content, service and intent.
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

12
Family Tree of Test Frameworks
Calabash
Appium

Robotium

Espresso

Android Instrumentation Framework

UI Automator

JUnit

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

13
Robotium: Basics
• Open source library extending JUnit
with plenty of useful methods for
Android UI testing
• Powerful and robust automatic
black-box test cases for Android
apps
• Supports native, hybrid and mobile
web testing
“It’s like Selenium but for Android”
• Semi-active open source
community with monthly releases
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

14
Robotium: Code Example
// Public void for the operation
public void testRecorded() throws Exception {
// Wait for the text 'Hello!' to be shown for newbie
if (solo.waitForText("Hello!")) {
// R class ID identifier for 'Sign in' - and click it
solo.clickOnView(solo.findViewById("com.twitter.android.R.id.sign_in"));
// R class ID identifier for entering username
solo.enterText((EditText)
solo.findViewById("com.twitter.android.R.id.login_username"),"username");
// R class ID identifier for entering password
solo.enterText((EditText)
solo.findViewById("com.twitter.android.R.id.login_password"),"password");
// R class ID identifier for clicking log in
solo.clickOnView(solo.findViewById("com.twitter.android.R.id.login_login"));
// Wait until log in is done
solo.waitForActivity("HomeTabActivity");
}
// Activate the text field to compose a tweet
solo.clickOnView(solo.findViewById("com.twitter.android.R.id.menu_compose_tweet"));
// Type the tweet
solo.enterText((EditText) solo.findViewById("com.twitter.android.R.id.edit"), "Testdroid");
// Tweeting!
solo.clickOnView(solo.findViewById("com.twitter.android.R.id.composer_post"));
}

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

15
Robotium: ExtSolo - Extension Library
• Includes useful methods that have not been
merged to Robotium, for instance:
–
–
–
–
–
–

Automatic scaling of x,y clicks for any resolution
Multi-path drags
Automatic screenshots on test failure
Mock locations
Change device language
Control WiFi connection

• You can download the library at
http://testdroid.com/products/apis-plugins-and-libraries
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

16
Calabash: Basics
• Behavior driven test framework for native
Android, native iOS and mobile web
• Tests are described in Cucumber and then converted to
Robotium or Frank in run time
• Supports currently about 80 different natural language
commands (controllers). New controllers can be
implemented in Ruby or Java
• If your app uses custom UI Widgets you have to create
controllers for those in order to test your app
• Calabash tools include a command line inspector for
finding right UI element names/ids
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

17
Calabash: Architecture
• Calabash installs an HTTP server as an
instrumentation package that listens
commands from Calabash server

• Tests are executed on server side
• Each test scenario is described in
Cucumber
• Ruby Client library converts
Cucumber commands to either
Robotium or Frank method calls
• Webview support is implemented
with Javascript injection to the
Webview

Test server

Android device

Step
definitions, Ruby
client library

Calabash HTTP
server

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

Your app

Features

18
Calabash: Code Example
Feature: Login feature
Scenario: As a valid user I can log into my app
I wait for text "Hello"
Then I press view with id "Sign in"
Then I enter text "username" into "login_username"
Then I enter text "password" into "login_password"
Then I wait for activity "HomeTabActivity"
Then I press view with id "menu_compose_tweet"
Then I enter text "Testdroid" into field with id "edit"
Then I press view with id "composer_post"

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

19
uiautomator: Basics
• Google’s test framework for testing native Android
apps across device
• Works only on Android API level >=16
• Runs JUnit test cases with special privileges (test
cases can span across different processes)
• No support for web view (only handle to web view
elements as canvas object)

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

20
uiautomator: Code Example
// Public void for the operation
public void testSignInAndTweet() throws Exception {
// Starting application:
getUiDevice().wakeUp();
// Press Home button to ensure we're on homescreen
getUiDevice().pressHome();
// Select 'Apps' and click button
new UiObject(new UiSelector().description("Apps")).click();
// Select 'Twitter' and click
new UiObject(new UiSelector().text("Twitter")).click();
// Locate and select 'Sign in'
UiSelector signIn = new UiSelector().text("Sign In");
// If button is available, click
UiObject signInButton = new UiObject(signIn);
if (signInButton.exists()) {
signInButton.click();
// Set the username
new UiObject(new
UiSelector().className("android.widget.EditText").instance(0)).setText("username");
new UiObject(new
UiSelector().className("android.widget.EditText").instance(1)).setText("password");
new UiObject(new UiSelector().className("android.widget.Button").
text("Sign In").instance(0)).click();
// Wait Sign in progress window
getUiDevice().waitForWindowUpdate(null, 2000);
// Wait for main window
getUiDevice().waitForWindowUpdate(null, 30000);
}
new UiObject(new UiSelector().description("New tweet")).click();
// Typing text for a tweet
new UiObject(new UiSelector().className("android.widget.LinearLayout").instance(8)).
setText("Awesome #Testdroid!");
// Tweeting!
new UiObject(new UiSelector().text("Tweet")).click();
}

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

21
Appium: Basics
• Uses Selenium Webdriver (W3C standard) as a
scripting framework
• Supports native Android, native iOS and mobile web:
– Android via uiautomator (API level >=16) and Selendroid
(API level <16)
– iOS via UI Automation
– Mobile web as Selenium driver for Android and iOS

• You can write your Appium scripts on almost any
programming language
(Haskell/Go/Clojure/Java/Ruby)
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

22
Appium: How it works?
• Appium is an HTTP server that creates and
handles WebDriver sessions
• It starts an Appium server on the device that
is listening commands from the
main Appium process
• It receives json requests from client libraries
over HTTP
• On Android Appium executes these
commands as either uiautomator or
Selendroid commands depending on the API
level of the device
• Tests are driven from a Selenium script on
Appium server

Test server

Android device

UI Automator
controller or
Selendroid driver

Bootstrap.jar

Your app

Selenium script

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

23
Appium: Test Lifecycle
1. Appium installs Bootstrap.jar as an instrumentation package
which contains an uiautomator server and a tcp server
2. The commands from a Selenium script are executed on the
main Appium server that relays the commands over TCP/IP
to the tcp server running on the device
3. The UI Automation server converts the Selenium commands
to uiautomator commands on the fly
4. If the device has API level <=17 Appium installs a Selendroid
server that converts the Selenium commands to Android
Instrumentation (JUnit) commands
5. All test verification and result processing is happening on
server side in the main Appium Server
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

24
Appium: Code Example
# wait for hello
sleep(3)
textFields = driver.find_elements_by_tag_name('textField')
assertEqual(textFields[0].get_attribute("value"), "Hello")
# click sign-in button
driver.find_elements_by_name('Sign in')[0].click()
# find the text fields again, and enter username and password
textFields = driver.find_elements_by_tag_name('textField')
textFields[0].send_keys("twitter_username")
textFields[1].send_keys("passw0rd")
# click the Login button (the first button in the view)
driver.find_elements_by_tag_name('button')[0].click()
# sleep
sleep(3)
# click the first button with name "Compose"
driver.find_elements_by_name('Compose')[0].click()
# type in the tweet message
driver.find_elements_by_tag_name('textField')[0].send_keys(”#Testdroid is awesome!")
# press the Send button
driver.find_elements_by_name('Send')[0].click()
# exit
driver.quit()

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

25
Espresso: Basics
•
•
•
•
•

The latest Android test automation framework from Google
A custom Instrumentation Testrunner with special privileges
Works on API levels 8 (Froyo), 10 (Gingerbread), 15-19 (IJK)
Thin layer on top of Android Instrumentation Framework
Uses the Hamcrest matcher library
https://github.com/hamcrest

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

26
Espresso: Basics 2
• Easy API for extending the framework:
– You can write new matchers: onView(myCustomMatcher<View>)
– You can write new actions: perform(myCustomAction)
– You can write new checks: check(myCustomAssertion)

• Reliable: Synchronizes with the UI thread
• It’s fast because there is no need for any sleeps (tests run on
same millisecond when the app becomes idle)
• No support for web views
• https://code.google.com/p/android-test-kit/

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

27
Espresso: Code Example
public void testEspresso() {
// Check if view with the text 'Hello.' is shown
onView(withText("Hello.")).check(matches(isDisplayed()));
// R class ID identifier for 'Sign in' - and click it
onView(withId(getInstrumentation().getTargetContext().getResources()
.getIdentifier("com.twitter.android:id/sign_in", null, null))).perform(click());
// R class ID identifier for entering username
onView(withId(getInstrumentation().getTargetContext().getResources()
.getIdentifier("com.twitter.android:id/login_username", null, null))).perform((typeText("username")));
// R class ID identifier for entering password
onView(withId(getInstrumentation().getTargetContext().getResources()
.getIdentifier("com.twitter.android:id/login_password", null, null))).perform((typeText("password")));
// R class ID identifier for clicking log in
onView(withId(getInstrumentation().getTargetContext().getResources()
.getIdentifier("com.twitter.android:id/login_login", null, null))).perform(click());
// Activate the text field to compose a tweet
onView(withId(getInstrumentation().getTargetContext().getResources()
.getIdentifier("com.twitter.android:id/menu_compose_tweet", null, null))).perform(click());
// Type the tweet
onView(withId(getInstrumentation().getTargetContext().getResources()
.getIdentifier("com.twitter.android:id/edit", null, null))).perform((typeText(”#Testdroid")));
// Tweeting!
onView(withId(getInstrumentation().getTargetContext().getResources()
.getIdentifier("com.twitter.android:id/composer_post", null, null))).perform(click());
}

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

28
Summary – Comparison Matrix
Robotium

uiautomator

Espresso

Appium

Calabash

Android

Yes

Yes

Yes

Yes

Yes

iOS

No

No

No

Yes

Yes

Mobile web

Yes

No

Yes

Yes

(Android)

Limited to x.y
clicks

(Android & iOS)

(Android)

Java

Java

Java

Almost any

Ruby

Testdroid
Recorder

UI Automator
viewer

Hierarchy
Viewer

Appium.app

CLI

Supported
API levels

All

16 =>

8, 10, 15-19

All

All

Community

Contributors

Google

Google

Active

Pretty quiet

Scripting
Language
Test creation
tools

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

29
Agenda
• Different Ways to Automate Your App Testing
• The Benefits and Characteristics of the Top 5
Android Test Automation Frameworks
• 10 Tips for Professional Mobile App Testing
• Testdroid Update
• Q&A

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

30
Tip #1: Test early, Test often

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

32
Tip #2: Plan What to Automate
Time

MANUAL

Infrastructure
Tools

AUTOMATED

People

Training

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

33
Tip #3: Use only Real Devices

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

34
Tip #4: Use Atomic Test Units

Test iteration #1

Test iteration #2

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

35
Tip #5: Create Hermetic Tests

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

36
Tip #6: Use All Possible Devices

Testdroid Cloud’s 250+ Android devices
= 93-95% global Android volumes!
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

37
Tip #7: Separate Apps and Tests

Your App

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

38
Tip #8: Output Everything to Logs

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

39
Tip #9: End-to-End Testing

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

40
Tip #10: Integrate Dev & Testing
Repository

Successful
build

Commit

Users / Consumers

Build
failed

Test Cases
Application
QA & Testers

Error reporting

Source code
Developers

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

41
Agenda
• Different Ways to Automate Your App Testing
• The Benefits and Characteristics of the Top 5
Android Test Automation Frameworks
• 10 Tips for Professional Mobile App Testing
• Testdroid Update
• Q&A

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

42
Testdroid Products
Complete Solution for Mobile Apps/Games Testing

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

43
Testdroid
– Because it is important to know what app testing costs!

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

44
Testdroid Blog and Webinars
– Because it is important to how to automate your testing!

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

45
Agenda
• Different Ways to Automate Your App Testing
• The Benefits and Characteristics of the Top 5
Android Test Automation Frameworks
• 10 Tips for Professional Mobile App Testing
• Testdroid Update
• Q&A

© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

46
© Copyrights by Bitbar Technologies Ltd. 2013
All rights reserved.

47

More Related Content

What's hot

Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
Sauce Labs
 

What's hot (20)

Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Cross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToCross Platform Appium Tests: How To
Cross Platform Appium Tests: How To
 
Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With Appium
 
Fight back android fragmentation
Fight back android fragmentationFight back android fragmentation
Fight back android fragmentation
 
Hassle-Free Continuous Integration with Real Device Testing
Hassle-Free Continuous Integration with Real Device TestingHassle-Free Continuous Integration with Real Device Testing
Hassle-Free Continuous Integration with Real Device Testing
 
Best Practices in Mobile Game Testing
Best Practices in Mobile Game TestingBest Practices in Mobile Game Testing
Best Practices in Mobile Game Testing
 
Appium workshop technopark trivandrum
Appium workshop technopark trivandrumAppium workshop technopark trivandrum
Appium workshop technopark trivandrum
 
Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021
 
Appium solution
Appium solutionAppium solution
Appium solution
 
Android testing
Android testingAndroid testing
Android testing
 
Do You Enjoy Espresso in Android App Testing?
Do You Enjoy Espresso in Android App Testing?Do You Enjoy Espresso in Android App Testing?
Do You Enjoy Espresso in Android App Testing?
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test Automation
 
Appium & Jenkins
Appium & JenkinsAppium & Jenkins
Appium & Jenkins
 
Automated UI Testing for Web and Native Apps on iOS and Android
Automated UI Testing for  Web and Native Apps on iOS and AndroidAutomated UI Testing for  Web and Native Apps on iOS and Android
Automated UI Testing for Web and Native Apps on iOS and Android
 
Mobile automation – should I use robotium or calabash or appium?
Mobile automation – should I use robotium or calabash or appium?Mobile automation – should I use robotium or calabash or appium?
Mobile automation – should I use robotium or calabash or appium?
 
Automated UI Testing Frameworks
Automated UI Testing FrameworksAutomated UI Testing Frameworks
Automated UI Testing Frameworks
 
Android Automation Testing with Selendroid
Android Automation Testing with SelendroidAndroid Automation Testing with Selendroid
Android Automation Testing with Selendroid
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using Appium
 
Appium overview
Appium overviewAppium overview
Appium overview
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
 

Viewers also liked

Appium Mobile Test Automation like WebDriver
Appium Mobile Test Automation like WebDriverAppium Mobile Test Automation like WebDriver
Appium Mobile Test Automation like WebDriver
Andrii Dzynia
 

Viewers also liked (19)

Appium Mobile Test Automation like WebDriver
Appium Mobile Test Automation like WebDriverAppium Mobile Test Automation like WebDriver
Appium Mobile Test Automation like WebDriver
 
Choosing the Best Open Source Test Automation Tool for You
Choosing the Best Open Source Test Automation Tool for YouChoosing the Best Open Source Test Automation Tool for You
Choosing the Best Open Source Test Automation Tool for You
 
Boston meetup blaze_meter_feb2017
Boston meetup blaze_meter_feb2017Boston meetup blaze_meter_feb2017
Boston meetup blaze_meter_feb2017
 
Best Practices for DevOps in Mobile App Testing
Best Practices for DevOps in Mobile App TestingBest Practices for DevOps in Mobile App Testing
Best Practices for DevOps in Mobile App Testing
 
Appium - Reality check on the world’s leading Open Source Framework for Mobil...
Appium - Reality check on the world’s leading Open Source Framework for Mobil...Appium - Reality check on the world’s leading Open Source Framework for Mobil...
Appium - Reality check on the world’s leading Open Source Framework for Mobil...
 
Prospectus Editing Tool (PET)
Prospectus Editing Tool (PET)Prospectus Editing Tool (PET)
Prospectus Editing Tool (PET)
 
Bibliographic management on mobile devices


Bibliographic management on mobile devices

Bibliographic management on mobile devices


Bibliographic management on mobile devices


 
Bring Back the Fun to Testing Android Apps with Robolectric
Bring Back the Fun to Testing Android Apps with RobolectricBring Back the Fun to Testing Android Apps with Robolectric
Bring Back the Fun to Testing Android Apps with Robolectric
 
The Status of Android Hardware and Software - From App Developer's Point of View
The Status of Android Hardware and Software - From App Developer's Point of ViewThe Status of Android Hardware and Software - From App Developer's Point of View
The Status of Android Hardware and Software - From App Developer's Point of View
 
Maximize the Benefits from Your Test Automation Investment
Maximize the Benefits from Your Test Automation InvestmentMaximize the Benefits from Your Test Automation Investment
Maximize the Benefits from Your Test Automation Investment
 
UIAutomator
UIAutomatorUIAutomator
UIAutomator
 
Cloud testing
Cloud testingCloud testing
Cloud testing
 
Pros & Cons: Cloud-Based Software Testing
Pros & Cons: Cloud-Based Software TestingPros & Cons: Cloud-Based Software Testing
Pros & Cons: Cloud-Based Software Testing
 
Gaming on AWS - 7. AWS를 통한 기기별 테스트 – AWS Device Farm 소개 및 시연
Gaming on AWS - 7. AWS를 통한 기기별 테스트 – AWS Device Farm 소개 및 시연Gaming on AWS - 7. AWS를 통한 기기별 테스트 – AWS Device Farm 소개 및 시연
Gaming on AWS - 7. AWS를 통한 기기별 테스트 – AWS Device Farm 소개 및 시연
 
Using GUI Ripping for Automated Testing of Android Apps
Using GUI Ripping for Automated Testing of Android AppsUsing GUI Ripping for Automated Testing of Android Apps
Using GUI Ripping for Automated Testing of Android Apps
 
Android Test Automation Workshop
Android Test Automation WorkshopAndroid Test Automation Workshop
Android Test Automation Workshop
 
Continous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and JenkinsContinous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and Jenkins
 
Pandora FMS: PostgreSQL Plugin
Pandora FMS: PostgreSQL PluginPandora FMS: PostgreSQL Plugin
Pandora FMS: PostgreSQL Plugin
 
A guide to Android automated testing
A guide to Android automated testingA guide to Android automated testing
A guide to Android automated testing
 

Similar to Different Android Test Automation Frameworks - What Works You the Best?

Similar to Different Android Test Automation Frameworks - What Works You the Best? (20)

Testdroid:
Testdroid: Testdroid:
Testdroid:
 
Browser_Stack_Intro
Browser_Stack_IntroBrowser_Stack_Intro
Browser_Stack_Intro
 
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
 
Webinar: Extend The Power of The ForgeRock Identity Platform Through Scripting
Webinar: Extend The Power of The ForgeRock Identity Platform Through ScriptingWebinar: Extend The Power of The ForgeRock Identity Platform Through Scripting
Webinar: Extend The Power of The ForgeRock Identity Platform Through Scripting
 
Testing Your Android and iOS Apps with Appium in Testdroid Cloud
Testing Your Android and iOS Apps with Appium in Testdroid CloudTesting Your Android and iOS Apps with Appium in Testdroid Cloud
Testing Your Android and iOS Apps with Appium in Testdroid Cloud
 
b4usolution_Appium Mobile Automation Testing Made Awesome
b4usolution_AppiumMobile Automation Testing Made Awesomeb4usolution_AppiumMobile Automation Testing Made Awesome
b4usolution_Appium Mobile Automation Testing Made Awesome
 
Rockstar Android Testing (Mobile TechCon Munich 2014)
Rockstar Android Testing (Mobile TechCon Munich 2014)Rockstar Android Testing (Mobile TechCon Munich 2014)
Rockstar Android Testing (Mobile TechCon Munich 2014)
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
 
Developer Tutorial: WebAuthn for Web & FIDO2 for Android
Developer Tutorial: WebAuthn for Web & FIDO2 for AndroidDeveloper Tutorial: WebAuthn for Web & FIDO2 for Android
Developer Tutorial: WebAuthn for Web & FIDO2 for Android
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
 
JMP103 : Extending Your App Arsenal With OpenSocial
JMP103 : Extending Your App Arsenal With OpenSocialJMP103 : Extending Your App Arsenal With OpenSocial
JMP103 : Extending Your App Arsenal With OpenSocial
 
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocialIBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
 
Mobile UI Testing using Appium and Docker
Mobile UI Testing using Appium and DockerMobile UI Testing using Appium and Docker
Mobile UI Testing using Appium and Docker
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Xam expertday
Xam expertdayXam expertday
Xam expertday
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation tools
 
Mobile Quality Night Vienna 2015 - Testobject Appium in der Cloud
Mobile Quality Night Vienna 2015 - Testobject Appium in der CloudMobile Quality Night Vienna 2015 - Testobject Appium in der Cloud
Mobile Quality Night Vienna 2015 - Testobject Appium in der Cloud
 

More from Bitbar

More from Bitbar (9)

The Best of Both Worlds - Combining Performance and Functional Mobile App Tes...
The Best of Both Worlds - Combining Performance and Functional Mobile App Tes...The Best of Both Worlds - Combining Performance and Functional Mobile App Tes...
The Best of Both Worlds - Combining Performance and Functional Mobile App Tes...
 
Mobile performance metrics and performance monitoring meetup 2017 05 10
Mobile performance metrics and performance monitoring meetup 2017 05 10Mobile performance metrics and performance monitoring meetup 2017 05 10
Mobile performance metrics and performance monitoring meetup 2017 05 10
 
Exercising and Scaling Up Mobile DevOps in the Enterprise
Exercising and Scaling Up Mobile DevOps in the EnterpriseExercising and Scaling Up Mobile DevOps in the Enterprise
Exercising and Scaling Up Mobile DevOps in the Enterprise
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App Testing
 
Ensure Your Mobile Channels Generate Revenue on Holiday Peak Days
Ensure Your Mobile Channels Generate Revenue on Holiday Peak DaysEnsure Your Mobile Channels Generate Revenue on Holiday Peak Days
Ensure Your Mobile Channels Generate Revenue on Holiday Peak Days
 
The Powerful and Comprehensive API for Mobile App Development and Testing
The Powerful and Comprehensive API for Mobile App Development and TestingThe Powerful and Comprehensive API for Mobile App Development and Testing
The Powerful and Comprehensive API for Mobile App Development and Testing
 
Which One Works You The Best: In-House or Cloud-Based Development Environment
Which One Works You The Best: In-House or Cloud-Based Development EnvironmentWhich One Works You The Best: In-House or Cloud-Based Development Environment
Which One Works You The Best: In-House or Cloud-Based Development Environment
 
Build a Large Scale In-House Test Lab for Mobile Apps
Build a Large Scale In-House Test Lab for Mobile AppsBuild a Large Scale In-House Test Lab for Mobile Apps
Build a Large Scale In-House Test Lab for Mobile Apps
 
How to Test Security and Vulnerability of Your Android and iOS Apps
How to Test Security and Vulnerability of Your Android and iOS AppsHow to Test Security and Vulnerability of Your Android and iOS Apps
How to Test Security and Vulnerability of Your Android and iOS Apps
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Different Android Test Automation Frameworks - What Works You the Best?

  • 1. Different Android Test Automation Frameworks – What works you the best? 21 November 2013 Ville-Veikko Helppi Technical Product Manager ville-veikko.helppi@bitbar.com 1
  • 2. Agenda • Different Ways to Automate Your App Testing • The Benefits and Characteristics of the Top 5 Android Test Automation Frameworks • 10 Tips for Professional Mobile App Testing • Testdroid Update • Q&A © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 3
  • 3. Agenda • Different Ways to Automate Your App Testing • The Benefits and Characteristics of the Top 5 Android Test Automation Frameworks • 10 Tips for Professional Mobile App Testing • Testdroid Update • Q&A © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 4
  • 4. Different Approaches To Testing © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 5
  • 5. Different Ways of Doing Test Automation Hand written test scripts Record and Playback Automatic test exercisers Fast to create, accurate, not as sensitive to human-errors as hand-written tests, tools avail’ty Fastest & extremely automated, excellent for smoke testing/quick testing, availability Benefits: Accurate, specific to your testing needs, plenty of options with frameworks, tools Tradeoffs: Takes a lot of time, ties resources Compelling Recorder+Playback to write test cases/scripts, error- tools available for only few test prone (humans) automation frameworks Not accurate as real test cases © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 6
  • 6. Option #1: Cloud-Based Testing Users / Consumers Successful build Build failed Commit Repository Test Cases Application QA & Testers Error reporting Source code Developers © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 7
  • 7. Option #2: Continuous Integration Users / Consumers Successful build Build failed Commit Repository Test Cases Application QA & Testers Error reporting Source code Developers © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 8
  • 8. Manual Automation Large coverage, quick ly completed, Less money & time wasted, Exact results. Smaller coverage, More money burnt & time wasted, Error-prone © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 9
  • 9. How to Improve the App Quality • Automate generic things as much as you can • During the development your app changes – the same must apply for testing! • Carefully select (testing) technology & partner • Use all 24 hours per day with test automation • Cloud-based platform is the only solution to get you quickly covered in the global markets © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 10
  • 10. Agenda • Different Ways to Automate Your App Testing • The Benefits and Characteristics of the Top 5 Android Test Automation Frameworks • 10 Tips for Professional Mobile App Testing • Testdroid Update • Q&A © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 11
  • 11. Android Instrumentation Framework • InstrumentationTestRunner – the primary plumbing for running tests on Android • Android Instrumentation Framework is built on top of JUnit – a standard test framework on for any Java development • Mock objects – methods for creating mock system objects such as content, service and intent. © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 12
  • 12. Family Tree of Test Frameworks Calabash Appium Robotium Espresso Android Instrumentation Framework UI Automator JUnit © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 13
  • 13. Robotium: Basics • Open source library extending JUnit with plenty of useful methods for Android UI testing • Powerful and robust automatic black-box test cases for Android apps • Supports native, hybrid and mobile web testing “It’s like Selenium but for Android” • Semi-active open source community with monthly releases © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 14
  • 14. Robotium: Code Example // Public void for the operation public void testRecorded() throws Exception { // Wait for the text 'Hello!' to be shown for newbie if (solo.waitForText("Hello!")) { // R class ID identifier for 'Sign in' - and click it solo.clickOnView(solo.findViewById("com.twitter.android.R.id.sign_in")); // R class ID identifier for entering username solo.enterText((EditText) solo.findViewById("com.twitter.android.R.id.login_username"),"username"); // R class ID identifier for entering password solo.enterText((EditText) solo.findViewById("com.twitter.android.R.id.login_password"),"password"); // R class ID identifier for clicking log in solo.clickOnView(solo.findViewById("com.twitter.android.R.id.login_login")); // Wait until log in is done solo.waitForActivity("HomeTabActivity"); } // Activate the text field to compose a tweet solo.clickOnView(solo.findViewById("com.twitter.android.R.id.menu_compose_tweet")); // Type the tweet solo.enterText((EditText) solo.findViewById("com.twitter.android.R.id.edit"), "Testdroid"); // Tweeting! solo.clickOnView(solo.findViewById("com.twitter.android.R.id.composer_post")); } © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 15
  • 15. Robotium: ExtSolo - Extension Library • Includes useful methods that have not been merged to Robotium, for instance: – – – – – – Automatic scaling of x,y clicks for any resolution Multi-path drags Automatic screenshots on test failure Mock locations Change device language Control WiFi connection • You can download the library at http://testdroid.com/products/apis-plugins-and-libraries © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 16
  • 16. Calabash: Basics • Behavior driven test framework for native Android, native iOS and mobile web • Tests are described in Cucumber and then converted to Robotium or Frank in run time • Supports currently about 80 different natural language commands (controllers). New controllers can be implemented in Ruby or Java • If your app uses custom UI Widgets you have to create controllers for those in order to test your app • Calabash tools include a command line inspector for finding right UI element names/ids © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 17
  • 17. Calabash: Architecture • Calabash installs an HTTP server as an instrumentation package that listens commands from Calabash server • Tests are executed on server side • Each test scenario is described in Cucumber • Ruby Client library converts Cucumber commands to either Robotium or Frank method calls • Webview support is implemented with Javascript injection to the Webview Test server Android device Step definitions, Ruby client library Calabash HTTP server © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. Your app Features 18
  • 18. Calabash: Code Example Feature: Login feature Scenario: As a valid user I can log into my app I wait for text "Hello" Then I press view with id "Sign in" Then I enter text "username" into "login_username" Then I enter text "password" into "login_password" Then I wait for activity "HomeTabActivity" Then I press view with id "menu_compose_tweet" Then I enter text "Testdroid" into field with id "edit" Then I press view with id "composer_post" © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 19
  • 19. uiautomator: Basics • Google’s test framework for testing native Android apps across device • Works only on Android API level >=16 • Runs JUnit test cases with special privileges (test cases can span across different processes) • No support for web view (only handle to web view elements as canvas object) © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 20
  • 20. uiautomator: Code Example // Public void for the operation public void testSignInAndTweet() throws Exception { // Starting application: getUiDevice().wakeUp(); // Press Home button to ensure we're on homescreen getUiDevice().pressHome(); // Select 'Apps' and click button new UiObject(new UiSelector().description("Apps")).click(); // Select 'Twitter' and click new UiObject(new UiSelector().text("Twitter")).click(); // Locate and select 'Sign in' UiSelector signIn = new UiSelector().text("Sign In"); // If button is available, click UiObject signInButton = new UiObject(signIn); if (signInButton.exists()) { signInButton.click(); // Set the username new UiObject(new UiSelector().className("android.widget.EditText").instance(0)).setText("username"); new UiObject(new UiSelector().className("android.widget.EditText").instance(1)).setText("password"); new UiObject(new UiSelector().className("android.widget.Button"). text("Sign In").instance(0)).click(); // Wait Sign in progress window getUiDevice().waitForWindowUpdate(null, 2000); // Wait for main window getUiDevice().waitForWindowUpdate(null, 30000); } new UiObject(new UiSelector().description("New tweet")).click(); // Typing text for a tweet new UiObject(new UiSelector().className("android.widget.LinearLayout").instance(8)). setText("Awesome #Testdroid!"); // Tweeting! new UiObject(new UiSelector().text("Tweet")).click(); } © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 21
  • 21. Appium: Basics • Uses Selenium Webdriver (W3C standard) as a scripting framework • Supports native Android, native iOS and mobile web: – Android via uiautomator (API level >=16) and Selendroid (API level <16) – iOS via UI Automation – Mobile web as Selenium driver for Android and iOS • You can write your Appium scripts on almost any programming language (Haskell/Go/Clojure/Java/Ruby) © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 22
  • 22. Appium: How it works? • Appium is an HTTP server that creates and handles WebDriver sessions • It starts an Appium server on the device that is listening commands from the main Appium process • It receives json requests from client libraries over HTTP • On Android Appium executes these commands as either uiautomator or Selendroid commands depending on the API level of the device • Tests are driven from a Selenium script on Appium server Test server Android device UI Automator controller or Selendroid driver Bootstrap.jar Your app Selenium script © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 23
  • 23. Appium: Test Lifecycle 1. Appium installs Bootstrap.jar as an instrumentation package which contains an uiautomator server and a tcp server 2. The commands from a Selenium script are executed on the main Appium server that relays the commands over TCP/IP to the tcp server running on the device 3. The UI Automation server converts the Selenium commands to uiautomator commands on the fly 4. If the device has API level <=17 Appium installs a Selendroid server that converts the Selenium commands to Android Instrumentation (JUnit) commands 5. All test verification and result processing is happening on server side in the main Appium Server © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 24
  • 24. Appium: Code Example # wait for hello sleep(3) textFields = driver.find_elements_by_tag_name('textField') assertEqual(textFields[0].get_attribute("value"), "Hello") # click sign-in button driver.find_elements_by_name('Sign in')[0].click() # find the text fields again, and enter username and password textFields = driver.find_elements_by_tag_name('textField') textFields[0].send_keys("twitter_username") textFields[1].send_keys("passw0rd") # click the Login button (the first button in the view) driver.find_elements_by_tag_name('button')[0].click() # sleep sleep(3) # click the first button with name "Compose" driver.find_elements_by_name('Compose')[0].click() # type in the tweet message driver.find_elements_by_tag_name('textField')[0].send_keys(”#Testdroid is awesome!") # press the Send button driver.find_elements_by_name('Send')[0].click() # exit driver.quit() © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 25
  • 25. Espresso: Basics • • • • • The latest Android test automation framework from Google A custom Instrumentation Testrunner with special privileges Works on API levels 8 (Froyo), 10 (Gingerbread), 15-19 (IJK) Thin layer on top of Android Instrumentation Framework Uses the Hamcrest matcher library https://github.com/hamcrest © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 26
  • 26. Espresso: Basics 2 • Easy API for extending the framework: – You can write new matchers: onView(myCustomMatcher<View>) – You can write new actions: perform(myCustomAction) – You can write new checks: check(myCustomAssertion) • Reliable: Synchronizes with the UI thread • It’s fast because there is no need for any sleeps (tests run on same millisecond when the app becomes idle) • No support for web views • https://code.google.com/p/android-test-kit/ © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 27
  • 27. Espresso: Code Example public void testEspresso() { // Check if view with the text 'Hello.' is shown onView(withText("Hello.")).check(matches(isDisplayed())); // R class ID identifier for 'Sign in' - and click it onView(withId(getInstrumentation().getTargetContext().getResources() .getIdentifier("com.twitter.android:id/sign_in", null, null))).perform(click()); // R class ID identifier for entering username onView(withId(getInstrumentation().getTargetContext().getResources() .getIdentifier("com.twitter.android:id/login_username", null, null))).perform((typeText("username"))); // R class ID identifier for entering password onView(withId(getInstrumentation().getTargetContext().getResources() .getIdentifier("com.twitter.android:id/login_password", null, null))).perform((typeText("password"))); // R class ID identifier for clicking log in onView(withId(getInstrumentation().getTargetContext().getResources() .getIdentifier("com.twitter.android:id/login_login", null, null))).perform(click()); // Activate the text field to compose a tweet onView(withId(getInstrumentation().getTargetContext().getResources() .getIdentifier("com.twitter.android:id/menu_compose_tweet", null, null))).perform(click()); // Type the tweet onView(withId(getInstrumentation().getTargetContext().getResources() .getIdentifier("com.twitter.android:id/edit", null, null))).perform((typeText(”#Testdroid"))); // Tweeting! onView(withId(getInstrumentation().getTargetContext().getResources() .getIdentifier("com.twitter.android:id/composer_post", null, null))).perform(click()); } © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 28
  • 28. Summary – Comparison Matrix Robotium uiautomator Espresso Appium Calabash Android Yes Yes Yes Yes Yes iOS No No No Yes Yes Mobile web Yes No Yes Yes (Android) Limited to x.y clicks (Android & iOS) (Android) Java Java Java Almost any Ruby Testdroid Recorder UI Automator viewer Hierarchy Viewer Appium.app CLI Supported API levels All 16 => 8, 10, 15-19 All All Community Contributors Google Google Active Pretty quiet Scripting Language Test creation tools © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 29
  • 29. Agenda • Different Ways to Automate Your App Testing • The Benefits and Characteristics of the Top 5 Android Test Automation Frameworks • 10 Tips for Professional Mobile App Testing • Testdroid Update • Q&A © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 30
  • 30. Tip #1: Test early, Test often © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 32
  • 31. Tip #2: Plan What to Automate Time MANUAL Infrastructure Tools AUTOMATED People Training © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 33
  • 32. Tip #3: Use only Real Devices © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 34
  • 33. Tip #4: Use Atomic Test Units Test iteration #1 Test iteration #2 © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 35
  • 34. Tip #5: Create Hermetic Tests © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 36
  • 35. Tip #6: Use All Possible Devices Testdroid Cloud’s 250+ Android devices = 93-95% global Android volumes! © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 37
  • 36. Tip #7: Separate Apps and Tests Your App © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 38
  • 37. Tip #8: Output Everything to Logs © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 39
  • 38. Tip #9: End-to-End Testing © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 40
  • 39. Tip #10: Integrate Dev & Testing Repository Successful build Commit Users / Consumers Build failed Test Cases Application QA & Testers Error reporting Source code Developers © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 41
  • 40. Agenda • Different Ways to Automate Your App Testing • The Benefits and Characteristics of the Top 5 Android Test Automation Frameworks • 10 Tips for Professional Mobile App Testing • Testdroid Update • Q&A © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 42
  • 41. Testdroid Products Complete Solution for Mobile Apps/Games Testing © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 43
  • 42. Testdroid – Because it is important to know what app testing costs! © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 44
  • 43. Testdroid Blog and Webinars – Because it is important to how to automate your testing! © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 45
  • 44. Agenda • Different Ways to Automate Your App Testing • The Benefits and Characteristics of the Top 5 Android Test Automation Frameworks • 10 Tips for Professional Mobile App Testing • Testdroid Update • Q&A © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 46
  • 45. © Copyrights by Bitbar Technologies Ltd. 2013 All rights reserved. 47