The future of Selenium testing
for mobile web and native apps
Hi.

I’m JASON CARR. I work at sauce
            LABS.
@maudineormsby
I’m a developer

and contributor to selenium and appium
Context
For mobile web, Web Driver
Selenium Grid
           Selenium Grid   iWebDriver.app
Script
 Script
            (optional)
             (optional)
Script
 Script   iWebDriver.app
from selenium import webdriver
 from selenium import webdriver

hub ==‘http://localhost:3001/wd/hub’
 hub ‘http://localhost:3001/wd/hub’           iWebDriver.app
caps ==webdriver.DesiredCapabilities.IPHONE
 caps webdriver.DesiredCapabilities.IPHONE

driver ==webdriver.Remote(hub, caps)
 driver webdriver.Remote(hub, caps)
Limitations
iframes
driver.quit()
Alert handling
Javascript
UIAutomation
“…a bit like being dropped off in a
field somewhere with no map,
tools or supplies and being told
you need to build a house.”
                      -Alex Vollmer
js
 js   Instruments.app
       Instruments.app   App
js
 js       Instruments.app
           Instruments.app     App




      client                 device
UI Automation only runs in
     Instruments.app
Tests have to be in Javascript
No realtime interaction with tests
Hard to reuse code
One test at a time
An aside:
Android automation…
Monkey Runner
So what have we learned so far?
Two attempted approaches to
        automation
Script/
    Script/                           App
                  Screen Capture
                   Screen Capture
Framework
 Framework




              client                device
Hard to abstract
Very brittle
Hard to use with real devices
Hard to use with CI or parallelize
script
 script        Client library
                Client library     App




          client                 device
Requires code modification
Real devices are hard
New framework and new tests
The right way to automate ios
Remember the testing pyramid
Are you writing unit tests for apps?
           It’s not that hard!
Test your views appropriately
For UIWebViews use iWebDriver
Yes, yes, but now what?
Code reuse is good.
Realtime interaction
Integrate with existing automation
Parallel tests and real devices
That sounds great, but how?
Appium
Open Source
Can be extended
Uses webdriver API
Runs with off-the-shelf client libraries
         Language agnostic
Real time
Interact with js interpreter or client
Real devices
Works in parallel
  (architecturally)
No code modification
test script
   test script




                                          App
Appium Server
 Appium Server       Instruments.app
                      Instruments.app




                 client                 device
Easy to get started
Clone Appium
pip install bottle
python server.py /path/to/my.app
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
Doesn’t support execute_script()
       …yet. More on this later.
1 Second delay between commands
       UI Automation limitation
Still uses UIAutomation
  ‘Accessibility’ is important
where do we go from here?
WebKit remote debugging protocol
Drive mobile safari
Drive desktop safari
Drive chrome on android!
Android RC
Questions?
 Thank you!
Resources
Appium Github Repo:
http://goo.gl/4E5F0
Dan Cuellar’s talk on Appium:
http://goo.gl/qgLha
François Reynaud on ios-driver:
http://goo.gl/pzn75
Simon Stewart’s blog on mobile testing:
http://goo.gl/8wl8j

The Future of Selenium Testing for Mobile Web and Native Apps