SlideShare une entreprise Scribd logo
1  sur  64
Télécharger pour lire hors ligne
Acceptance Testing 
with Calabash 
@roland9 
roland@intercom.io 
Xcake Dublin, 9th Dec 2014
What is Calabash?
What is Calabash? 
• Automated acceptance testing of mobile apps
What is Calabash? 
• Automated acceptance testing of mobile apps 
• Cross-platform (Android & iOS)
What is Calabash? 
• Automated acceptance testing of mobile apps 
• Cross-platform (Android & iOS) 
• Open source - Company called Xamarin 
backing it
What is Calabash? 
• Automated acceptance testing of mobile apps 
• Cross-platform (Android & iOS) 
• Open source - Company called Xamarin 
backing it 
• https://github.com/calabash/calabash-ios
What is Calabash? 
• Automated acceptance testing of mobile apps 
• Cross-platform (Android & iOS) 
• Open source - Company called Xamarin 
backing it 
• https://github.com/calabash/calabash-ios 
• https://github.com/calabash/calabash-android
Others 
• Frank, KIF, Zucchini, UIAutomation, iCuke, …
Why would I do it?
Why would I do it?
Why would I do it?
Other Testing Methods 
• Unit Tests 
• Integration Tests 
• Acceptance Tests
Unit Tests 
• Tests smallest unit of functionality 
public void TestPhoneValidator() 
{ 
string goodPhone = "(123) 555-1212"; 
string badPhone = "555 12" 
PhoneValidator validator = new PhoneValidator(); 
Assert.IsTrue(validator.IsValid(goodPhone)); 
Assert.IsFalse(validator.IsValid(badPhone)); 
} 
• Mocks and Stubs to simulate behaviour of other 
objects
Integration Tests 
• Verify that combined modules function correctly
Acceptance Tests 
• Performing tests on the full system (e.g. using 
your web page via a web browser) 
• Described in plain English
How does it work? 
• http://blog.lesspainful.com/2012/03/07/Calabash-iOS/
Install
Install 
• ruby -v -> recommended version 2.0+
Install 
• ruby -v -> recommended version 2.0+ 
• gem install calabash-cucumber
Install 
• ruby -v -> recommended version 2.0+ 
• gem install calabash-cucumber 
• cd path-to-my-ios-project
Install 
• ruby -v -> recommended version 2.0+ 
• gem install calabash-cucumber 
• cd path-to-my-ios-project 
• calabash-ios setup
Install 
• ruby -v -> recommended version 2.0+ 
• gem install calabash-cucumber 
• cd path-to-my-ios-project 
• calabash-ios setup 
• calabash-ios gen
Install 
• ruby -v -> recommended version 2.0+ 
• gem install calabash-cucumber 
• cd path-to-my-ios-project 
• calabash-ios setup 
• calabash-ios gen 
• in Xcode, build -cal scheme
Install 
• ruby -v -> recommended version 2.0+ 
• gem install calabash-cucumber 
• cd path-to-my-ios-project 
• calabash-ios setup 
• calabash-ios gen 
• in Xcode, build -cal scheme 
• cucumber
If all goes well: 
• LPSimpleExample[11298:13703] HTTPServer: 
Started HTTP server on port 37265
Build Directory 
• export APP_BUNDLE_PATH=/Users/rolandgr/ 
<…>/Build/Products/Debug-iphonesimulator/ 
<…>-cal.app
Gherkin 
• https://github.com/calabash/calabash-ios/wiki/01-Getting-started-guide
• Given … 
• When … 
• Then … 
• And …
Useful Stuff
Useful Stuff 
• export DEVICE_TARGET="iPhone 5s (7.1 Simulator)"
Useful Stuff 
• export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" 
• cucumber NO_STOP=1
Useful Stuff 
• export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" 
• cucumber NO_STOP=1 
• cucumber -t @current
Useful Stuff 
• export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" 
• cucumber NO_STOP=1 
• cucumber -t @current 
• cucumber -t @~excludedtag
Useful Stuff 
• export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" 
• cucumber NO_STOP=1 
• cucumber -t @current 
• cucumber -t @~excludedtag 
• calabash-ios console
Useful Stuff 
• export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" 
• cucumber NO_STOP=1 
• cucumber -t @current 
• cucumber -t @~excludedtag 
• calabash-ios console 
• > start_test_server_in_background
Query Syntax 
• query(“button") 
=> [ 
{"class"=>"UIRoundedRectButton", "frame"=>{"y"=>287, 
"width"=>72, "x"=>100, "height"=>37}, "UIType"=>"UIControl", 
"description"=>"<UIRoundedRectButton: 0x7d463d0; frame = 
(100 287; 72 37); opaque = NO; autoresize = RM+BM; layer = 
<CALayer: 0x7d46ae0>>"}, 
{"class"=>"UIRoundedRectButton", "frame"=>{"y"=>215, 
"width"=>73, "x"=>109, "height"=>37}, "UIType"=>"UIControl", 
"description"=>"<UIRoundedRectButton: 0x7d3a760; frame = 
(109 215; 73 37); opaque = NO; autoresize = RM+BM; layer = 
<CALayer: 0x7d3a8a0>>”} 
]
• query("button index:0 label”) 
"find the first button, and then inside of that find all 
labels”. 
• query("button index:0 label", :text)
• touch("tabBarButton index:1")
accessibilityLabel 
accessibilityIdentifier
Custom Steps - Ruby API
Custom Steps - Ruby API 
• https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- 
Ruby-API
Custom Steps - Ruby API 
• https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- 
Ruby-API 
• query, check for existence of elements, wait for elements to exist
Custom Steps - Ruby API 
• https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- 
Ruby-API 
• query, check for existence of elements, wait for elements to exist 
• keyboard
Custom Steps - Ruby API 
• https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- 
Ruby-API 
• query, check for existence of elements, wait for elements to exist 
• keyboard 
• scroll
Custom Steps - Ruby API 
• https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- 
Ruby-API 
• query, check for existence of elements, wait for elements to exist 
• keyboard 
• scroll 
• rotate
Custom Steps - Ruby API 
• https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- 
Ruby-API 
• query, check for existence of elements, wait for elements to exist 
• keyboard 
• scroll 
• rotate 
• backdoor -> call method in iOS app (implement in app delegate)
Custom Steps - Ruby API 
• https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- 
Ruby-API 
• query, check for existence of elements, wait for elements to exist 
• keyboard 
• scroll 
• rotate 
• backdoor -> call method in iOS app (implement in app delegate) 
• macro -> call other step definitions
http://www.slideshare.net/mobiletestsummit/ios-automated-testing-with-calabash-tips-and-tricks? 
qid=0afecec1-fe64-4168-bb69-a548bd01b832&v=default&b=&from_search=8
Tips and Tricks
Tips and Tricks 
• Resetting app data between scenarios
Tips and Tricks 
• Resetting app data between scenarios 
• Avoid sleep - use wait instead:
Tips and Tricks 
• Resetting app data between scenarios 
• Avoid sleep - use wait instead: 
And I wait to see "send button"
Tips and Tricks 
• Resetting app data between scenarios 
• Avoid sleep - use wait instead: 
And I wait to see "send button" 
• Wait before you interact with any element
Tips and Tricks 
• Resetting app data between scenarios 
• Avoid sleep - use wait instead: 
And I wait to see "send button" 
• Wait before you interact with any element 
• Wait after every action to finish
Tips and Tricks 
• Resetting app data between scenarios 
• Avoid sleep - use wait instead: 
And I wait to see "send button" 
• Wait before you interact with any element 
• Wait after every action to finish 
• Escape quotes…
Tips and Tricks 
• Resetting app data between scenarios 
• Avoid sleep - use wait instead: 
And I wait to see "send button" 
• Wait before you interact with any element 
• Wait after every action to finish 
• Escape quotes… 
• https://groups.google.com/forum/#!forum/calabash-ios
Optional: Compare Images 
• gem install imagemagick-binaries 
• check you have compare: $ which compare
Optional: Compare Images 
• gem install imagemagick-binaries 
• check you have compare: $ which compare
Continuous Integration
Code Coverage
Other Info 
• UIKonf talk ‘Unit Testing on iOS’ by Tim 
Brückmann https://speakerdeck.com/tibr/unit-testing- 
on-ios 
• http://calaba.sh 
• https://github.com/calabash/calabash-ios 
• http://developer.xamarin.com/guides/testcloud/ 
calabash/introduction-to-calabash/
Summary 
• Automated Testing - investment that pays off 
• Together with unit testing etc: make changes 
with confidence (still, manual QA required) 
• Cross-platform mature toolset 
• Continuous integration / code coverage
Acceptance Testing 
with Calabash 
@roland9 
roland@intercom.io 
Xcake Dublin, 9th Dec 2014

Contenu connexe

Tendances

Mobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driverMobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driver
Michael Palotas
 

Tendances (20)

Automated UI test on mobile - with Cucumber/Calabash
Automated UI test on mobile - with Cucumber/CalabashAutomated UI test on mobile - with Cucumber/Calabash
Automated UI test on mobile - with Cucumber/Calabash
 
Getting Predictable - Pragmatic Approach for Mobile Development - Devday.lk ...
Getting Predictable - Pragmatic Approach for Mobile Development  - Devday.lk ...Getting Predictable - Pragmatic Approach for Mobile Development  - Devday.lk ...
Getting Predictable - Pragmatic Approach for Mobile Development - Devday.lk ...
 
Test Driven Development - Workshop
Test Driven Development - WorkshopTest Driven Development - Workshop
Test Driven Development - Workshop
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
Selenium and Sauce Labs
Selenium and Sauce LabsSelenium and Sauce Labs
Selenium and Sauce Labs
 
Nakal think test_2015
Nakal think test_2015Nakal think test_2015
Nakal think test_2015
 
Best Practices in Mobile CI (webinar)
Best Practices in Mobile CI (webinar)Best Practices in Mobile CI (webinar)
Best Practices in Mobile CI (webinar)
 
Espresso testing
Espresso testingEspresso testing
Espresso testing
 
Selenium Testing on Chrome - Google DevFest Armenia 2015
Selenium Testing on Chrome - Google DevFest Armenia 2015Selenium Testing on Chrome - Google DevFest Armenia 2015
Selenium Testing on Chrome - Google DevFest Armenia 2015
 
Mobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driverMobile test automation with Selenium, Selendroid and ios-driver
Mobile test automation with Selenium, Selendroid and ios-driver
 
Experiences building apps with React Native @UtrechtJS May 2016
Experiences building apps with React Native @UtrechtJS May 2016Experiences building apps with React Native @UtrechtJS May 2016
Experiences building apps with React Native @UtrechtJS May 2016
 
Mobile WebDriver Selendroid
Mobile WebDriver SelendroidMobile WebDriver Selendroid
Mobile WebDriver Selendroid
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
Mobile Automation Using Appium - vodQA Bangalore 2015
Mobile Automation Using Appium - vodQA Bangalore 2015Mobile Automation Using Appium - vodQA Bangalore 2015
Mobile Automation Using Appium - vodQA Bangalore 2015
 
Subversion and bugtracker
Subversion and bugtrackerSubversion and bugtracker
Subversion and bugtracker
 
10+ Deploys Per Day: Dev and Ops Cooperation at Flickr
10+ Deploys Per Day: Dev and Ops Cooperation at Flickr10+ Deploys Per Day: Dev and Ops Cooperation at Flickr
10+ Deploys Per Day: Dev and Ops Cooperation at Flickr
 
Simplify CI with the Updated Jenkins Plugin for Sauce Labs
Simplify CI with the Updated Jenkins Plugin for Sauce LabsSimplify CI with the Updated Jenkins Plugin for Sauce Labs
Simplify CI with the Updated Jenkins Plugin for Sauce Labs
 
Selendroid in Action
Selendroid in ActionSelendroid in Action
Selendroid in Action
 
Espresso workshop
Espresso workshopEspresso workshop
Espresso workshop
 

En vedette

En vedette (15)

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...
 
Android testing calabash
Android testing calabashAndroid testing calabash
Android testing calabash
 
Behavior driven development with calabash for android
Behavior driven development with calabash for androidBehavior driven development with calabash for android
Behavior driven development with calabash for android
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation tools
 
UIAutomator
UIAutomatorUIAutomator
UIAutomator
 
Android UI Testing with uiautomator
Android UI Testing with uiautomatorAndroid UI Testing with uiautomator
Android UI Testing with uiautomator
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with Ruby
 
Appium overview
Appium overviewAppium overview
Appium overview
 
Android & IOS Automation
Android & IOS AutomationAndroid & IOS Automation
Android & IOS Automation
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
 
Android Automation Testing with Selendroid
Android Automation Testing with SelendroidAndroid Automation Testing with Selendroid
Android Automation Testing with Selendroid
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 
Appium: Automation for Mobile Apps
Appium: Automation for Mobile AppsAppium: Automation for Mobile Apps
Appium: Automation for Mobile Apps
 
Robotium Tutorial
Robotium TutorialRobotium Tutorial
Robotium Tutorial
 
Android ppt
Android ppt Android ppt
Android ppt
 

Similaire à iOS and Android Acceptance Testing with Calabash - Xcake Dublin

HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
davyjones
 
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScriptjQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
Philipp Bosch
 
Phonegap facebook- plugin
Phonegap facebook- pluginPhonegap facebook- plugin
Phonegap facebook- plugin
Steve Gill
 
iOS UI Testing with Frank
iOS UI Testing with FrankiOS UI Testing with Frank
iOS UI Testing with Frank
Keith Pitt
 

Similaire à iOS and Android Acceptance Testing with Calabash - Xcake Dublin (20)

Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
 
Intro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloudIntro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloud
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
 
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScriptjQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
 
REST API Pentester's perspective
REST API Pentester's perspectiveREST API Pentester's perspective
REST API Pentester's perspective
 
Android java fx-jme@jug-lugano
Android java fx-jme@jug-luganoAndroid java fx-jme@jug-lugano
Android java fx-jme@jug-lugano
 
Intro to appcelerator
Intro to appceleratorIntro to appcelerator
Intro to appcelerator
 
Philly CocoaHeads 20160414 - Building Your App SDK With Swift
Philly CocoaHeads 20160414 - Building Your App SDK With SwiftPhilly CocoaHeads 20160414 - Building Your App SDK With Swift
Philly CocoaHeads 20160414 - Building Your App SDK With Swift
 
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloudITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
Building Your App SDK with Swift
Building Your App SDK with SwiftBuilding Your App SDK with Swift
Building Your App SDK with Swift
 
Phonegap facebook- plugin
Phonegap facebook- pluginPhonegap facebook- plugin
Phonegap facebook- plugin
 
Giving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOSGiving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOS
 
Iphone Presentation for MuMe09
Iphone Presentation for MuMe09Iphone Presentation for MuMe09
Iphone Presentation for MuMe09
 
iOS UI Testing with Frank
iOS UI Testing with FrankiOS UI Testing with Frank
iOS UI Testing with Frank
 
手機自動化測試和持續整合
手機自動化測試和持續整合手機自動化測試和持續整合
手機自動化測試和持續整合
 
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
2017 Codemotion OWASP ZAP in CI/CD
2017 Codemotion OWASP ZAP in CI/CD2017 Codemotion OWASP ZAP in CI/CD
2017 Codemotion OWASP ZAP in CI/CD
 
Don't fear our new robot overlords – A new way to test on mobile
Don't fear our new robot overlords – A new way to test on mobileDon't fear our new robot overlords – A new way to test on mobile
Don't fear our new robot overlords – A new way to test on mobile
 

Dernier

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Dernier (20)

%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

iOS and Android Acceptance Testing with Calabash - Xcake Dublin

  • 1. Acceptance Testing with Calabash @roland9 roland@intercom.io Xcake Dublin, 9th Dec 2014
  • 3. What is Calabash? • Automated acceptance testing of mobile apps
  • 4. What is Calabash? • Automated acceptance testing of mobile apps • Cross-platform (Android & iOS)
  • 5. What is Calabash? • Automated acceptance testing of mobile apps • Cross-platform (Android & iOS) • Open source - Company called Xamarin backing it
  • 6. What is Calabash? • Automated acceptance testing of mobile apps • Cross-platform (Android & iOS) • Open source - Company called Xamarin backing it • https://github.com/calabash/calabash-ios
  • 7. What is Calabash? • Automated acceptance testing of mobile apps • Cross-platform (Android & iOS) • Open source - Company called Xamarin backing it • https://github.com/calabash/calabash-ios • https://github.com/calabash/calabash-android
  • 8. Others • Frank, KIF, Zucchini, UIAutomation, iCuke, …
  • 9. Why would I do it?
  • 10. Why would I do it?
  • 11. Why would I do it?
  • 12. Other Testing Methods • Unit Tests • Integration Tests • Acceptance Tests
  • 13. Unit Tests • Tests smallest unit of functionality public void TestPhoneValidator() { string goodPhone = "(123) 555-1212"; string badPhone = "555 12" PhoneValidator validator = new PhoneValidator(); Assert.IsTrue(validator.IsValid(goodPhone)); Assert.IsFalse(validator.IsValid(badPhone)); } • Mocks and Stubs to simulate behaviour of other objects
  • 14. Integration Tests • Verify that combined modules function correctly
  • 15. Acceptance Tests • Performing tests on the full system (e.g. using your web page via a web browser) • Described in plain English
  • 16. How does it work? • http://blog.lesspainful.com/2012/03/07/Calabash-iOS/
  • 18. Install • ruby -v -> recommended version 2.0+
  • 19. Install • ruby -v -> recommended version 2.0+ • gem install calabash-cucumber
  • 20. Install • ruby -v -> recommended version 2.0+ • gem install calabash-cucumber • cd path-to-my-ios-project
  • 21. Install • ruby -v -> recommended version 2.0+ • gem install calabash-cucumber • cd path-to-my-ios-project • calabash-ios setup
  • 22. Install • ruby -v -> recommended version 2.0+ • gem install calabash-cucumber • cd path-to-my-ios-project • calabash-ios setup • calabash-ios gen
  • 23. Install • ruby -v -> recommended version 2.0+ • gem install calabash-cucumber • cd path-to-my-ios-project • calabash-ios setup • calabash-ios gen • in Xcode, build -cal scheme
  • 24. Install • ruby -v -> recommended version 2.0+ • gem install calabash-cucumber • cd path-to-my-ios-project • calabash-ios setup • calabash-ios gen • in Xcode, build -cal scheme • cucumber
  • 25. If all goes well: • LPSimpleExample[11298:13703] HTTPServer: Started HTTP server on port 37265
  • 26. Build Directory • export APP_BUNDLE_PATH=/Users/rolandgr/ <…>/Build/Products/Debug-iphonesimulator/ <…>-cal.app
  • 28. • Given … • When … • Then … • And …
  • 30. Useful Stuff • export DEVICE_TARGET="iPhone 5s (7.1 Simulator)"
  • 31. Useful Stuff • export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" • cucumber NO_STOP=1
  • 32. Useful Stuff • export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" • cucumber NO_STOP=1 • cucumber -t @current
  • 33. Useful Stuff • export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" • cucumber NO_STOP=1 • cucumber -t @current • cucumber -t @~excludedtag
  • 34. Useful Stuff • export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" • cucumber NO_STOP=1 • cucumber -t @current • cucumber -t @~excludedtag • calabash-ios console
  • 35. Useful Stuff • export DEVICE_TARGET="iPhone 5s (7.1 Simulator)" • cucumber NO_STOP=1 • cucumber -t @current • cucumber -t @~excludedtag • calabash-ios console • > start_test_server_in_background
  • 36. Query Syntax • query(“button") => [ {"class"=>"UIRoundedRectButton", "frame"=>{"y"=>287, "width"=>72, "x"=>100, "height"=>37}, "UIType"=>"UIControl", "description"=>"<UIRoundedRectButton: 0x7d463d0; frame = (100 287; 72 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7d46ae0>>"}, {"class"=>"UIRoundedRectButton", "frame"=>{"y"=>215, "width"=>73, "x"=>109, "height"=>37}, "UIType"=>"UIControl", "description"=>"<UIRoundedRectButton: 0x7d3a760; frame = (109 215; 73 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7d3a8a0>>”} ]
  • 37. • query("button index:0 label”) "find the first button, and then inside of that find all labels”. • query("button index:0 label", :text)
  • 40. Custom Steps - Ruby API
  • 41. Custom Steps - Ruby API • https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- Ruby-API
  • 42. Custom Steps - Ruby API • https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- Ruby-API • query, check for existence of elements, wait for elements to exist
  • 43. Custom Steps - Ruby API • https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- Ruby-API • query, check for existence of elements, wait for elements to exist • keyboard
  • 44. Custom Steps - Ruby API • https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- Ruby-API • query, check for existence of elements, wait for elements to exist • keyboard • scroll
  • 45. Custom Steps - Ruby API • https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- Ruby-API • query, check for existence of elements, wait for elements to exist • keyboard • scroll • rotate
  • 46. Custom Steps - Ruby API • https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- Ruby-API • query, check for existence of elements, wait for elements to exist • keyboard • scroll • rotate • backdoor -> call method in iOS app (implement in app delegate)
  • 47. Custom Steps - Ruby API • https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS- Ruby-API • query, check for existence of elements, wait for elements to exist • keyboard • scroll • rotate • backdoor -> call method in iOS app (implement in app delegate) • macro -> call other step definitions
  • 50. Tips and Tricks • Resetting app data between scenarios
  • 51. Tips and Tricks • Resetting app data between scenarios • Avoid sleep - use wait instead:
  • 52. Tips and Tricks • Resetting app data between scenarios • Avoid sleep - use wait instead: And I wait to see "send button"
  • 53. Tips and Tricks • Resetting app data between scenarios • Avoid sleep - use wait instead: And I wait to see "send button" • Wait before you interact with any element
  • 54. Tips and Tricks • Resetting app data between scenarios • Avoid sleep - use wait instead: And I wait to see "send button" • Wait before you interact with any element • Wait after every action to finish
  • 55. Tips and Tricks • Resetting app data between scenarios • Avoid sleep - use wait instead: And I wait to see "send button" • Wait before you interact with any element • Wait after every action to finish • Escape quotes…
  • 56. Tips and Tricks • Resetting app data between scenarios • Avoid sleep - use wait instead: And I wait to see "send button" • Wait before you interact with any element • Wait after every action to finish • Escape quotes… • https://groups.google.com/forum/#!forum/calabash-ios
  • 57. Optional: Compare Images • gem install imagemagick-binaries • check you have compare: $ which compare
  • 58. Optional: Compare Images • gem install imagemagick-binaries • check you have compare: $ which compare
  • 61. Other Info • UIKonf talk ‘Unit Testing on iOS’ by Tim Brückmann https://speakerdeck.com/tibr/unit-testing- on-ios • http://calaba.sh • https://github.com/calabash/calabash-ios • http://developer.xamarin.com/guides/testcloud/ calabash/introduction-to-calabash/
  • 62. Summary • Automated Testing - investment that pays off • Together with unit testing etc: make changes with confidence (still, manual QA required) • Cross-platform mature toolset • Continuous integration / code coverage
  • 63.
  • 64. Acceptance Testing with Calabash @roland9 roland@intercom.io Xcake Dublin, 9th Dec 2014