SlideShare a Scribd company logo
1 of 9
4
IOS Automated Testing With
Calabash-Cucumber
Getting Started With Calabash for iOS
4
1. Calabash is an automated testing technology for Android and iOS native
and hybrid applications.
2. Calabash is a free opensource project, developedand maintained by
Xamarin.
Introducing Calabash
Calabash consists of two libraries calabash-android and calabash-ios.
Calabash-iOS and Calabash-Android are the underlying low-level libraries
that empowerthe Cucumber tool to run automated functional tests on
Android and iOS phones and tablets as well as on simulators. These low-
level libraries enable QA, business staff and developers to work at a high
level by writing tests in a natural language using the terms and concepts of
their business domain.
Example:
Feature: Rating a stand
Scenario: Find and rate a stand from the list
Given I am on the List
Then I should see a "rating" button
And I should not see "Dixie Burger & Gumbo Soup"
And take picture
//Feature File//
The above file example is called a feature file in Cucumber and Calabash. A
feature file describes the intended behaviour of the app. You can think of a
feature file as an executable test specificationof a use case of the app.
Overview: How It Works
Calabash iOS consists of two parts: a client library written in Ruby, and
calabash.framework, a server framework written in Objective-C. To use calabash you
make a special test target in Xcode that links with calabash.framework. The application is
4
otherwise unchanged. The server framework will start an HTTP server inside your app that
listens for requests from the client library.
The cucumber tool executes your feature files which contain steps that are defined either
in predefined or custom (user defined) steps definitions. Custom steps are written using
the API that the client library exposes. The API methods make HTTP requests to the
server, which does things like finding components in the UI and taking actions on them.
Benefits Of Calabash
1.Uniform interface across platforms
4
Calabash provides us a single interface for specifying the behaviour of
mobile apps across platforms. Many companies are creating the same app
(or almost the same app) for both iOS and Android, and pay double costs
when it comes to testing. With Calabash, you have the option of maintaining
only one feature file per app use-case,even if you are developing forboth
Android and iOS. The platform or app differencescan be factored out into so-
called step definitions which are different per platform.
2. Cucumber
Cucumber gives us a high-level, domain-centric language for
specification. The Cucumbertechnologygives us this. A Cucumberfeature
file can be written by QA, domain experts or developers. Developers or
technical test staff can then write step definitions to realise the steps on each
platform.
3. Authenticity
Calabash Provides a test automation technologythat is as authentic as
possible. Testmust be able to run equally well on physical, non-jailbroken
devices as on simulators.
4. Expressive power
Calabash gives as a expressive power to support complex
gestures(Swipe, pinch,etc..).
5. Extensibility and Community
Calabash allows users to be able to extend Calabash itself, and to build an
open source community that is enthusiastic about the technology.
Installation
Prerequisites
You need to have Ruby installed. This is installed by default on
MacOSX.
4
To Verify, type “$ ruby -v” in terminal. It should be at least ‘1.9’ or ‘2.0+’.
For automatic setup:
1. In a terminal, go to your iOS project
$ cd path-to-my-ios-project(i.e. directorycontaining .xcodeproj file)
2. Install calabash-
cucumber gem (this make take
some time because of
dependencies)
$ gem install
calabash- cucumber
Note: you may need to run,
$ sudo gem install calabash-cucumber
if you see ERROR:While executing gem ... (Gem::FilePermissionError)).
3. You check, whether a gem is installed or not. By running
4
$ gem list
4. Setup your project for Calabash-iOS.
$ calabash-iossetup
(It detects the Xcode and look for a project file .xcodeproj and creates a
calabash framework
target ( -cal ) inside the
project.)
5. Generate a skeleton features folderfor your tests
$ calabash-iosgen
(You should be able to see following response)
4
6. In Xcode, build your
project using the -cal
scheme
6. Run the generated test!
$cucumber
If all goes well, you are now ready to write your first test. Start by editing the
file features/my_first.feature.
4
7. Running Calabash Console
$ calabash-iosconsole
(This will help you
to run the calabash
target project file, to test in
the simulator.)
Type: irb(main):001:0> start_test_server_in_background (to start
the simulator )
Updating
Updating Calabash iOS is usually very simple. First install the latest
calabash-cucumber gem.
$ gem install calabash-cucumber
Or, if you're using bundler, run
$ bundle update calabash-cucumber
Then, in the directory that contains the calabash.framework run
$ calabash-iosdownload
Finally, deep clean (Shift + Option + Command + K) and rebuild your project.
Source:
4
1. https://github.com/calabash/calabash-ios/wiki/01-Getting-started-guide
2. https://github.com/calabash/calabash-ios/wiki
3. http://calaba.sh/

More Related Content

What's hot

"I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more."I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more.Fabio Milano
 
Mobile WebDriver Selendroid
Mobile WebDriver SelendroidMobile WebDriver Selendroid
Mobile WebDriver SelendroidDominik Dary
 
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-driverMichael Palotas
 
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache CordovaHazem Saleh
 
Apache Cordova In Action
Apache Cordova In ActionApache Cordova In Action
Apache Cordova In ActionHazem Saleh
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appiumPratik Patel
 
20180618 wwdc cherrypick_xcode10beta
20180618 wwdc cherrypick_xcode10beta20180618 wwdc cherrypick_xcode10beta
20180618 wwdc cherrypick_xcode10betaトニー 森田
 
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache CordovaHazem Saleh
 
Create ABS Project In Twenty Minutes
Create ABS Project In Twenty MinutesCreate ABS Project In Twenty Minutes
Create ABS Project In Twenty MinutesBENOIS Jérôme
 
Appcelerator Titanium Intro (2014)
Appcelerator Titanium Intro (2014)Appcelerator Titanium Intro (2014)
Appcelerator Titanium Intro (2014)Nicholas Jansma
 
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014Hazem Saleh
 
Android Test Automation – one year later
Android Test Automation – one year laterAndroid Test Automation – one year later
Android Test Automation – one year laterDominik Dary
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with AppiumManoj Kumar Kumar
 
Deploy your app with one Slack command
Deploy your app with one Slack commandDeploy your app with one Slack command
Deploy your app with one Slack commandFabio Milano
 
Mobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS ILMobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS ILRon Gershinsky
 
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...Wim Selles
 

What's hot (20)

"I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more."I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more.
 
Mobile WebDriver Selendroid
Mobile WebDriver SelendroidMobile WebDriver Selendroid
Mobile WebDriver Selendroid
 
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
 
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
 
Apache Cordova In Action
Apache Cordova In ActionApache Cordova In Action
Apache Cordova In Action
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
20180618 wwdc cherrypick_xcode10beta
20180618 wwdc cherrypick_xcode10beta20180618 wwdc cherrypick_xcode10beta
20180618 wwdc cherrypick_xcode10beta
 
Xamarin v.Now
Xamarin v.NowXamarin v.Now
Xamarin v.Now
 
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
 
Create ABS Project In Twenty Minutes
Create ABS Project In Twenty MinutesCreate ABS Project In Twenty Minutes
Create ABS Project In Twenty Minutes
 
Appcelerator Titanium Intro (2014)
Appcelerator Titanium Intro (2014)Appcelerator Titanium Intro (2014)
Appcelerator Titanium Intro (2014)
 
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
 
Android Test Automation – one year later
Android Test Automation – one year laterAndroid Test Automation – one year later
Android Test Automation – one year later
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with Appium
 
Air2
Air2Air2
Air2
 
Agility Requires Safety
Agility Requires SafetyAgility Requires Safety
Agility Requires Safety
 
Deploy your app with one Slack command
Deploy your app with one Slack commandDeploy your app with one Slack command
Deploy your app with one Slack command
 
Mobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS ILMobile Apps Using AngularJS - Adam Klein @ AngularJS IL
Mobile Apps Using AngularJS - Adam Klein @ AngularJS IL
 
Automated UI Testing Frameworks
Automated UI Testing FrameworksAutomated UI Testing Frameworks
Automated UI Testing Frameworks
 
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...
 

Viewers also liked

Aģenta arhitektūra (daudzaģentu sistēmās)
Aģenta arhitektūra (daudzaģentu sistēmās)Aģenta arhitektūra (daudzaģentu sistēmās)
Aģenta arhitektūra (daudzaģentu sistēmās)Ingars Ribners
 
24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σας
24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σας24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σας
24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σαςBusiness Coaching Lab
 
Feasibility and Limits of Wi-Fi Imaging
Feasibility and Limits of Wi-Fi ImagingFeasibility and Limits of Wi-Fi Imaging
Feasibility and Limits of Wi-Fi ImagingIngars Ribners
 
18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπές
18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπές18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπές
18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπέςBusiness Coaching Lab
 
Ergonomiska grafiska algoritmu aprakstīšanas valoda DRAKON
Ergonomiska grafiska algoritmu aprakstīšanas valoda DRAKONErgonomiska grafiska algoritmu aprakstīšanas valoda DRAKON
Ergonomiska grafiska algoritmu aprakstīšanas valoda DRAKONIngars Ribners
 
Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...
Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...
Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...Ingars Ribners
 
The march of dimes ppt for ct
The march of dimes ppt for ctThe march of dimes ppt for ct
The march of dimes ppt for ctJustin Sutherland
 
22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεων
22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεων22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεων
22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεωνBusiness Coaching Lab
 
Σύμβουλοι επιχειρήσεων
Σύμβουλοι επιχειρήσεωνΣύμβουλοι επιχειρήσεων
Σύμβουλοι επιχειρήσεωνBusiness Coaching Lab
 
Treatment of hiv and aids
Treatment of hiv and aidsTreatment of hiv and aids
Treatment of hiv and aidsmfundo2
 
28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίρι
28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίρι28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίρι
28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίριBusiness Coaching Lab
 

Viewers also liked (18)

La vida de la Martina
La vida de la MartinaLa vida de la Martina
La vida de la Martina
 
Aģenta arhitektūra (daudzaģentu sistēmās)
Aģenta arhitektūra (daudzaģentu sistēmās)Aģenta arhitektūra (daudzaģentu sistēmās)
Aģenta arhitektūra (daudzaģentu sistēmās)
 
24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σας
24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σας24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σας
24 τρόποι για να μειώσετε τα κόστη της επιχείρησής σας
 
Swift
SwiftSwift
Swift
 
Feasibility and Limits of Wi-Fi Imaging
Feasibility and Limits of Wi-Fi ImagingFeasibility and Limits of Wi-Fi Imaging
Feasibility and Limits of Wi-Fi Imaging
 
Swift
SwiftSwift
Swift
 
Presentation1
Presentation1Presentation1
Presentation1
 
CI & CD- mobile application
CI & CD- mobile applicationCI & CD- mobile application
CI & CD- mobile application
 
18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπές
18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπές18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπές
18 δραστηριότητες για να μη βαρεθείτε στις καλοκαιρινές διακοπές
 
Ergonomiska grafiska algoritmu aprakstīšanas valoda DRAKON
Ergonomiska grafiska algoritmu aprakstīšanas valoda DRAKONErgonomiska grafiska algoritmu aprakstīšanas valoda DRAKON
Ergonomiska grafiska algoritmu aprakstīšanas valoda DRAKON
 
Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...
Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...
Concept of Client-Server Environment for Agent-Based Modeling and Simulation ...
 
The march of dimes ppt for ct
The march of dimes ppt for ctThe march of dimes ppt for ct
The march of dimes ppt for ct
 
22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεων
22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεων22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεων
22 αποτελεσματικοί τρόποι follow up για την αύξηση των πωλήσεων
 
Σύμβουλοι επιχειρήσεων
Σύμβουλοι επιχειρήσεωνΣύμβουλοι επιχειρήσεων
Σύμβουλοι επιχειρήσεων
 
Treatment of hiv and aids
Treatment of hiv and aidsTreatment of hiv and aids
Treatment of hiv and aids
 
40 + 1 TEST, ΤΕΣΤ
40 + 1 TEST, ΤΕΣΤ40 + 1 TEST, ΤΕΣΤ
40 + 1 TEST, ΤΕΣΤ
 
Rwd ppt
Rwd pptRwd ppt
Rwd ppt
 
28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίρι
28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίρι28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίρι
28 τακτικές marketing για να αυξήσετε τις πωλήσεις σας αυτό το καλοκαίρι
 

Similar to Calabash-iOS

eGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testingeGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testingeGo Creative Media Solutions
 
Cocoapods and Most common used library in Swift
Cocoapods and Most common used library in SwiftCocoapods and Most common used library in Swift
Cocoapods and Most common used library in SwiftWan Muzaffar Wan Hashim
 
[2015/2016] Apache Cordova
[2015/2016] Apache Cordova[2015/2016] Apache Cordova
[2015/2016] Apache CordovaIvano Malavolta
 
Calabash Andoird + Calabash iOS
Calabash Andoird + Calabash iOSCalabash Andoird + Calabash iOS
Calabash Andoird + Calabash iOSAnadea
 
Top Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle ThemTop Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle ThemIonic Framework
 
Appium mobile web+dev conference
Appium   mobile web+dev conferenceAppium   mobile web+dev conference
Appium mobile web+dev conferenceIsaac Murchie
 
Calabash-android
Calabash-androidCalabash-android
Calabash-androidAdnan8990
 
Appium workship, Mobile Web+Dev Conference
Appium workship,  Mobile Web+Dev ConferenceAppium workship,  Mobile Web+Dev Conference
Appium workship, Mobile Web+Dev ConferenceIsaac Murchie
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshareCavelle Benjamin
 
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 WorkshopVivek Krishnakumar
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopmentgillygize
 
iOS Application Security
iOS Application SecurityiOS Application Security
iOS Application SecurityEgor Tolstoy
 
Building RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeBuilding RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeDaniel Doubrovkine
 
What is CocoaPods and how to setup?
What is CocoaPods and how to setup?What is CocoaPods and how to setup?
What is CocoaPods and how to setup?Milan Panchal
 
Using Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityUsing Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityMandi Walls
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012alexismidon
 
Alfresco tech talk live mobile sdks
Alfresco tech talk live mobile sdksAlfresco tech talk live mobile sdks
Alfresco tech talk live mobile sdksAlfresco Software
 

Similar to Calabash-iOS (20)

eGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testingeGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testing
 
Cocoapods and Most common used library in Swift
Cocoapods and Most common used library in SwiftCocoapods and Most common used library in Swift
Cocoapods and Most common used library in Swift
 
[2015/2016] Apache Cordova
[2015/2016] Apache Cordova[2015/2016] Apache Cordova
[2015/2016] Apache Cordova
 
Calabash Andoird + Calabash iOS
Calabash Andoird + Calabash iOSCalabash Andoird + Calabash iOS
Calabash Andoird + Calabash iOS
 
Top Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle ThemTop Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle Them
 
Appium mobile web+dev conference
Appium   mobile web+dev conferenceAppium   mobile web+dev conference
Appium mobile web+dev conference
 
Calabash-android
Calabash-androidCalabash-android
Calabash-android
 
Appium workship, Mobile Web+Dev Conference
Appium workship,  Mobile Web+Dev ConferenceAppium workship,  Mobile Web+Dev Conference
Appium workship, Mobile Web+Dev Conference
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshare
 
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
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopment
 
Calabash for iPhone apps
Calabash for iPhone appsCalabash for iPhone apps
Calabash for iPhone apps
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
iOS Application Security
iOS Application SecurityiOS Application Security
iOS Application Security
 
TorqueBox
TorqueBoxTorqueBox
TorqueBox
 
Building RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeBuilding RESTful APIs w/ Grape
Building RESTful APIs w/ Grape
 
What is CocoaPods and how to setup?
What is CocoaPods and how to setup?What is CocoaPods and how to setup?
What is CocoaPods and how to setup?
 
Using Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityUsing Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure Security
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012
 
Alfresco tech talk live mobile sdks
Alfresco tech talk live mobile sdksAlfresco tech talk live mobile sdks
Alfresco tech talk live mobile sdks
 

Calabash-iOS

  • 1. 4 IOS Automated Testing With Calabash-Cucumber Getting Started With Calabash for iOS
  • 2. 4 1. Calabash is an automated testing technology for Android and iOS native and hybrid applications. 2. Calabash is a free opensource project, developedand maintained by Xamarin. Introducing Calabash Calabash consists of two libraries calabash-android and calabash-ios. Calabash-iOS and Calabash-Android are the underlying low-level libraries that empowerthe Cucumber tool to run automated functional tests on Android and iOS phones and tablets as well as on simulators. These low- level libraries enable QA, business staff and developers to work at a high level by writing tests in a natural language using the terms and concepts of their business domain. Example: Feature: Rating a stand Scenario: Find and rate a stand from the list Given I am on the List Then I should see a "rating" button And I should not see "Dixie Burger & Gumbo Soup" And take picture //Feature File// The above file example is called a feature file in Cucumber and Calabash. A feature file describes the intended behaviour of the app. You can think of a feature file as an executable test specificationof a use case of the app. Overview: How It Works Calabash iOS consists of two parts: a client library written in Ruby, and calabash.framework, a server framework written in Objective-C. To use calabash you make a special test target in Xcode that links with calabash.framework. The application is
  • 3. 4 otherwise unchanged. The server framework will start an HTTP server inside your app that listens for requests from the client library. The cucumber tool executes your feature files which contain steps that are defined either in predefined or custom (user defined) steps definitions. Custom steps are written using the API that the client library exposes. The API methods make HTTP requests to the server, which does things like finding components in the UI and taking actions on them. Benefits Of Calabash 1.Uniform interface across platforms
  • 4. 4 Calabash provides us a single interface for specifying the behaviour of mobile apps across platforms. Many companies are creating the same app (or almost the same app) for both iOS and Android, and pay double costs when it comes to testing. With Calabash, you have the option of maintaining only one feature file per app use-case,even if you are developing forboth Android and iOS. The platform or app differencescan be factored out into so- called step definitions which are different per platform. 2. Cucumber Cucumber gives us a high-level, domain-centric language for specification. The Cucumbertechnologygives us this. A Cucumberfeature file can be written by QA, domain experts or developers. Developers or technical test staff can then write step definitions to realise the steps on each platform. 3. Authenticity Calabash Provides a test automation technologythat is as authentic as possible. Testmust be able to run equally well on physical, non-jailbroken devices as on simulators. 4. Expressive power Calabash gives as a expressive power to support complex gestures(Swipe, pinch,etc..). 5. Extensibility and Community Calabash allows users to be able to extend Calabash itself, and to build an open source community that is enthusiastic about the technology. Installation Prerequisites You need to have Ruby installed. This is installed by default on MacOSX.
  • 5. 4 To Verify, type “$ ruby -v” in terminal. It should be at least ‘1.9’ or ‘2.0+’. For automatic setup: 1. In a terminal, go to your iOS project $ cd path-to-my-ios-project(i.e. directorycontaining .xcodeproj file) 2. Install calabash- cucumber gem (this make take some time because of dependencies) $ gem install calabash- cucumber Note: you may need to run, $ sudo gem install calabash-cucumber if you see ERROR:While executing gem ... (Gem::FilePermissionError)). 3. You check, whether a gem is installed or not. By running
  • 6. 4 $ gem list 4. Setup your project for Calabash-iOS. $ calabash-iossetup (It detects the Xcode and look for a project file .xcodeproj and creates a calabash framework target ( -cal ) inside the project.) 5. Generate a skeleton features folderfor your tests $ calabash-iosgen (You should be able to see following response)
  • 7. 4 6. In Xcode, build your project using the -cal scheme 6. Run the generated test! $cucumber If all goes well, you are now ready to write your first test. Start by editing the file features/my_first.feature.
  • 8. 4 7. Running Calabash Console $ calabash-iosconsole (This will help you to run the calabash target project file, to test in the simulator.) Type: irb(main):001:0> start_test_server_in_background (to start the simulator ) Updating Updating Calabash iOS is usually very simple. First install the latest calabash-cucumber gem. $ gem install calabash-cucumber Or, if you're using bundler, run $ bundle update calabash-cucumber Then, in the directory that contains the calabash.framework run $ calabash-iosdownload Finally, deep clean (Shift + Option + Command + K) and rebuild your project. Source: