Selenium, Appium, and Robots!

  • View
    10.865

  • Download
    1

Embed Size (px)

DESCRIPTION

Presented at Tokyo Selenium Meetup, January 18, 2014

Text of Selenium, Appium, and Robots!

  • Selenium, Appium, and Robots! Jason Huggins @hugs Sauce Labs
  • A brief history of test automation...
  • 2004:
  • Google Maps, Gmail, Rails, etc...
  • aka
  • AJAX
  • Web 2.0
  • Its now safe to use JavaScript!
  • But how do you test it?
  • With Selenium!
  • Whats Selenium?
  • Its like a robot that tests your app!
  • Today:
  • Its popular!
  • More popular than the 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?
  • Whats Appium?
  • Appium is the cross-platform solution for native and hybrid mobile automation
  • appium.io github.com/appium/appium @AppiumDevs
  • Appium Philosophy
  • Rule 1 Test the same app you submit to the marketplace
  • Rule 2 Write your tests in any language, using any framework
  • Rule 3 Use a standard automation specication and API
  • Rule 4 Build a large and thriving open- source community eort
  • 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 server that 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 environment var desired = { device: 'iPhone Simulator' , name: "Appium: Sync WD" , platform:'Mac 10.8' , app: appURL , version: '' , browserName: '' };
  • Set... // Instantiate a new wd session var client = wd.remote("localhost", 4723); , browser = client.browser , sync = client.sync;
  • sync(function() { // Init the browser browser.init(desired); Go! // 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 dierent
  • Remember when I said like a robot?
  • Well...
  • 2011 2011
  • 2012
  • 2013 2013
  • tapsterbot.com github.com/hugs/tapsterbot @Tapsterbot
  • Demo!
  • Sauce Labs?
  • Servers Time Unit of Work
  • Servers Time Unit of Work
  • saucelabs.com @saucelabs