15
Testing Native iOS Apps with Appium Dylan Lacey, Sauce Labs Inc. @DylanLacey

Testing Native iOS Apps with Appium

Embed Size (px)

Citation preview

Page 1: Testing Native iOS Apps with Appium

Testing Native iOSApps with Appium

Dylan Lacey, Sauce Labs Inc.@DylanLacey

Page 2: Testing Native iOS Apps with Appium

What is Appium?

+

Page 3: Testing Native iOS Apps with Appium

Framework for Automating Browsers fortesting

Uses actual Browsers, ergo functions likea real user (mostly)

Can run locally or remotely

Selenium

Page 4: Testing Native iOS Apps with Appium

Appium is a SeleniumServer for iOS

Native app controls are kinda webcontrols

Find things, click them, assert on content

Run your tests under automation

••

Page 5: Testing Native iOS Apps with Appium

Rubyists Testing

Page 6: Testing Native iOS Apps with Appium

iOS Testing

Page 7: Testing Native iOS Apps with Appium

...Wat?

TEST

APPIUM

Selenium Instruments.js

Page 8: Testing Native iOS Apps with Appium

You’re Lying. Show usCode

driver = Selenium::Webdriver.for( :remote, { :desired_capabilities => {:browserName => ‘iOS’, :platform => ‘Mac’, :version => ‘6.0’, :app => ABSOLUTE_APP_PATH}, :url => “http://127.0.0.1:4723/wd/hub” })

Page 9: Testing Native iOS Apps with Appium

Example - Find, Values

require 'selenium-webdriver'include Selenium::WebDriver::DriverExtensions::HasInputDevicesinclude Selenium::WebDriver::DriverExtensions::HasTouchScreen

rows = driver.find_elements(:tag_name, "tableCell")rows[0].attribute(:name).should eq "Buttons, Various uses ofUIButton"

third_row = driver.find_elements(:tag_name, "tableCell")[2]third_row.location.y.should be 152

Page 10: Testing Native iOS Apps with Appium

Example - [email protected]_elements(:tag_name, "tableCell")[9].click

@switch = @driver.find_element(:tag_name, "switch")@switch.displayed?.should be_true

@switch.attribute("value").should be [email protected]@switch.attribute("value").should be 1

@text_field = @driver.find_element(:tag_name, "textField")@text_field.send_keys("discombobulate")@text_field.attribute("value").should eq "discombobulate"

Page 11: Testing Native iOS Apps with Appium

Example - Scrolling

row = @driver.find_elements(:tag_name, "tableCell")[2]initial_location = row.locationaction = @driver.touch.flick(0, 20)action.performinitial_location.should_not eq row.location

Page 12: Testing Native iOS Apps with Appium

Demo

Page 13: Testing Native iOS Apps with Appium

Host Remotely

Being a server, you can host tests onremote machines

Connect them to a Grid

Run them in parallel

Pay someone else to bother

•••

Page 14: Testing Native iOS Apps with Appium

Gif because I feel leftout

Page 15: Testing Native iOS Apps with Appium

Thanks for Listening;Have free sh... stuffAppium Site: Appium.io

Free Sauce Labs minutes: RailsConf13

PSST: Totally free for FOSS projects

Hit me up with Questions: @dylanlaceyor [email protected]

•••