Mobile Test Automation: Calabash, Cucumber

Mobile test automation is just another era for test automation since the trends for mobile devices are increasing. For more sophisticated testing approach, we should apply the technics what we have learnt from the test automation for desktop/web applications. As test automation is a part of continuos development, it should be run after each commit to test environment. For mobile application we can use the same method to be more responsible. 

Cucumber is used describe the test cases and it very easy to understand for anyone so we can use it for user behaviour as behaviour driven development, BDD. Capybara is a library to simulate user behaviour for just web application. However we can use Calabash for mobile test automation.  It means that we can use Calabash and Cucumber together for mobile test automations. As in Capybara, in Calabash there are not much functions to learn. It has basically, finding element, inserting text into textEdit fields, clicking and assertion functions. The important keywords are query, touch, element_exists, enter_text.

How to install Calabash

Install Calabash:

gem install calabash-cucumber

Create Android Virtual Devices 

Install Android Development Tools (ADT) 
Create Android Virtual Devices (AVD)

Configure Android Environment

  • for bash shell

export ANDROID_HOME=/Users/tejasvi/Documents/proj/android/adt/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools

  • for fish shell 

set ANDROID_HOME $HOME/Android/sdk/
set PATH $HOME/Android/sdk/tools $PATH
set PATH $HOME/Android/sdk/platform-tools $PATH
set JAVA_HOME /Library/Java/JavaVirtualMachines/1.8.0_20-b26/Contents/Home/bin/java

Create Calabash Project

calabash-android gen

Run Calabash Project

  • Running if there is one devices for (abd devices)
calabash-android run app/bin/android.apk
  • Running on a specific device
~ adb devices
List of devices attached
0646944421157e89    device
emulator-5554   offline
calabash-android run app/bin/android.apk ADB_DEVICE_ARG=0646944421157e89
  • Running on a specific devices for specific test cases which are tag as t:
calabash-android run app/bin/android.apk ADB_DEVICE_ARG=0646944421157e89 --tag @t


Popular posts from this blog

Testing WEB Sevices and Automating SOAP Services

Performance Testing on CI: Locust is running on Jenkins

Change Default Timeout and Wait Time of Capybara

Performance Testing on CI: Integration of Locust and Jenkins

Create an Alias for Interactive Console Work: Selenium and Capybara