Calabash Quick Start for Android Studio
Let us know how you feel about this
last updated: 2016-09
In this quick start we'll add a Calabash feature to an Android application created in Android Studio and run the test locally and in Xamarin Test Cloud. The test will confirm that the application will display the correct error message when the user enters a credit card number that is too short. Conceptually, the test will consist of the following steps:
- Wait for the Activity to load – Typically an Activity is quick to load, but to be safe the test will verify that the correct Activity has loaded.
- Enter 15 digits for the credit card number – The test must simulate data entry.
- Tap the
Validate Credit Cardbutton – Simulate what a user would do to call the validation logic.
- Confirm the Error Message – Finally, the test should assert the application has displayed the correct error message.
The following screenshot is a sample of the application:
There is a lot to cover in this guide, which will be broken up into the following sections:
- Installing the Calabash Sandbox – discusses how to quickly get an environment setup using the Calabash Sandbox.
- Build an APK ‐ will briefly cover how to create an APK to use for testing.
- Writing the First Test – Covers creating a simple and then running it locally in an Android emulator.
- Creating a Xamarin Test Cloud Team and Test Run – In this section we will create a Team for this new application and select the Android devices that our tests should run on.
- Running the Test in Xamarin Text Cloud – Finally, we will submit the test to Xamarin Test Cloud and run it on real devices in the cloud.
This quick start assumes that you already have your computer configured for Android application development, and that you are using Android Studio 2.2 or higher. You must have the
ANDROID_HOME environment variable set.
It is recommended to use Ruby 2.3.1 or higher. If you are using Windows, you must first install Ruby. Calabash does not support the default Ruby that is installed with OS X.
Make sure you download the sample Android Studio project and expand it. This project targets API level 16 or higher.
A Test Cloud account is required if you wish to submit the tests to Xamarin. It is not necessary to have a Test Cloud account if you only wish to run the tests against a local Android emulator.