Skip to content
This repository was archived by the owner on Jun 22, 2021. It is now read-only.

Commit abd5456

Browse files
committed
Merge branch 'master' of github.com:alexmx/ios-ui-automation-overview
2 parents 62945ee + 9d0adb6 commit abd5456

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# iOS UI Automation Overview
2+
[![Twitter: @amaimescu](https://img.shields.io/badge/contact-%40amaimescu-blue.svg)](https://twitter.com/amaimescu)
3+
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/alexmx/ios-ui-automation-overview/blob/master/LICENSE)
4+
25
An overview of popular iOS UI Automation solutions which will help you to decide which one to use.
36

47
Covered solutions:
@@ -78,7 +81,17 @@ Afer `bundler` is installed run:
7881
```bash
7982
bundle install
8083
```
81-
If you get an error related to `nokogiri` installation, please consider this installation [guide](http://www.nokogiri.org/tutorials/installing_nokogiri.html) for `nokogiri` gem.
84+
If you get an error related to `nokogiri` installation, please consider the steps below:
85+
```bash
86+
# Install libxml2 library using homebrew
87+
brew install libxml2
88+
89+
# Install 'nokogiri' gem manually
90+
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri:1.6.6.4 -- --with-xml=/usr/local/Cellar/libxml2/2.9.2
91+
92+
# Continue installation of dependencies
93+
bundle install
94+
```
8295

8396
For **Appium** we will need to install Appium server separately. For this demo we will use Appium server standalone app.
8497
![Appium Standalone App](/assets/appium.png)
@@ -119,7 +132,7 @@ xcodebuild -project Contacts.xcodeproj \
119132
-derivedDataPath "build" \
120133
build
121134

122-
cd appium && cucumber
135+
cd appium && bundle exec cucumber
123136
```
124137

125138
**Run with fastlane:**
@@ -139,7 +152,7 @@ xcodebuild -project Contacts.xcodeproj \
139152
-derivedDataPath "build" \
140153
build
141154

142-
cd calabash && APP=\"../Build/Products/Debug-iphonesimulator/Contacts-cal.app\" cucumber
155+
cd calabash && APP="../Build/Products/Debug-iphonesimulator/Contacts-cal.app" bundle exec cucumber
143156
```
144157

145158
**Run with fastlane:**
@@ -161,7 +174,7 @@ xcodebuild -project Contacts.xcodeproj \
161174
-derivedDataPath "build" \
162175
build
163176

164-
cd ui-automation && ./run-tests.sh "../build/Products/Debug-iphonesimulator/Contacts-test.app" "iPhone 5s"
177+
cd ui-automation && ./run-tests.sh "../build/Products/Debug-iphonesimulator/Contacts-test.app" "iPhone 6 (9.1)"
165178
```
166179

167180
**Run with fastlane:**

ui-automation/run-tests.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/bin/sh
22

3+
realpath() {
4+
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
5+
}
6+
37
XCODE_PATH=`xcode-select -print-path`
48
TRACETEMPLATE="/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate"
5-
APP_LOCATION=$1
9+
APP_LOCATION=$(realpath "$1")
610
DEVICE_ID=$2
711

812
if [ ! $# -gt 1 ]; then
@@ -12,12 +16,6 @@ if [ ! $# -gt 1 ]; then
1216
exit -1
1317
fi
1418

15-
# If running on device, only need name of app, full path not important
16-
if [ ! "$DEVICE_ID" = "" ]; then
17-
RUN_ON_SPECIFIC_DEVICE_OPTION="$DEVICE_ID"
18-
APP_LOCATION=`basename $APP_LOCATION`
19-
fi
20-
2119
# Create junit reporting directory
2220
if [ ! -d "test-reports" ]; then
2321
mkdir test-reports
@@ -28,17 +26,17 @@ for script in specs/*
2826
do
2927
if [[ -f $script ]]; then
3028
echo $script
31-
instruments -w "$RUN_ON_SPECIFIC_DEVICE_OPTION" \
29+
instruments -w "$DEVICE_ID" \
3230
-t $TRACETEMPLATE \
3331
$APP_LOCATION \
3432
-e UIASCRIPT $script \
3533
-e UIARESULTSPATH /var/tmp | grep "<" > test-reports/test-results.xml
34+
35+
# cleanup the tracefiles produced from instruments
36+
rm -rf *.trace
3637
fi
3738
done
3839

39-
# cleanup the tracefiles produced from instruments
40-
rm -rf *.trace
41-
4240
# fail script if any failures have been generated
4341
if [ `grep "<failure>" test-reports/test-results.xml | wc -l` -gt 0 ]; then
4442
echo 'Build Failed'

0 commit comments

Comments
 (0)