It’s an Automated User Interface Framework that allows tests to be written in Ruby using Cucumber. Calabash works by enabling automatic UI interactions within a Mobile application such as pressing buttons, inputting text, validating responses, etc. It can be configured to run on different Android and iOS devices, which provides real-time feedback and validations. In this tutorial, we will learn –

Why Calabash Automation? Calabash and BDD How to install Calabash Working with Calabash

Why Calabash Automation?

Calabash and BDD

Calabash is Behavior Driven Development (BDD). It is same as Test Driven Development (TDD), but instead of creating tests to describe the shape of APIs, application behavior is specified. BDD is a process in which multiple stakeholders weigh in to create a common understanding of what has to be built. BDD is helpful in building the right software and designing from the perspective of the business owner.

How to install Calabash

Part I) Install Java JDK – Refer to this guide – /install-java.html Part II) Download and install Ruby. Step 1) Download Ruby from the URL http://rubyinstaller.org/downloads

Step 2) Open the exe, follow the instructions on the screen. Once install is complete you will see the following screen. Click Finish.

Start Command Prompt with Ruby on Windows 10 & type below Command.

Part III) Download and install Android Step 1) Download Android Studio at https://developer.android.com/studio

Step 2) Open the exe, follow the on-screen instructions and complete installation. Click the finish button once done

Part IV) Install Calabash Android Step 1) In the console type install calabash-android. The install will start and will take some time to complete

Step 2) Once installation is done Type calabash-android version

Working with Calabash

Open the “calabash-android-0.9.0” folder. It resides at path C:\Ruby23\lib\ruby\gems\2.3.0\gems\calabash-android-0.9.0. The folder names will change in synch with the ruby/ calabash version you install on your machine. Open the feature skeleton folder. Look out for this basic framework.

The *.feature file contains scenarios that we are going to automate. The method used by the feature file is written in *.rb file inside “step_definitions” folder. Common methods, environment setup, app installation and hooks should be placed inside “support” folder.

Resign & Build the app

Calabash-android resign *.apk Calabash-android build *.apk

Attach the device to the system /Open the emulator

Check device attached. Type command Attached devices list should be displayed.

How to Find the Element Locator

Open the console. Type the Command. calabash android console “APK Path” start_test_server_in_background

Above command launch the app on the device. To find the element locator use following command. query “*”

This will display all the element locators on the current screen.

Creating New Scripts

Open the feature file and following lines

Open the Step Definition file & Define the method into *.rb file.

Execute the test project

To execute the test project, use command below

Summary

Calabash is a new open-source framework, which helps automate and test any iOS or Android app. To work with Calabash, the test should be written in Ruby using Cucumber. It uses the concept of Behavior-driven development (BDD) It automates the code by dividing its job into the four following layers: First Layer Business Layer Technology Layer Final Layer