Other Topics, Software Technology - Development and Test Engineering, software testing

android test automation with Calabash


  • JDK is installed
  • Ruby 1.9+ is installed
  • Android SDK is installed

If you get errors like one show below while setting up Calabash then your in the right place to fix it.

$ calabash-android run <my_apk>
 No test server found for this combination of app and calabash version. Recreating test server.
 /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/lib/calabash-android/java_keystore.rb:15:in `initialize': undefined method `scan' for nil:NilClass (NoMethodError)
  from /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/lib/calabash-android/java_keystore.rb:104:in `new'
  from /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/lib/calabash-android/java_keystore.rb:104:in `keystore_from_settings'
  from /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/lib/calabash-android/java_keystore.rb:83:in `get_keystores'
  from /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/bin/calabash-android-build.rb:5:in `calabash_build'
  from /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/lib/calabash-android/helpers.rb:92:in `build_test_server_if_needed'
  from /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/bin/calabash-android-run.rb:16:in `calabash_run'
  from /Users/<user>/.rvm/gems/ruby-2.1.5/gems/calabash-android-0.5.4/bin/calabash-android:85:in `<top (required)>'

1.Setup Environment Variables

Assuming you have installed Ruby and Java (JDK) on your machine.Also make sure your have required gems installed. If not following calabash

export ANDROID_HOME=/Users/<user>/adt-bundle-mac-x86_64-20140702/sdk

2. Sign the application, First!

keytool -genkey -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"

This will generate a keystore in ~/.android/debug.keystore and you will use that for setting up .calabash_setting in the following steps

3. Generate a folder for your tests and set up. Navigate to the folder and run following 

android-calabash gen

This will generate a feature folder (cucumber folder structure)

4. Setup your calabash_setting run

calabash-android setup <path_to_your_apk> -v

This will generate a file .calabash_settings in current directory, open the file and set path to the key store generated in first step, which is android/debug.keystore…

5. Resign APK, If necessary

6. Run the application with

calabash-android run <your_apk>

7. Next Expected Error

calabash No connected devices

  • connect your device over USB
  • select an option that allows you to install and debug applications
  • make sure you have check Unknown sources under security 


8. Run tests again with calabash-android run <your apk>

Next write your tests using awesome cucumber 🙂







Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s