Setup Calabash-Android on Windows

Here list all the task that you will meet when run the Calabash. Choose where you want to start:


 
  1. Requirement: We use many tools to meet requirement for Calabash, you can use others tool to meet same requirement if you want.
  2. Setup Environment: To setup environment for running Calabash.
  3. Setup Project: Every new project should be setup before running.
  4. Before Run: TODO before you test the .apk.
  5. Run: Commands that you need for running the test.
  6. Resource: Link, article about Calabash.

Requirement

  1. Windows PowerShell
  2. Java Development Kit(JDK)
  3. Android SDK
  4. Ruby 2.3.1p112 maximum, rbenv - Ruby version management, bundle - gem management.
  5. Cucumber
  6. Calabash

Setup Environment

Installation
  1. PowerShell should already installed before version Window 7.
  2. Install JDK.
  3. Install Android Studio, that includes Android SDK and also IDE for developing Android.
  4. Install Ruby, Cucumber, Calabash by installing script.
    Please follow official instruction to install: Calabash installation for Windows.
    More detail about how installation process: Xamarin: Installing Calabash on Windows.
  5. Use calabash-sandbox to do test in clean environment.
Setup Environment Variable
Setup two library path:
  1. Java Development Kit(JDK)
  2. Android SDK directory
If you use Android Studio, you can find those path at your project “Module Setting” → SDK Location.
Search “environment variable” at Setting. Click “Environment Variable”.
Add new variable for:
  1. Variable Name: JAVA_HOME Value: <JDK Home Path>
  2. Variable Name: ANDROID_HOME Value: <ANDROID SDK Home Path>

Setup Project

These only needs to be done for the new project:
  1. Initial Cucumber scheme.
  2. Setup keystore for resign the .apk.
Initial Cucumber Scheme
Only do this to a new project.
In an empty project directory, you can use this command to generate a Cucumber skeleton:
calabash-android gen 
See more detail at: Generate Cucumber Skeleton
Setup Keystore
The .apk have to resign by the keystore you give. You can tell Calabash where to find the keystore:
calabash-android setup
It will ask you about:
  1. Location of keystore.
  2. Password for the keystore.
  3. Alias for the keystore.
You can change these setting later at file .calabash_settings
If there is no keystore for you, use debug keystore provide by Android SDK or generate one.
Debug keystore provide by Android SDK:
  1. Location: C:/Users/<UseName>/.android/debug.keystore
  2. Password: android
  3. Alias: androiddebugkey

Before Run

  1. Use sandbox to maintain your environment clean.
  2. Resign your .apk.
Sandbox
Use sandbox environment to ensure your test environment is clean.
calabash-sandbox
All the gem you install in sandbox can not be use at outside. Also, the gem installed outside will not effect in the sandbox.
Resign
Use this command to resign the .apk, after signed, it will replace original .apk.
calabash-android resign <ApkPath>
You only need to do this once per .apk.
Check more detail: Running Calabash Android

Run

Before you run, check these thing if your already done or not:
  1. Using calabash-sandbox as environment.
  2. You project already setup basic Cucumber skeleton.
  3. .apk is resigned (just need resign once).
  4. Test device is connected.
Find Your Device
Before you run, you could specify a real device, check all device available by adb :
adb devices
adb is a tool that can easily communicate with Android devices.
Find it under your Android SDK directory, execute it like:
C:\Users\<UserName>\AppData\Local\Android\sdk\platform-tools\adb devices
It will show:
List of devices attached
0123456789ABCDEF        device
We take 0123456789ABCDEF as DeviceID.
Run It
Run
calabash-android run <ApkPath>
Run at specific device:
calabash-android run <ApkPath> ADB_DEVICE_ARG=<DeviceID>
Run only for a specific feature file.
calabash-android run <ApkPath> <FeatureFilePath>
You can put the .apk under same directory, so that will be easier to find.

Resource

  1. calabash-android
  2. Xamarin

留言

  1. Thanks for sharing this beautiful blog. I am really appreciate your effort and dedication keep sharing this information.
    If you facing with your epson printer just dial our Epson Printer Toll Free Number 1800-436-0509 and get free Tech Support For Epson Printer

    回覆刪除

張貼留言

這個網誌中的熱門文章

【給程式新手】陰魂不散的物件導向?

【教學】Facebook SDK 首部曲:登入Facebook(這是我的一小步...卻是人類...咦?這麼多人啊?)

【教學】Facebook SDK 前傳:準備Social一下