It is only possible to test Android applications on Microsoft Windows. Testing iOS apps on Windows is not supported; you must use OS X for that. Windows Phone is not yet supported by Calabash or Xamarin Test Cloud. Calabash requires Ruby 2.0 or higher. Calabash is not supported on Ruby earlier than Ruby 2.0. Xamarin Test Cloud uses Ruby 2.3.1p112. For maximum compatibility with tests run locally and tests run in Test Cloud it is recommended that you use the same version while developing tests.
This guide was written with the following assumptions:
- Must have the Android SDK installed, and the ANDROID_HOME environment variable must be set with the path to the Android SDK directory
- The test author is comfortable with using Windows Powershell at the command line
- Must have installed Calabash Sandbox (Calabash Sandbox Installation)
- Must have installed Ruby (Ruby Installation on Windows)
What Is Calabash?
Calabash Framework, an Automated UI Acceptance Testing framework that allows you to write and execute tests that validate the functionality of iOS and Android Apps. It also introduces the concept of Behavior Driven Development (Cucumber) and explains how to configure iOS and Android applications to be able to use Calabash in them.
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 >>adb devices
- Attached devices list should be displayed.
Creating New Scripts
- Open the feature file and following lines or create your own feature file with your script
Sample feature file
- Open the Step Definition file & Define the method into *.rb file Or create your own step definition file in step_definitions
Sample step definition file
Execute the project
To execute the project, use command below
>>calabash-android run “APK Path” features\”feature file Path” –tags “tag name”
(tag name is optional)