Menu
AWS Device Farm
Developer Guide (API Version 2015-06-23)

Working with Calabash for Android and AWS Device Farm

Device Farm provides support for Calabash for Android.

Device Farm also provides a sample Android application along with links to working tests in three Android automation frameworks, including Calabash. You can download the Device Farm sample app for Android on GitHub.

What Is Calabash?

Calabash is a mobile testing framework that enables automated user interface acceptance tests written in Cucumber to be run on Android apps. For more information, see the Welcome to Calabash for Android repository on GitHub.

Version Information

Currently, Device Farm supports Calabash version 0.9.0.

Prepare Your Android Calabash Tests

Your Android Calabash tests must be contained in a .zip file before you upload them to Device Farm. This .zip file must contain the following structure:

Copy
my-zip-file-name.zip `-- features (directory) |-- my-feature-1-file-name.feature |-- my-feature-2-file-name.feature |-- my-feature-N-file-name.feature |-- step_definitions (directory) | `-- (.rb files) |-- support (directory) | `-- (.rb files) `-- (any other supporting files)

Upload Your Android Calabash Tests

Use the Device Farm console to upload your tests:

  1. Sign in to the Device Farm console at https://console.aws.amazon.com/devicefarm.

  2. In the list of projects, choose the option next to the project where you want to upload your tests.

    Tip

    If the list of projects is not displayed, then on the secondary navigation bar, for Projects, choose the name of the project where you want to upload your tests.

    To create a new project, follow the instructions in Create a Project.

  3. If the Create a new run button is displayed, then choose it.

  4. On the Choose your application page, choose Upload.

  5. Browse to and choose your Android app file. The file must be an .apk file.

  6. Choose Next step.

  7. On the Configure a test page, choose Calabash, and then choose Upload.

  8. Browse to and choose the .zip file that contains your tests. The .zip file must follow the format described in Prepare Your Android Calabash Tests.

  9. Choose Next step, and then complete the remaining on-screen instructions to select devices and start the run.

Taking Screenshots in Android Calabash Tests

You can take screenshots as part of your Android Calabash tests.

Android Calabash provides a set of predefined steps for taking screenshots. For details, see the "Screenshots" section of the Canned steps page in the Calabash Android repository on GitHub.

Alternatively, you can define a custom step inside of a Ruby (.rb) file to call the screenshot_embed function, which creates a screenshot and saves it to a directory you define. For example, the following code example creates a screenshot and saves it to the /my/custom/path directory with a file name of screenshot_seconds-since-Epoch:

Copy
screenshot_embed(:prefix => "/my/custom/path", :name => "screenshot_#{Time.now.to_i}")

Additional Considerations for Android Calabash Tests

Device Farm replaces some Calabash hooks so that Android Calabash tests will run on devices in Device Farm, but it does not modify Android Calabash tests.