using selenium to test native apps (wait, you can do that?)

Post on 09-May-2015

8.056 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Using Selenium to Test Native Applications

…wait, you can do that?

Hi.

I’m JASON CARR. I work at sauce LABS.

@maudineormsby

…it’s a long story.

I’m a developer

and contributor to selenium and appium

This talk is about…

This talk is about…

the problem of ios app automation

This talk is about…

lessons learned automating apps

This talk is about…

the right approach to testing native apps

This talk is about…

the tools available to test your apps today

This talk is about…

WHAT HOPE WE HAVE FOR THE FUTURE.

the problem of ios app automation

“…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

jsjs Instruments.appInstruments.app App

jsjs Instruments.appInstruments.app App

client device

UI Automation only runs inInstruments.app

Tests have to be in Javascript

No realtime interaction with tests

Hard to reuse code

One test at a time

So what have we learned so far?

Two attempted approaches to automation

Script/Framework

Script/Framework Screen CaptureScreen Capture App

client device

Hard to abstract

Very brittle

Hard to use with real devices

Hard to use with CI or parallelize

scriptscript Client libraryClient 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 scripttest script

Instruments.appInstruments.appApp

client device

Appium ServerAppium Server

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?

Implement more of the API

WebKit remote debugging protocol

Selenium Grid support

Questions?

Thank you!

ResourcesAppium Github Repo:http://goo.gl/4E5F0Dan 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

top related