SlideShare a Scribd company logo
Setting Apple’s
UIAutomation Free
with Appium
Dan Cuellar
d@zoosk.com
Lead Software Engineer, Test Team
Overview
 The Problem
 The Solution
 Run UIAutomation From The Command Line
 Break It Out Of Javascript
 Control it in Real-Time
 How to Code With Appium
 Demo
 Odds & Ends
The Problem
The Problem w/ UIAutomation
 runs only in Instruments.app
 must be written in Javascript
 does not support realtime control
 many useful js methods (e.g. HTTP requests) have been
removed
 difficult to build libraries and re-use code
 cannot integrate w/ existing Selenium automation
 requires adding http servers to your app’s source code
The Solution
Solving the Problem
 need command line control
 needs to run on the simulator and real devices
 need to break out of javascript
 need realtime control
 should not require you to add code to your app
 shoud not require the application source code
Command Line Control
 /usr/bin/instruments
 -t templatePath (path to Automation.tracetemplate)
 (path to compiled ios application)
 -e UIASCRIPT (path to UIAutomation javascript test)
 -e UIARESULTSPATH (path where results will be saved)
 [-w device udid]
 /usr/bin/xcodebuild (run inside project.xcodeproj)
 -sdk (sdk version)
 -target (build target)
 [-scheme (scheme)]
 TARGETED_DEVICE_FAMILY=1|2 (1=iPhone, 2=iPad)
Breaking Out Of Javascript
No HTTP Web Requests in UIAutomation JS
However…
host.performTaskWithPathArgumentsTimeout() can run all
your favorite shell commands
so with friends like cat, curl, and python who needs
Javascript and its HTTP web request methods
… and Don’t Forget the AppleScript (comes in handy when
you need to dismiss OS permissions dialogs)
Making It Real-Time
 Technique 1, file based communication
 Javascript loop looking for sequentially number files in a
predetermined folder for commands
 Have your program write raw javascript to the file
 Read the file using cat
 Run the command using eval()
 Write the sequentially numbered response file using
whatever you like (I chose python)
 Technique 2, setup a proxy web service
 Curl to ask if there’s a command you should run
 Curl back posting the result
Result
 Now you can control UIAutomation from any language
that can write files or make web requests
 You can reuse all that non javascript based (java, c#,
python, ruby, php) automation code you have for your
selenium tests
 Run tests that use a web browser and an iOS device at the
same time
 The possibilities are endless
Coding w/ Appium
Pre-Requisites
 install Xcode
 install Xcode Command Line Tools
 Set up a ~/.appium file
[appium]
username = an_osx_admin_username
password = an_osx_admin_password
OPTIONAL
 sudo easy_install pip
 sudo pip install bottle (required for webdriver server)
 sudo pip install selenium (required to code against the webdriver
server)
Running Appium
 git clone git://github.com/hugs/appium
 To launch the UIAutomation javascript interpretter
 python appium.py “/path/to/my.app”
 To launch the webdriver server
 Python server.py “/path/to/my.app”
Coding Appium like Selenium
from selenium import webdriver
command_url = “http://localhost:4723/wd/hub”
iphone = webdriver.DesiredCapabilities.IPHONE
driver = webdriver.Remote(command_url, iphone)
fields = driver.find_elements_by_tag_name('textField’)
fields[0].send_keys(3)
fields[1].send_keys(4)
buttons = driver.find_elements_by_tag_name('button’)
buttons[0].click()
Demo
Odds & Ends
Failed Prototypes
 Applescript iOS Simulator Automation
 Did not work on actual devices
 Seemed to be highly sensitive to iOS and OS X version
 Not a reliable
 Javascript Server Within UIAutomation
 I could not get a server booted up while running in
Instruments
Pitfalls
 Bug in UIAutomation causes 1 second delay between
commands
 I get around this by sending batches of commands
 Noticed NIBs and XIBs are supported while storyboards
are a more of a crapshoot
 It’s tricky to make elements accessible in objective C
 Some controls (UISegmentedControl) are missing supported
accessibility methods
 Applying a label to text will hinder your ability to read the
text in the control (you need to encapsulate it)
Resources
Appium Project
 https://github.com/hugs/appium or
http://appium.io
Discussion
 https://groups.google.com/d/forum/appium-discuss

More Related Content

PPTX
Setting Apple's UI Automation Free with Appium
PPT
Functional Testing Swing Applications with Frankenstein
DOC
Selenium Automation Using Ruby
PPTX
Code igniter unittest-part1
PPTX
CodeIgniter Ant Scripting
PPTX
Selenium webcrawler
PDF
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
ODP
Integrating Selenium testing infrastructure into Scala Project
Setting Apple's UI Automation Free with Appium
Functional Testing Swing Applications with Frankenstein
Selenium Automation Using Ruby
Code igniter unittest-part1
CodeIgniter Ant Scripting
Selenium webcrawler
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Integrating Selenium testing infrastructure into Scala Project

What's hot (20)

PDF
Introduction to Selenium IDE
PDF
Selenium IDE
PPTX
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
PDF
Designing an effective hybrid apps automation framework
ODP
Automated ui testing with selenium. drupal con london 2011
PPTX
Automating with selenium2
PDF
Unit-testing and E2E testing in JS
PPTX
Test automation using selenium
PPT
Automating UI testing
PDF
Codeception presentation
PPT
Selenium ide material (1)
PDF
Automation Testing using Selenium
PDF
Web automation using selenium.ppt
ODP
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
PPTX
Selenium
PPT
Selenium
PDF
Automation Testing using Selenium Webdriver
PPTX
Automation using Javascript
PDF
Selenium web driver
Introduction to Selenium IDE
Selenium IDE
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Designing an effective hybrid apps automation framework
Automated ui testing with selenium. drupal con london 2011
Automating with selenium2
Unit-testing and E2E testing in JS
Test automation using selenium
Automating UI testing
Codeception presentation
Selenium ide material (1)
Automation Testing using Selenium
Web automation using selenium.ppt
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Selenium
Selenium
Automation Testing using Selenium Webdriver
Automation using Javascript
Selenium web driver
Ad

Viewers also liked (18)

PPTX
Decreasing false positives in automated testing
PDF
Introduction To Mobile-Automation
PPTX
Mobile Application Testing Training Presentation
PPTX
Api testing
PPTX
Next level of Appium
PPTX
Advanced Appium: SeleniumConf UK 2016
DOC
Mobile App Testing Checklist
PPTX
Mobile application testing
DOC
Test cases for testing mobile phone
PDF
Testing Techniques for Mobile Applications
PPTX
Mobile Application Testing
DOC
Manoj resume
PDF
Android UI Testing with Appium
PPT
PDF
Appium Mobile Test Automation like WebDriver
PPTX
Best Practices in Mobile CI (webinar)
PPTX
Mobile Automation Using Appium - vodQA Bangalore 2015
PPT
Android & iOS Automation Using Appium
Decreasing false positives in automated testing
Introduction To Mobile-Automation
Mobile Application Testing Training Presentation
Api testing
Next level of Appium
Advanced Appium: SeleniumConf UK 2016
Mobile App Testing Checklist
Mobile application testing
Test cases for testing mobile phone
Testing Techniques for Mobile Applications
Mobile Application Testing
Manoj resume
Android UI Testing with Appium
Appium Mobile Test Automation like WebDriver
Best Practices in Mobile CI (webinar)
Mobile Automation Using Appium - vodQA Bangalore 2015
Android & iOS Automation Using Appium
Ad

Similar to Setting UIAutomation free with Appium (20)

PPTX
Appium Overview - by Daniel Puterman
PPT
Using Selenium to Test Native Apps (Wait, you can do that?)
PPT
The Future of Selenium Testing for Mobile Web and Native Apps
PPTX
Automation testing on ios platform using appium
PPTX
Cross platform mobile UI automation testing
PPTX
Appium overview (Selenium Israel #2, Feb. 2014)
PPTX
Advanced Appium
PPTX
Appium on mac platform
PDF
Mobile automation using appium.pptx
PPTX
Appium solution
PPTX
Appium - test automation for mobile apps
PPTX
appiumpresent-211128171811.pptx projet de presentation
PDF
The Present and Future of Mobile Test Automation with Appium
PPTX
Appium Presentation
PDF
Native iphone app test automation with appium
PDF
Appium Introduction
PPTX
XCUITest for iOS App Testing and how to test with Xcode
PDF
手機自動化測試和持續整合
PDF
ApppiumDoc_version2015
PPTX
Appium.pptx
Appium Overview - by Daniel Puterman
Using Selenium to Test Native Apps (Wait, you can do that?)
The Future of Selenium Testing for Mobile Web and Native Apps
Automation testing on ios platform using appium
Cross platform mobile UI automation testing
Appium overview (Selenium Israel #2, Feb. 2014)
Advanced Appium
Appium on mac platform
Mobile automation using appium.pptx
Appium solution
Appium - test automation for mobile apps
appiumpresent-211128171811.pptx projet de presentation
The Present and Future of Mobile Test Automation with Appium
Appium Presentation
Native iphone app test automation with appium
Appium Introduction
XCUITest for iOS App Testing and how to test with Xcode
手機自動化測試和持續整合
ApppiumDoc_version2015
Appium.pptx

Recently uploaded (20)

PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
System and Network Administration Chapter 2
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Transform Your Business with a Software ERP System
PDF
AI in Product Development-omnex systems
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
medical staffing services at VALiNTRY
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
System and Network Administraation Chapter 3
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Introduction to Artificial Intelligence
Softaken Excel to vCard Converter Software.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
System and Network Administration Chapter 2
Reimagine Home Health with the Power of Agentic AI​
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Essential Infomation Tech presentation.pptx
Transform Your Business with a Software ERP System
AI in Product Development-omnex systems
PTS Company Brochure 2025 (1).pdf.......
Adobe Illustrator 28.6 Crack My Vision of Vector Design
medical staffing services at VALiNTRY
Understanding Forklifts - TECH EHS Solution
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
System and Network Administraation Chapter 3
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Odoo Companies in India – Driving Business Transformation.pdf
Introduction to Artificial Intelligence

Setting UIAutomation free with Appium

  • 1. Setting Apple’s UIAutomation Free with Appium Dan Cuellar d@zoosk.com Lead Software Engineer, Test Team
  • 2. Overview  The Problem  The Solution  Run UIAutomation From The Command Line  Break It Out Of Javascript  Control it in Real-Time  How to Code With Appium  Demo  Odds & Ends
  • 4. The Problem w/ UIAutomation  runs only in Instruments.app  must be written in Javascript  does not support realtime control  many useful js methods (e.g. HTTP requests) have been removed  difficult to build libraries and re-use code  cannot integrate w/ existing Selenium automation  requires adding http servers to your app’s source code
  • 6. Solving the Problem  need command line control  needs to run on the simulator and real devices  need to break out of javascript  need realtime control  should not require you to add code to your app  shoud not require the application source code
  • 7. Command Line Control  /usr/bin/instruments  -t templatePath (path to Automation.tracetemplate)  (path to compiled ios application)  -e UIASCRIPT (path to UIAutomation javascript test)  -e UIARESULTSPATH (path where results will be saved)  [-w device udid]  /usr/bin/xcodebuild (run inside project.xcodeproj)  -sdk (sdk version)  -target (build target)  [-scheme (scheme)]  TARGETED_DEVICE_FAMILY=1|2 (1=iPhone, 2=iPad)
  • 8. Breaking Out Of Javascript No HTTP Web Requests in UIAutomation JS However… host.performTaskWithPathArgumentsTimeout() can run all your favorite shell commands so with friends like cat, curl, and python who needs Javascript and its HTTP web request methods … and Don’t Forget the AppleScript (comes in handy when you need to dismiss OS permissions dialogs)
  • 9. Making It Real-Time  Technique 1, file based communication  Javascript loop looking for sequentially number files in a predetermined folder for commands  Have your program write raw javascript to the file  Read the file using cat  Run the command using eval()  Write the sequentially numbered response file using whatever you like (I chose python)  Technique 2, setup a proxy web service  Curl to ask if there’s a command you should run  Curl back posting the result
  • 10. Result  Now you can control UIAutomation from any language that can write files or make web requests  You can reuse all that non javascript based (java, c#, python, ruby, php) automation code you have for your selenium tests  Run tests that use a web browser and an iOS device at the same time  The possibilities are endless
  • 12. Pre-Requisites  install Xcode  install Xcode Command Line Tools  Set up a ~/.appium file [appium] username = an_osx_admin_username password = an_osx_admin_password OPTIONAL  sudo easy_install pip  sudo pip install bottle (required for webdriver server)  sudo pip install selenium (required to code against the webdriver server)
  • 13. Running Appium  git clone git://github.com/hugs/appium  To launch the UIAutomation javascript interpretter  python appium.py “/path/to/my.app”  To launch the webdriver server  Python server.py “/path/to/my.app”
  • 14. Coding Appium like Selenium from selenium import webdriver command_url = “http://localhost:4723/wd/hub” iphone = webdriver.DesiredCapabilities.IPHONE driver = webdriver.Remote(command_url, iphone) fields = driver.find_elements_by_tag_name('textField’) fields[0].send_keys(3) fields[1].send_keys(4) buttons = driver.find_elements_by_tag_name('button’) buttons[0].click()
  • 15. Demo
  • 17. Failed Prototypes  Applescript iOS Simulator Automation  Did not work on actual devices  Seemed to be highly sensitive to iOS and OS X version  Not a reliable  Javascript Server Within UIAutomation  I could not get a server booted up while running in Instruments
  • 18. Pitfalls  Bug in UIAutomation causes 1 second delay between commands  I get around this by sending batches of commands  Noticed NIBs and XIBs are supported while storyboards are a more of a crapshoot  It’s tricky to make elements accessible in objective C  Some controls (UISegmentedControl) are missing supported accessibility methods  Applying a label to text will hinder your ability to read the text in the control (you need to encapsulate it)
  • 19. Resources Appium Project  https://github.com/hugs/appium or http://appium.io Discussion  https://groups.google.com/d/forum/appium-discuss