Calabash Setup

Calabash Setup


This overview provides step-by-step instructions for setting up calabash-android on Windows and explaining the basic components of a calabash-android test suite, with links to relevant resources provided throughout the document.

What are Cucumber and Calabash?

Cucumber is a software tool for writing and running automated acceptance tests using a behavior-driven development style.  Test scenarios are written in a domain specific language called Gherkin, which enables the step-by-step description of scenarios in a plain language format intended to be readable by individuals without any programming knowledge.  Regular expressions are used to match test steps described in Gherkin to step definitions written in Ruby.  These step definitions call methods from an automation API suitable for the target application.  Calabash provides these APIs for interacting with native iOS and Android apps.


To create a Calabash test suite for an Android application with calabash-android on Windows, you need a few things in place.

  1. Java SDK
  2. Android SDK from Google
  3. Ruby
  4. Ruby DevKit
  5. Apache Ant
  6. Calabash Android ruby gem
  7. An Android device connected via USB, or the Genymotion Android emulator which is much more stable with Calabash than the emulator from the Android SDK
  8. APK for the application under test

Calabash-Android Setup for Windows

  1. Download and install Oracle JDK:
  2. Download and install the Android SDK from Then add the tools and platform-tools directories from the SDK to your PATH environment variable.
  3. Download and install Ruby 1.9.3 (check the option to add Ruby to PATH during installation)
  4.  Download and install apache ant (You can use the self-extractor or WinAnt, but if you use the self-extractor, create an environment variable called ANT_HOME and set it to the directory you extracted it to).
  5.  Download Ruby DevKit from (tdm-32-4.5.2 for Ruby 1.9.3), cd to directory you installed it in and run: ruby dk.rb init
  6. Check to make sure the config.yml file contains the path to Ruby 1.9.3 and run: ruby dk.rb install
  7. Install Calabash-Android by running: gem install calabash-android
  8. Install the Genymotion Android emulator, available from:

To generate a cucumber skeleton for your Calabash-Android project:

  1. Create a directory for your calabash project files and cd to it
  2. From the directory you created, run: calabash-android gen

Using Calabash Console

The Calabash console allows you to interact with the application under test directly using the calabash API.  This is useful for exploring and examining user interface elements and gathering the identifying characteristics necessary to write automation code.

  1. calabash-android resign <path_to_apk>
  2. calabash-android console <path_to_apk>
  3. Start Genymotion Android emulator
  4. In calabash console, run:



Now the calabash-console can be used interactively.

Running a Calabash-Android test suite

To run a Calabash-Android test suite, run:

calabash-android run <path_to_apk>

For more detailed output, you can use the –verbose option.

For colored output from cucumber, install ANSICON:

  1. Unzip the file from
  2. Navigate to the unzipped directory from a command prompt
  3. Type ansicon –i to install ANSICON

Now you should see colored output from your cucumber tests.  If you get an error message when you run ansicon, try installing an older version.

More Information:

Components of Calabash-Android:

Gherkin syntax is concisely described here:

Note the Feature Introduction and Given-When-Then links on the bottom of the page.

Cucumber step definitions are described here:

The Calabash-Android Ruby API is described here:

Other Ruby methods that are useful can be found by examining the source code found in operations.rb:

Note that undocumented methods are more likely to change than the documented methods.  You may find it instructive to see how the methods described in operations.rb are built using the documented API methods as building blocks.

 Useful Links

Xamarin Test Cloud is a cloud-based service that allows you to run Calabash tests against hundreds of different devices:

Xamarin Calabash guide:

Calabash-Android Ruby API:

Calabash-Android Canned Steps:

Calabash-Android API code:
Calabash-Android Query Syntax:

Gherkin Syntax:

Gherkin Scenario Outlines and tables:

Criticism of Cucumber:

Cucumber Step Definitions:

Cucumber RegEx Cheat Sheet:

 Calabash-iOS links:

Calabash-iOS setup (using Xcode):
Calabash-iOS setup with Xamarin Studio:

Calabash-iOS setup with Xamarin Test Cloud Agent:

Calabash-iOS Ruby API:

Calabash-iOS predefined steps:

Calabash-iOS query syntax: