Skip to content
Abode QA
Abode QA

A Hub For Testing Minds…

  • Home
  • Video Tutorial
    • Selenium WebDriver
    • Spock Framework
    • Katalon Studio
    • Git Tutorial
    • SQL Tutorial
    • Geb & Spock
    • Groovy
  • Manual Testing
  • Selenium-WebDriver
  • Quiz
    • Selenium WebDriver Quiz
    • Software Testing Quiz | Software Testing Interview Preparation Question
  • Java Tutorial
  • Katalon
  • Fitnesse
  • Daily Bytes!!
Abode QA

A Hub For Testing Minds…

Initial setup required for Mobile native app automation with Calabash

Vishvas Kumar, December 17, 2014May 12, 2018

In this post i am trying to elaborate the overall setup for the ATDD approach along with the Calabash-Cucumber with Ruby as a language.
Background:-
Calabash is very popular, mostly used in all of big giants organisation now a days & its defined as an automated testing technology for Android and IOS native and hybrid applications.It provides you to run cross-platform, supporting Android and iOS native apps. Calabash consists of two libraries calabash-android and calabash-ios. As you can imagine, calabash-android is the automation and testing library for Android, and similarly calabash-ios is for iOS.

Setup:-
=>Need the Xcode 6.1.1(latest version available on appstore) installed on the Mac machine on which you are going to run your test.
=>Need to install the command line tools from the prefrences pane under “Downloads” in Xcode.
-=>If multiple Xcode is install on machine need to switch the latest version by  :-

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

=>Now, Install the Ruby , You will find its already installed on MAC machine, You can check by
ruby -v , Morover, if you have multiple version of ruby, try to install with the help of rvm & set default ruby in the machine whichever you want.

Trending
Delete, Truncate and Drop Statement In SQL with Example

=>Installation of the gems needed for your project: This can be done in two ways, First you have option to install manually by running multiple installation of gem commands on machine, but for future reference if neeed to setup the same project on other slave machines, its better to use second approach ie:- Use Gemfile to install the gem(for using this you must in need of manual installation of bundler by :- gem install bundler).
Here are the gems needed to setup calabash:-

gem install calabash-cucumber

Note you may need to run sudo gem install calabash-cucumber if you see ERROR: While executing gem … (Gem::FilePermissionError)).

=>To use Calabash for iOS in your app, you must do two things: link with our framework: calabash.framework, and install a ruby gem as described below. You also need to link with Apple’s CFNetwork framework if you are not already using this.

=>For functional testing with Calabash iOS, you should create a whole separate target by duplicating your production target in Xcode.Calabash iOS consists of two parts: a client library written in Ruby, and calabash.framework, a server framework written in Objective-C (a Clojure/JVM version of the client is coming too). To use calabash you make a special test target in XCode that links with calabash.framework. The application is otherwise unchanged. The server framework will start an HTTP server inside your app that listens for requests from the client library.

PS: Calabash interacts with the UI elements in your app via accessibility labels. That’s how it knows which button to tap when you issue a command like Then I touch "reply". As the author of the feature file, you can determine the labels of the various UI elements using the niftyAccessibility Inspector in the iOS Simulator. To turn it on, follow these steps:

  1. Run your app in the iOS Simulator via Xcode
  2. Stop the app
  3. Swipe from left to right to go to the first screen
  4. Tap on Settings
  5. Tap on General
  6. Tap on Accessibility
  7. Turn the Accessibility Inspector toggle ON

Here is the example of one feature file (Login.feature) which we are going to run:-

Feature: Verification of the Login Functionality
  Scenario: Login the application with Valid credentials
    Given I am on Login screen
    When I enter the username "abodeqa" and password "funtesting"
    Then I should see the Home screen

The above feature file describes the acceptance criteria for the login feature which is already we have in Login.feature. 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. Here is an illustration:

calabash-ios

This generated a features skeleton dir for your tests:

$ tree -L 1 features/
features/
├──Login.feature
├── step_definitions
└── support

Running your Login.feature test now with the cucumber seems like(if app bundle path is in your location) :-

$ cd /path/to/your/iOS/project 
$ DEVICE=iphone OS=ios5 NO_LAUNCH=1 cucumber features/Login.feature

Now try running the feature my_first.feature with cucumber.

$ cucumber 
Feature: Verification of the Login Functionality
  Scenario: Login the application with Valid credentials
     Given I am on Login screen
     When I enter the username "abodeqa" and password "funtesting"
     AndI swipe left
     Then I should see the Home screen

  Scenario: Login the application with Valid credentials

... #different output here
Given I am on Login screen                 # features/step_definitions/my_first_steps.rb:1
When I enter the username "abodeqa" and password "funtesting"                 # features/step_definitions/my_first_steps.rb:20
And I swipe left                                # calabash-cucumber-0.9.127.pre1/features/step_definitions/calabash_steps.rb:190
Then I should see the Home screen   # features/step_definitions/my_first_steps.rb:128

1 scenario (1 passed)
4 steps (4 passed)
0m15.097s

If all went well, You will see the Simulator run with the app, If your app path is somewhere else, You can pass APP_BUNDLE_PATH=/location/of/app/ along with the cucumber command.

NOTE:- For writing step definitions ,Please refer to the coming posts………

HAPPY TESTING…. 🙂

 

Popular Posts

  • How to Connect Selenium To Existing Chrome Browser?
  • Top Mozilla Firefox Plugins For Better Productivity With Key Features!!
  • How To Run Selenium Tests In Brave Browser Using ChromeDriver?
  • Top Chrome Extensions For Better Productivity !!

Share this:

  • Tweet
  • More
  • Pocket
  • Email
  • Reddit
  • Share on Tumblr
  • Print
  • WhatsApp

Related

Automation Testing Software Testing automation with calabashcalabash automationCalabash Automation ToolCalabash one tool for all app automationCalabash with cucumberMobile Automation with CalabashMobile native app automation with Calabash

Post navigation

Previous post
Next post

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,582 other subscribers
  • Top Best Software Testing Trends to watch out in 2021
  • Top-Notch Mozilla Firefox Add-ons to Install
  • 10 Best FREE YouTube Video Downloader Apps For Year 2021.
  • WebDriverManager: New Way to handle driver binaries in Selenium
  • Requirement of Testing environment
  • How To Create S3 Bucket Command? | AWS CLI Commands
  • How To Use LS and CP command In AWS?

Top Posts & Pages

  • Reviews,Walkthrough And Inspection In Software Testing
    Reviews,Walkthrough And Inspection In Software Testing
  • How to Connect Selenium To Existing Chrome Browser?
    How to Connect Selenium To Existing Chrome Browser?
  • How to use Contains() and starts-with() function in Xpath
    How to use Contains() and starts-with() function in Xpath
  • 5 Commonly Asked Java String Question in Selenium Interview
    5 Commonly Asked Java String Question in Selenium Interview
  • Installation Testing and Test Cases For Good Installation Testing
    Installation Testing and Test Cases For Good Installation Testing
  • Test Cases To Test Software Updates Before Its Release
    Test Cases To Test Software Updates Before Its Release
  • Arrays in Java and its implementation in WebDriver
    Arrays in Java and its implementation in WebDriver
  • SSH To Ubuntu Installed On VirtualBox | Putty To Ubuntu
    SSH To Ubuntu Installed On VirtualBox | Putty To Ubuntu
  • assertTrue(message,condition) in Selenium WebDriver and it's implementation
    assertTrue(message,condition) in Selenium WebDriver and it's implementation
  • Upload and Download file from FTP Server using Java FTP Client
    Upload and Download file from FTP Server using Java FTP Client
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
©2023 Abode QA | WordPress Theme by SuperbThemes
 

Loading Comments...