Calabash- Automation Tool for Android Testing

October 23, 2019

calabash-img

 

Calabash is an automation testing tool that can be used for both iOS and Android applications. The test scenarios are written in Cucumber, which is a user-friendly script.

This open-source tool is developed and maintained by Xamarin. The main advantage of Cucumber script is the pattern is very similar to a plain conversation in English and all the statements are defined by using Ruby language.

In Calabash, a cucumber statement must be defined only once but can be repeated for different scenarios of a cucumber script.

Why Calabash?

The libraries in the calabash framework help to interact with the Android and iOS apps.
There are two different projects on GitHub that make Calabash possible:

  • calabash-android – for Android
  • calabash-ios – for iOS

Calabash can work with any Ruby-based test framework. Before you start installing the Calabash, install Ruby on your machine.

Sample Cucumber code:

Feature: Calabash Test for Sign in Functionality
Scenario: Sign in to an account
Given I am looking at Home page
Then I touch the Sign In Button
Then I wait for Sign In page to appear
Then I enter Sign in Email ID
Then I enter Sign in Password
Then I touch the “Submit” text
Then I print Sign in successful
Ruby code:
Given (/^I am looking at Home Page$/) do
wait_for(:timeout =>60) { element_exists(“* id: ‘Home_header’”)}
end
Then (/^I touch the Sign In Button $/) do
touch(query(“* id:’Sign In Button’”))
end
Then (/^I wait for Sign In page to appear $/) do
wait_for(:timeout =>60) { element_exists(“* id: ‘signin_header’”)}
end
Then (/^I enter Sign in Email ID$/) do
query(“* id:’emailaddresses’”,{:setText => ‘[email protected]’})
end
Then (/^I enter Sign in Password $/) do
query(“* id:’password’”,{:setText => 123456})
end

Pros:

  • Platform independent.
  • Time consumption is very low as compared to manual testing.
  • Basic programming knowledge suffices to understand.
  • Since it supports Emulators, there is no need to use external devices.

Cons:

  • Which supports only Ruby language.
  • Non availability of an IDE or an Editor.
  • Don’t get much online support.

Let us know the comments or lift queries and discussions over to our Twitter or Facebook.