Selenium, Appium, and Robots!
Jason Huggins@hugsSauce Labs
A brief history oftest automation...
2004:
Google Maps, Gmail, Rails,etc...
aka
“AJAX”
“Web 2.0”
“It’s now safe to use JavaScript!”
But how do you test it?
With Selenium!
What’s Selenium?
“It’s like a robot that tests your app!”
Today:
It’s popular!
More popular thanthe competition!
But now...
the game has changed.
s/desktop/mobile/
2007: mobile
2008: mobile
2009: mobile
2010: mobile
2011: mobile
2012: mobile
mobile
!
But how do you test it?
What’s Appium?
Appium is the cross-platform solution for native and hybrid mobile automation
appium.iogithub.com/appium/appium@AppiumDevs
Appium Philosophy
Rule 1Test the same app you submit to the marketplace
Rule 2Write your tests in any language, using any framework
Rule 3Use a standard automation specification and API
Rule 4Build a large and thriving open- source community effort
Selenium WebDriver is the standard for browser automation, with libraries in every* language
Selenium WebDriver is used every single day by thousands of developers familiar with its model
Selenium WebDriver is a W3C working draft
Appium architecture
Appium is an HTTP serverthat creates and handles WebDriver sessions
On iOS, Appium proxies commands to a UIAutomation script running in Instruments
On Android, Appium proxies commands to a UiAutomator test case running on the device
Appium opens the door to cross- platform mobile testing: one test, two mobile platforms
(just like how Selenium started...)
Demo!
Sample code:
Ready...var wdSync = require("wd-‐sync") , assert = require("assert") , appURL = "http://appium.s3.amazonaws.com/TestApp6.0.app.zip";
// Define the environmentvar desired = { device: 'iPhone Simulator' , name: "Appium: Sync WD" , platform:'Mac 10.8' , app: appURL , version: '' , browserName: ''};
Set...// Instantiate a new wd sessionvar client = wd.remote("localhost", 4723); , browser = client.browser , sync = client.sync;
Go!sync(function() { // Init the browser browser.init(desired);
// Type into two fields var fields = browser.elementsByTagName('textField'); fields[0].type('2'); fields[1].type('3');
// Click a button var buttons = browser.elementsByTagName('button'); buttons[0].click();
// Verify results var texts = browser.elementsByTagName('staticText'); assert.equal(browser.text(texts[0]), 5);
// quite the browser browser.quit();});
Now for something (not) completely different
Remember when I said “like a robot”?
Well...
20112011
2012
20132013
tapsterbot.comgithub.com/hugs/tapsterbot@Tapsterbot
Demo!
Sauce Labs?
Time
Servers
Unit of Work
Time
Servers
Unit of Work
saucelabs.com@saucelabs