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
export PATH=$PATH:$ANDROID_HOME/tools
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home


  • 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







Comments

Popular posts from this blog

Selenium Error "Element is not currently interactable and may not be manipulated"

Change Default Timeout and Wait Time of Capybara

Page-Object Pattern for Selenium Test Automation with Python

Performance Testing on CI: Locust is running on Jenkins

How to Set Shared Preferences in Espresso Test for Kotlin and Java