Setup Calabash-Android on Windows
- Requirement: We use many tools to meet requirement for Calabash, you can use others tool to meet same requirement if you want.
- Setup Environment: To setup environment for running Calabash.
- Setup Project: Every new project should be setup before running.
- Before Run: TODO before you test the .apk.
- Run: Commands that you need for running the test.
- Resource: Link, article about Calabash.
Requirement
- Windows PowerShell
- Java Development Kit(JDK)
- Android SDK
- Ruby 2.3.1p112 maximum, rbenv - Ruby version management, bundle - gem management.
- Cucumber
- Calabash
Setup Environment
Installation
- PowerShell should already installed before version Window 7.
- Install JDK.
- Install Android Studio, that includes Android SDK and also IDE for developing Android.
- 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. - Use
calabash-sandbox
to do test in clean environment.
Setup Environment Variable
Setup two library path:
Setup two library path:
- Java Development Kit(JDK)
- 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:
Add new variable for:
- Variable Name:
JAVA_HOME
Value:<JDK Home Path>
- Variable Name:
ANDROID_HOME
Value:<ANDROID SDK Home Path>
Setup Project
These only needs to be done for the new project:
- Initial Cucumber scheme.
- 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:
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:
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:
- Location of keystore.
- Password for the keystore.
- Alias for the keystore.
You can change these setting later at file
If there is no keystore for you, use debug keystore provide by Android SDK or generate one.
.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:
- Location:
C:/Users/<UseName>/.android/debug.keystore
- Password:
android
- Alias:
androiddebugkey
Before Run
- Use sandbox to maintain your environment clean.
- Resign your .apk.
Sandbox
Use sandbox environment to ensure your test environment is clean.
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.
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
Check more detail: Running Calabash Android
Run
Before you run, check these thing if your already done or not:
- Using calabash-sandbox as environment.
- You project already setup basic Cucumber skeleton.
- .apk is resigned (just need resign once).
- Test device is connected.
Find Your Device
Before you run, you could specify a real device, check all device available by
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.
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