Presenting Contus Bot - Our Newest Chatbot Solution for the World!Check it out

Automation of Mobile application testing using Calabash tool

Delivering a bug free and a top notch product is the prime responsibility of the quality assurance wing. Testers put their heart and soul in to testing and spot the slightest of bugs so as to ensure supreme quality. Unfortunately when too many software applications get stacked for testing, it becomes really a challenging task for the testers to execute diverse test cases successfully within the deadline. As the going becomes tedious, at times it takes a beating in the testing quality.

Being a quality analyst, I personally find manual testing to be very interesting as it helps me understand the miniscule intricacies of an application. But on the flip side it is a time taking process. So when a situation demands substantial task completion within a short span of time, I prefer using automation tools for testing as they are less time consuming and more accurate. In this blog, I thought of sharing some excerpts regarding Calabash, which happens to be one of my favorite testing tools.

What prompted me to write about Calabash?

 You might be wondering when there are so many testing tools available, what could be the reason for me to discuss about Calabash. That is because Calabash is an open source and a very user friendly testing tool. Especially, novice testers who aren’t familiar with programming languages like JavaScript, Python, etc. will find this tool very handy.

An overview of Calabash

Calabash is an automation tool that can be used for both iOS and Android applications. In Calabash, the test scenarios are written in Cucumber, which is a user-friendly script. The script pattern is very much similar to a plain conversation in English. All the statements in cucumber are defined using Ruby language. In Calabash, a cucumber statement must be defined only once but can be repeated for different scenarios of a cucumber script. Now let me illustrate as to how ruby and cucumber are used in tandem. The following scenario explains the account sign in process.

Cucumber code:

panel

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 => ‘abc@gmail.com’})

end

Then (/^I enter Sign in Password $/) do

query(“* id:’password’”,{:setText => 123456})

end

+

Then (/^I print Sign in successfull $/) do

puts ‘Sign in successful’

end

If you observe the above code you will decipher the following.

1. Cucumber file always starts with the Feature Keyword. To be more clear, Feature represents the start of testing and can be used only once in a cucumber file

2. Scenario can be used only once in a test case and it indicates the start of a test case

3. “Given, When, Then” are keywords that can be used any number of times.

4. Calabash is case sensitive. For example, consider the cucumber statement “I enter Sign in Email ID “. The same letter case should be followed in Ruby as well.

5. Here you might have noticed that all the statements in cucumber are defined in ruby except “Then I touch the “Submit” text”. This is because the text structures are predefined in calabash libraries.

I have summarized the pros and cons of calabash below.

Pros:

  • Basic programming knowledge is suffice to understand.

  • Since it supports Emulators, there is no need to use external devices.

  • It is platform independent.

  • Less time consuming compared to manual testing.

Cons:

Calabash, in spite of being an effective testing tool has some shortcomings like

  • Non availability of an IDE or an Editor.

  • Supports only Ruby language.

  • You don’t get much online support.

Apps that were tested using Calabash

  • Groupbuy

  • StarDeals

  • TweetyDeal

  • Pulse Auto Dealership

  • Health Above 60 etc.

From my experience, I found Calabash to be very helpful in functional testing and regression testing. Earlier I used to spend around 8 hours in manual testing alone. Thankfully by using Calabash I could save a large chunk of time. As a result, I was able to handle multiple tasks effortlessly and concentrate more on the quality.

Leave a Reply

Be the First to Comment!