What is Calabash Tool
Description: Calabash is open source and it supports Cucumber, which allows writing tests in natural language that can be understood by business experts and non-technical QA. Calabash framework works by enabling UI interactions within an application, such as pressing buttons, entering texts, validating responses etc. It also provides a bridge that allows Cucumber tests to run and validate on iOS and Android. Calabash contains actual tests that are written in Gherkin, backed by Ruby language code, and run in the context of the Cucumber Framework. In Calabash, Features Definition files and Steps Definition files play important roles to run mobile automation.
Feature Definitions file: Feature Definitions file contains a scenario which is written in Gherkin language. For example, the following feature describes the scenario of credit card validation:
Scenario: Credit card number is too long
Given the user validates a credit card number that is 19-characters long
Then the user should see a validation messages.
Step Definition files: Step Definition files are like code-behind for the scenarios defined in Features file. For example, the following code contains required step definitions to run above credit card validation tests which is explained above: Given (/^I validate a credit card number that is (\d+) characters long$/) do |number_digits| touch ("textField marked:'CreditCardNumberFields'") keyboard_enter_texts("907" * number_digits.to_i) touch("button marked:'ValidateMessage'") end Then (/^User should see a validation message "(.*?)"$/) do | validation _message| text_view = query ("textView marked:'ValidationMessagesField' {text CONTAINS '#{ validation _message}'}") raise "A validation message '#{ validation _message}' is not visible in the View." unless text_view.any?