You are on page 1of 5

Installation

Prerequisites:
Ruby 2.0 need to be installed in local mac machine.

Setup:
1. The following gems need to be installed (this make take some time because of dependencies)
gem install calabash-cucumber

gem install require_all


gem install data_magic

(Note it may needs to run sudo gem install calabash-cucumber if it gets ERROR: While executing
gem ... (Gem::FilePermissionError)).
ex :- for gem install calabash-cucumber

2. Setup your project for Calabash-iOS.


calabash-ios setup (Answer the questions and read the output :)
calabash-ios needs application source code to be built and setup in local machine.

Need to go to the NMCFA (which contain .xcodeproject) folder in terminal for setup the project.
ex: - Administrators-Mac-mini-23:NMCFA bikash$ calabash-ios setup

3. Generate a skeleton features folder for the tests


calabash-ios gen (this also copies the scripts irb_iosX.sh for "interactive development" into your
current dir)
4. Launch Xcode by clicking on .xcodeproject, And build the project using the -cal scheme

5. After build and run the source code the, Started LPHTTP server on port 37265
message should be displayed on the console on successful setup with calabash.

6. Pre - Conditions For Running Automation Scripts:


A) Change the APP_BUNDLE_PATH in launch.rb file.

Follow the below steps for changing the APP_BUNDLE_PATH


1. Path to locate the Launch.rb file in scripts: NM_Func_Atmn/features/support/launch.rb
2. Copy the APP_BUNDLE_PATH from the below shown example:
/Users/bikash/Library/Developer/Xcode/DerivedData/NMCFA-dqurnlonxwrnuablyynkpdarwyea/Build/Products/Debugiphonesimulator/NMCFA-cal.app
3. Paste the copied path to APP_BUNDLE_PATH in launch.rb file
4. Save the file.
B) Location pop up in store screen should be handled manually.
Follow the below steps for handling the Location pop up manually
1. Launch the app.
2. Tap on menu icon.
3. Tap on store displayed in menu icon
4. Verify the "NM app" Would Like to Use Your Current Location displayed.
5. Tap on "Don't Allow" button.

7. Run the generated test on Simulator:

Need to go to the NM_Func_Atmn folder in the terminal for running the test scripts.

#iPhone Test Run


cucumber DEVICE=iphone --tags @iphone -o test-reports -f html -o NM_iphone_report.html
SDK_VERSION=6.1
#iPad Test Run
cucumber DEVICE=ipad --tags @ipad -o test-reports -f html -o NM_ipad_report.html
SDK_VERSION=6.1
(These will run the scripts and generate the reports in .html file)

#iPhone Test Run


cucumber DEVICE=iphone --tags @iphone -o test-reports -f junit -o NM_iphone_report
SDK_VERSION=6.1
#iPad Test Run
cucumber DEVICE=ipad --tags @ipad -o test-reports -f junit -o NM_ipad_report SDK_VERSION=6.1
(These will run the scripts and generate the reports in .xml file)

8
. Run the generated test on Device:
Calabash iOS supports running tests on physical devices. Executing a test on a physical device is quite easy, but
there are a few things to be aware of.
1) Make sure the app you are running on device is installed on the device and is properly linked with Calabash iOS
(i.e., prints "Calabash Server" in the log).
2) Wifi must be enabled on the device. Write down its IP-address. Make sure you don't have any firewall or antivirus
software blocking communication between iDevice and Mac.
3) Finally, you must run cucumber with the DEVICE_ENDPOINT environment variable set to http://ip:37265, where ip
is the WiFi IP address of the device.

IMPORTANT NOTE
The version of Instruments that ships with Xcode 5 does not allow testing on devices running iOS 5.

ex:

#iPhone Test Run

NO_LAUNCH=1 OS=ios5 DEVICE_ENDPOINT=http://192.168.1.37:37265

cucumber

DEVICE=iphone --tags @iphone -o test-reports -f html -o NM_iphone_report.html SDK_VERSION=6.1


#iPad Test Run
NO_LAUNCH=1 OS=ios5 DEVICE_ENDPOINT=http://192.168.1.37:37265 cucumber
DEVICE=ipad --tags @ipad -o test-reports -f html -o NM_ipad_report.html
SDK_VERSION=6.1

You might also like