You are on page 1of 4

Calabash-android is a great little test automation tool for functional testing of Android applications that

uses the simple English test script creation of Cucumber to automate your application. It lets you
automate testing with little or no coding.
Here is what you need to get started with calabash-android.
Install Android, Ruby, Cucumber and Calabash
1. Install the android-sdk to run the emulator.
Install Ruby on your system.
Run the command gem install cucumber! in cmd to install Cucumber on your system. After successful
e"traction check its #ersion and update if necessary.
$. Run the command gem install calabash-android! in cmd to install calabash-android on your
system.
Configure your System
1. %et the Android path to the following in system #ariables&
1
ANDROID_HOME=C:\Program Files\Android\android-sdk
$. %et the 'A(A)Home path to the following in system #ariables&
1
JAA_HOME=C:!Program Files!Ja"a!#dk$%&%'_$&
*. %et the A+,)H-.E path to the following in system #ariables&
1
AN(_HOME=D:\a)a*+e-an,-$%-%.
/. %et the path to the following in system #ariables&
1
)a,+=D:\a)a*+e-an,-$%-%.\/in0
Open your cmd and Install the Mobile Application
1. +a#igate to platform-tools directory.
Copy and paste your application inside this directory.
-pen the android-a#d manager and create a new emulator.
%tart your emulator and wait till it completely loads.
-pen cmd and na#igate to platform-tools. In cmd enter the following command&
1
1g,0ad/ ins,all 2o3r_4ile_name%a)k
$. After your app is installed0 #erify that it is present in menu screen of your emulator.
Create a New Directory
1. Create a new directory using the following command&
1
1g,0 mkdir D:\Firs,Pro#e*,
$. +ow generate the folder structure with feature file0 step-definitions0 support and lib using the
following command&
1
D:\Firs,Pro#e*,1g,0 *ala/as+-android gen
*. +ow sign your apk using its keystore path0 password and alias&
1
D:\Firs,Pro#e*,1g,0 *ala/as+-android se,3)
1e sure to note the complete path to debug.keystore. 2hen you are asked to enter the keystore
location0 enter the full path including the name& i.e D!Calabash!"eystore#name.
,he system will ask for debug.keystore of the application0 the password and the alias to sign your
apk. .calabash-settings file. ,he folder structure will be created upon completion.
/. +ow write following code in your feature file-3 my)first&
1
$
*
/
Fea,3re: 5eneral 43n*,ionali,2 4or In4an,A3di,
6*enario: Crea,e Ne7 6,ore
5i"en I am on ,+e 6)las+ 6*reen
(+en I )ress ,+e 89og in: /3,,on
4. 2rite the following code in step definitions&
1
$
*
/
4
5
6
;9OAD_PA(H%3ns+i4,<File%dirname<__FI9E__= > ?!%%!%%!li/?=
3nless ;9OAD_PA(H%in*l3de@<File%dirname<__FI9E__= >
?!%%!%%!li/?=
reA3ire ?*ala/as+-android!*ala/as+_s,e)s?
reA3ire ?3,ili,ies%r/?

5i"en !BI am on ,+e 6)las+ 6*reen;! do
7ai,_4or<$-'= Celemen,_eDis,s<E/3,,on id:?/,n9ogin?E=F
end
5. -pen cmd and run your code using following command&
1
D:\Firs,Pro#e*,1g,0 *ala/as+-android r3n 2o3r_4ile_name%a)k
6. If you will be automating the ne"t sprint of this application then you ha#e to re-build and re-
sign application to create a new test ser#er for each sprint using following command&
1
$
D:\Firs,Pro#e*,1g,0 *ala/as+-android /3ild 2o3r_4ile_name%a)k
D:\Firs,Pro#e*,1g,0 *ala/as+-android resign
2o3r_4ile_name%a)k
No $est Ser%er &rror
7ou sometimes get the following error while running apk through calabash which you can resol#e
using the method described below.
+o test ser#er found for this combination of app and calabash #ersion. Recreating test
ser#er. 89ibrary8Ruby8:ems81.;8gems8calabash-android-<./.*.pre/8lib8calabash-
android8helpers.rb&1/;&in =e"tract)md4)fingerprint>& +o .?4 fingerprint found&
@RuntimeErrorA
Recommended Solution
1. Copy your Calabash! folder ha#ing feature! file.
Baste it into your android workspace ha#ing gen0 res0 src folder.
+a#igate to new path and again run apk file.
$. +ow0 ,est ser#er will create inside your calabash folder.
Alternate Solution
1. Re-sign your apk file using command&
1
-D:\Firs,Pro#e*,1g,0 *ala/as+-android /3ild
2o3r_4ile_name%a)k
$. 1uild your apk file using command&
1
D:\Firs,Pro#e*,1g,0 *ala/as+-android resign
2o3r_4ile_name%a)k

You might also like