SlideShare a Scribd company logo
1 of 31
Tips & Tricks with
Calabash for
Mobile App Testing
13 March 2014
Ville-Veikko Helppi
Technical Product Manager
ville-veikko.helppi@bitbar.com
Agenda
ā€¢ Prerequisites for Mobile App Testing
ā€¢ Calabash Introduction and How It Compares to
Other Test Automation Frameworks
ā€¢ Inside the Calabash ā€“ Building Those Scripts
ā€¢ Tips & Tricks with Calabash
ā€¢ Demonstration
ā€¢ Q&A
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
2
Agenda
ā€¢ Prerequisites for Mobile App Testing
ā€¢ Calabash Introduction and How It Compares to
Other Test Automation Frameworks
ā€¢ Inside the Calabash ā€“ Building Those Scripts
ā€¢ Tips and Tricks with Calabash
ā€¢ Demonstration
ā€¢ Q&A
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
3
Why Apps Fail?
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
4
Prerequisites for Mobile App Testing
ā€¢ Testing environment as authentic as possible
ā€“ Real devices <-> emulators/simulators
ā€¢ Test coverage needs to be adequate
ā€“ Software is not identical in all Android/iOS devices
ā€“ Hardware is even more fragmented landscape
ā€¢ Surrounding testing conditions (e.g. network)
ā€¢ Try not to build in repetitive, manual processes
ā€¢ Test automation framework that works for you
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
5
What Framework Works You The Best?
ā€¢ High-level & declarative test automation
frameworks work well when app is under dev
ā€¢ Easy to integrate with continuous integration
ā€¢ Distance between use case and actual test
ā€¢ What do you build: Native, Hybrid or Web app?
ā€¢ The technical competence in your organization
ā€¢ Desired outcome from test automation
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
6
What Improves 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. 2014
All rights reserved.
7
Why Real Devices are Must-to-Have?
ā€¢ Emulators/simulators wonā€™t help you to testā€¦
ā€“ User Experience and Usability
ā€“ Hardware
ā€“ Software
ā€“ Infrastructure
0 % = the percentage of your app users
that use emulator to run your app!
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
8
Basics: Different Ways of Doing Test Automation
Automatic test exercisersRecord and PlaybackHand written test scripts
Benefits:
Accurate, specific to your testing
needs, plenty of options with
frameworks, tools
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
Tradeoffs:
Takes a lot of time, ties resources
to write test cases/scripts, error-
prone (humans)
Compelling Recorder+Playback
tools available for only few test
automation frameworks
Not accurate as real test cases
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
9
Agenda
ā€¢ Prerequisites for Mobile App Testing
ā€¢ Calabash Introduction and How It Compares
to Other Test Automation Frameworks
ā€¢ Inside the Calabash ā€“ Building Those Scripts
ā€¢ Tips and Tricks with Calabash
ā€¢ Demonstration
ā€¢ Q&A
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
10
Introduction to Calabash
ā€¢ Behavior driven test framework for native Android &
iOS, and for hybrid web apps (embedded webviews)
ā€¢ Tests are described in Cucumber and then converted to
Robotium or ā€œsimilar-to-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. 2014
All rights reserved.
11
Android Example: The Family Tree
of Test Automation Frameworks
JUnit
Android Instrumentation Framework
Robotium Espresso
UI Automator
Calabash
Appium
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
12
Why Calabash is A Good Choice?
ā€¢ Cross-platform test automation framework
ā€¢ Human-readable syntax/tests
ā€¢ Not much changes needed for tests when the
mobile app changes (e.g. UI components)
ā€¢ Pretty easy to integrate with any CI
ā€¢ Great choice for teams that have limited
resources for development and/or testing
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
13
Calabash-iOS: 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 ā€Frankā€ method calls
ā€¢ Webview support is implemented with
Javascript injection to the Webview
iOS device
Your app
Calabash HTTP
server
Test server
Step definitions,
Ruby client
library
Features
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
14
Calabash-Android: Architecture
ā€¢ Calabash uses Android instrumentation
test server (a separate app)
ā€¢ Based on
ActivityInstrumentationTestCase2
ā€¢ Tests are executed on server side
ā€¢ Predefined and custom steps
ā€¢ Ruby Client library converts Cucumber
commands to Robotium method calls
ā€¢ Webview support is implemented with
Javascript injection to the Webview
Android device
Your app
Instrumentation
Test Server
Test server
Step definitions,
Ruby client
library
Features
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
15
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. 2014
All rights reserved.
16
How Calabash Compares to Others?
Calabash Robotium uiautomator Espresso Appium
Android Yes Yes Yes Yes Yes
iOS Yes No No No Yes
Mobile web Hybrid
(webviews)
Yes
(Android)
Limited to x.y
clicks
No Yes
(Android & iOS)
Scripting
Language
Ruby Java Java Java Almost any
Test creation
tools
CLI Testdroid
Recorder
UI Automator
viewer
Hierarchy
Viewer
Appium.app
Supported
API levels
All All 16 => 8, 10, 15-19 All
Community Active Contributors Google Google Active
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
17
Example #1: Calabash with Cloud
Developers
Source code
Repository
Build
failed
Successful
build
QA & Testers
Error reporting
Test Cases
Application
Users / Consumers
Commit
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
18
Example #2: Calabash with CI
Developers
Source code
Repository
Build
failed
Successful
build
QA & Testers
Error reporting
Test Cases
Application
Users / Consumers
Commit
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
19
Agenda
ā€¢ Prerequisites for Mobile App Testing
ā€¢ Calabash Introduction and How It Compares to
Other Test Automation Frameworks
ā€¢ Inside the Calabash ā€“ Building Those Scripts
ā€¢ Tips and Tricks with Calabash
ā€¢ Demonstration
ā€¢ Q&A
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
20
Step Definitions
ā€¢ Fast and easy to modify definitions and features
ā€¢ Predefined and Custom steps
ā€“ Predefined steps offer the way to start instantly
ā€“ Custom steps provide more options & can be easily
tailored for your app
ā€¢ Works for both, Android and iOS, when added:
ā€“ calabash.framework
ā€“ ActivityInstrumentationTestCase2
ā€¢ Custom steps extremely easy to modify & create
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
21
Test Script ā€“ called Features
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
22
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"
Example: Predefined Steps
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
23
Given /^I press the "([^"]*)" button$/ do |buttonText|
performAction('press_button_with_text', buttonText)
end
Then /^I press button number (d+)$/ do |buttonNumber|
performAction('press_button_number', buttonNumber)
end
Then /^I press image button number (d+)$/ do |buttonNumber|
performAction('press_image_button_number', buttonNumber)
end
Then /^I press view with id "([^"]*)"$/ do |view_id|
performAction('click_on_view_by_id',view_id)
end
From Definition to Feature
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
24
Then /^I press view with id "([^"]*)"$/ do |view_id|
performAction('click_on_view_by_id',view_id)
end
Then I press view with id "menu_compose_tweet"
Definition:
Feature:
Agenda
ā€¢ Prerequisites for Mobile App Testing
ā€¢ Calabash Introduction and How It Compares to
Other Test Automation Frameworks
ā€¢ Building the Calabash Scripts
ā€¢ Tips and Tricks with Calabash
ā€¢ Demonstration
ā€¢ Q&A
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
25
#1: Use Only Real Devices
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
26
#2: Calabash is Perfect for
ā€œTest Early, Test Oftenā€ Approach
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
27
#3: Integrate Dev & Testing -> CI
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
28
Commit
Developers
Source code
Repository
Build
failed
Successful
build
QA & Testers
Error reporting
Test Cases
Application
Users / Consumers
Agenda
ā€¢ Prerequisites for Mobile App Testing
ā€¢ Calabash Introduction and How It Compares to
Other Test Automation Frameworks
ā€¢ Inside the Calabash ā€“ Building Those Scripts
ā€¢ Tips and Tricks with Calabash
ā€¢ Demonstration
ā€¢ Q&A
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
29
Agenda
ā€¢ Prerequisites for Mobile App Testing
ā€¢ Calabash Introduction and How It Compares to
Other Test Automation Frameworks
ā€¢ Inside the Calabash ā€“ Building Those Scripts
ā€¢ Tips and Tricks with Calabash
ā€¢ Demonstration
ā€¢ Q&A
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
30
Ā© Copyrights by Bitbar Technologies Ltd. 2014
All rights reserved.
31

More Related Content

Viewers also liked

How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
Ā 

Viewers also liked (20)

Pruebas funcionales de Software
Pruebas funcionales de SoftwarePruebas funcionales de Software
Pruebas funcionales de Software
Ā 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013
Ā 
Three Uses Of JIRA Beyond Bug Tracking
Three Uses Of JIRA Beyond Bug TrackingThree Uses Of JIRA Beyond Bug Tracking
Three Uses Of JIRA Beyond Bug Tracking
Ā 
TestLink introduction
TestLink introductionTestLink introduction
TestLink introduction
Ā 
Introduction To Confluence
Introduction To ConfluenceIntroduction To Confluence
Introduction To Confluence
Ā 
Jira as a Tool for Test Management
Jira as a Tool for Test ManagementJira as a Tool for Test Management
Jira as a Tool for Test Management
Ā 
Using JIRA Software for Issue Tracking
Using JIRA Software for Issue TrackingUsing JIRA Software for Issue Tracking
Using JIRA Software for Issue Tracking
Ā 
Introduction To Jira
Introduction To JiraIntroduction To Jira
Introduction To Jira
Ā 
Calabash, an open-source automated testing technology for native mobile, by K...
Calabash, an open-source automated testing technology for native mobile, by K...Calabash, an open-source automated testing technology for native mobile, by K...
Calabash, an open-source automated testing technology for native mobile, by K...
Ā 
Story Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium FrameworkStory Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium Framework
Ā 
Next level of Appium
Next level of AppiumNext level of Appium
Next level of Appium
Ā 
Automate you Appium test like a pro!
Automate you Appium test like a pro!Automate you Appium test like a pro!
Automate you Appium test like a pro!
Ā 
Gerrit is Getting Native with RPM, Deb and Docker
Gerrit is Getting Native with RPM, Deb and DockerGerrit is Getting Native with RPM, Deb and Docker
Gerrit is Getting Native with RPM, Deb and Docker
Ā 
Introduction to Bdd and cucumber
Introduction to Bdd and cucumberIntroduction to Bdd and cucumber
Introduction to Bdd and cucumber
Ā 
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
Ā 
Continuous integration using Jenkins and Sonar
Continuous integration using Jenkins and SonarContinuous integration using Jenkins and Sonar
Continuous integration using Jenkins and Sonar
Ā 
Sonar qube to impove code quality
Sonar qube   to impove code qualitySonar qube   to impove code quality
Sonar qube to impove code quality
Ā 
Design First API's with RAML and SoapUI
Design First API's with RAML and SoapUIDesign First API's with RAML and SoapUI
Design First API's with RAML and SoapUI
Ā 
Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub plugin
Ā 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
Ā 

More from Bitbar

More from Bitbar (20)

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
Ā 
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 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
Ā 
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
Ā 
How to Reliably Measure and Optimize Graphics Performance of Your Android Games
How to Reliably Measure and Optimize Graphics Performance of Your Android GamesHow to Reliably Measure and Optimize Graphics Performance of Your Android Games
How to Reliably Measure and Optimize Graphics Performance of Your Android Games
Ā 
Parallel Test Runs with Appium on Real Mobile Devices ā€“ Hands-on Webinar
Parallel Test Runs with Appium on Real Mobile Devices ā€“ Hands-on WebinarParallel Test Runs with Appium on Real Mobile Devices ā€“ Hands-on Webinar
Parallel Test Runs with Appium on Real Mobile Devices ā€“ Hands-on Webinar
Ā 
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)
Ā 
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
Ā 
Best Practices in Mobile Game Testing
Best Practices in Mobile Game TestingBest Practices in Mobile Game Testing
Best Practices in Mobile Game Testing
Ā 
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
Ā 
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
Ā 
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?
Ā 
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
Ā 
How to Leverage Appium in Your Mobile App Testing
How to Leverage Appium in Your Mobile App TestingHow to Leverage Appium in Your Mobile App Testing
How to Leverage Appium in Your Mobile App Testing
Ā 
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
Ā 
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?
Ā 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(ā˜Žļø+971_581248768%)**%*]'#abortion pills for sale in dubai@
Ā 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
Ā 

Recently uploaded (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Ā 
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
Ā 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Ā 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
Ā 
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
Ā 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Ā 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
Ā 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
Ā 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Ā 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Ā 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Ā 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
Ā 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Ā 

Tips and Tricks with Calabash for Mobile App Testing

  • 1. Tips & Tricks with Calabash for Mobile App Testing 13 March 2014 Ville-Veikko Helppi Technical Product Manager ville-veikko.helppi@bitbar.com
  • 2. Agenda ā€¢ Prerequisites for Mobile App Testing ā€¢ Calabash Introduction and How It Compares to Other Test Automation Frameworks ā€¢ Inside the Calabash ā€“ Building Those Scripts ā€¢ Tips & Tricks with Calabash ā€¢ Demonstration ā€¢ Q&A Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 2
  • 3. Agenda ā€¢ Prerequisites for Mobile App Testing ā€¢ Calabash Introduction and How It Compares to Other Test Automation Frameworks ā€¢ Inside the Calabash ā€“ Building Those Scripts ā€¢ Tips and Tricks with Calabash ā€¢ Demonstration ā€¢ Q&A Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 3
  • 4. Why Apps Fail? Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 4
  • 5. Prerequisites for Mobile App Testing ā€¢ Testing environment as authentic as possible ā€“ Real devices <-> emulators/simulators ā€¢ Test coverage needs to be adequate ā€“ Software is not identical in all Android/iOS devices ā€“ Hardware is even more fragmented landscape ā€¢ Surrounding testing conditions (e.g. network) ā€¢ Try not to build in repetitive, manual processes ā€¢ Test automation framework that works for you Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 5
  • 6. What Framework Works You The Best? ā€¢ High-level & declarative test automation frameworks work well when app is under dev ā€¢ Easy to integrate with continuous integration ā€¢ Distance between use case and actual test ā€¢ What do you build: Native, Hybrid or Web app? ā€¢ The technical competence in your organization ā€¢ Desired outcome from test automation Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 6
  • 7. What Improves 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. 2014 All rights reserved. 7
  • 8. Why Real Devices are Must-to-Have? ā€¢ Emulators/simulators wonā€™t help you to testā€¦ ā€“ User Experience and Usability ā€“ Hardware ā€“ Software ā€“ Infrastructure 0 % = the percentage of your app users that use emulator to run your app! Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 8
  • 9. Basics: Different Ways of Doing Test Automation Automatic test exercisersRecord and PlaybackHand written test scripts Benefits: Accurate, specific to your testing needs, plenty of options with frameworks, tools 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 Tradeoffs: Takes a lot of time, ties resources to write test cases/scripts, error- prone (humans) Compelling Recorder+Playback tools available for only few test automation frameworks Not accurate as real test cases Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 9
  • 10. Agenda ā€¢ Prerequisites for Mobile App Testing ā€¢ Calabash Introduction and How It Compares to Other Test Automation Frameworks ā€¢ Inside the Calabash ā€“ Building Those Scripts ā€¢ Tips and Tricks with Calabash ā€¢ Demonstration ā€¢ Q&A Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 10
  • 11. Introduction to Calabash ā€¢ Behavior driven test framework for native Android & iOS, and for hybrid web apps (embedded webviews) ā€¢ Tests are described in Cucumber and then converted to Robotium or ā€œsimilar-to-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. 2014 All rights reserved. 11
  • 12. Android Example: The Family Tree of Test Automation Frameworks JUnit Android Instrumentation Framework Robotium Espresso UI Automator Calabash Appium Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 12
  • 13. Why Calabash is A Good Choice? ā€¢ Cross-platform test automation framework ā€¢ Human-readable syntax/tests ā€¢ Not much changes needed for tests when the mobile app changes (e.g. UI components) ā€¢ Pretty easy to integrate with any CI ā€¢ Great choice for teams that have limited resources for development and/or testing Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 13
  • 14. Calabash-iOS: 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 ā€Frankā€ method calls ā€¢ Webview support is implemented with Javascript injection to the Webview iOS device Your app Calabash HTTP server Test server Step definitions, Ruby client library Features Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 14
  • 15. Calabash-Android: Architecture ā€¢ Calabash uses Android instrumentation test server (a separate app) ā€¢ Based on ActivityInstrumentationTestCase2 ā€¢ Tests are executed on server side ā€¢ Predefined and custom steps ā€¢ Ruby Client library converts Cucumber commands to Robotium method calls ā€¢ Webview support is implemented with Javascript injection to the Webview Android device Your app Instrumentation Test Server Test server Step definitions, Ruby client library Features Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 15
  • 16. 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. 2014 All rights reserved. 16
  • 17. How Calabash Compares to Others? Calabash Robotium uiautomator Espresso Appium Android Yes Yes Yes Yes Yes iOS Yes No No No Yes Mobile web Hybrid (webviews) Yes (Android) Limited to x.y clicks No Yes (Android & iOS) Scripting Language Ruby Java Java Java Almost any Test creation tools CLI Testdroid Recorder UI Automator viewer Hierarchy Viewer Appium.app Supported API levels All All 16 => 8, 10, 15-19 All Community Active Contributors Google Google Active Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 17
  • 18. Example #1: Calabash with Cloud Developers Source code Repository Build failed Successful build QA & Testers Error reporting Test Cases Application Users / Consumers Commit Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 18
  • 19. Example #2: Calabash with CI Developers Source code Repository Build failed Successful build QA & Testers Error reporting Test Cases Application Users / Consumers Commit Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 19
  • 20. Agenda ā€¢ Prerequisites for Mobile App Testing ā€¢ Calabash Introduction and How It Compares to Other Test Automation Frameworks ā€¢ Inside the Calabash ā€“ Building Those Scripts ā€¢ Tips and Tricks with Calabash ā€¢ Demonstration ā€¢ Q&A Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 20
  • 21. Step Definitions ā€¢ Fast and easy to modify definitions and features ā€¢ Predefined and Custom steps ā€“ Predefined steps offer the way to start instantly ā€“ Custom steps provide more options & can be easily tailored for your app ā€¢ Works for both, Android and iOS, when added: ā€“ calabash.framework ā€“ ActivityInstrumentationTestCase2 ā€¢ Custom steps extremely easy to modify & create Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 21
  • 22. Test Script ā€“ called Features Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 22 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"
  • 23. Example: Predefined Steps Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 23 Given /^I press the "([^"]*)" button$/ do |buttonText| performAction('press_button_with_text', buttonText) end Then /^I press button number (d+)$/ do |buttonNumber| performAction('press_button_number', buttonNumber) end Then /^I press image button number (d+)$/ do |buttonNumber| performAction('press_image_button_number', buttonNumber) end Then /^I press view with id "([^"]*)"$/ do |view_id| performAction('click_on_view_by_id',view_id) end
  • 24. From Definition to Feature Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 24 Then /^I press view with id "([^"]*)"$/ do |view_id| performAction('click_on_view_by_id',view_id) end Then I press view with id "menu_compose_tweet" Definition: Feature:
  • 25. Agenda ā€¢ Prerequisites for Mobile App Testing ā€¢ Calabash Introduction and How It Compares to Other Test Automation Frameworks ā€¢ Building the Calabash Scripts ā€¢ Tips and Tricks with Calabash ā€¢ Demonstration ā€¢ Q&A Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 25
  • 26. #1: Use Only Real Devices Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 26
  • 27. #2: Calabash is Perfect for ā€œTest Early, Test Oftenā€ Approach Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 27
  • 28. #3: Integrate Dev & Testing -> CI Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 28 Commit Developers Source code Repository Build failed Successful build QA & Testers Error reporting Test Cases Application Users / Consumers
  • 29. Agenda ā€¢ Prerequisites for Mobile App Testing ā€¢ Calabash Introduction and How It Compares to Other Test Automation Frameworks ā€¢ Inside the Calabash ā€“ Building Those Scripts ā€¢ Tips and Tricks with Calabash ā€¢ Demonstration ā€¢ Q&A Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 29
  • 30. Agenda ā€¢ Prerequisites for Mobile App Testing ā€¢ Calabash Introduction and How It Compares to Other Test Automation Frameworks ā€¢ Inside the Calabash ā€“ Building Those Scripts ā€¢ Tips and Tricks with Calabash ā€¢ Demonstration ā€¢ Q&A Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 30
  • 31. Ā© Copyrights by Bitbar Technologies Ltd. 2014 All rights reserved. 31