Selenium, Appium, and Robots!

23,206 views
24,049 views

Published on

Presented at Tokyo Selenium Meetup, January 18, 2014

Published in: Technology

Selenium, Appium, and Robots!

  1. 1. Selenium, Appium, and Robots! Jason Huggins @hugs Sauce Labs
  2. 2. A brief history of test automation...
  3. 3. 2004:
  4. 4. Google Maps, Gmail, Rails, etc...
  5. 5. aka
  6. 6. “AJAX”
  7. 7. “Web 2.0”
  8. 8. “It’s now safe to use JavaScript!”
  9. 9. But how do you test it?
  10. 10. With Selenium!
  11. 11. What’s Selenium?
  12. 12. “It’s like a robot that tests your app!”
  13. 13. Today:
  14. 14. It’s popular!
  15. 15. More popular than the competition!
  16. 16. But now...
  17. 17. the game has changed.
  18. 18. s/desktop/mobile/
  19. 19. 2007: mobile
  20. 20. 2008: mobile
  21. 21. 2009: mobile
  22. 22. 2010: mobile
  23. 23. 2011: mobile
  24. 24. 2012: mobile
  25. 25. mobile
  26. 26. !
  27. 27. But how do you test it?
  28. 28. What’s Appium?
  29. 29. Appium is the cross-platform solution for native and hybrid mobile automation
  30. 30. appium.io github.com/appium/appium @AppiumDevs
  31. 31. Appium Philosophy
  32. 32. Rule 1 Test the same app you submit to the marketplace
  33. 33. Rule 2 Write your tests in any language, using any framework
  34. 34. Rule 3 Use a standard automation specification and API
  35. 35. Rule 4 Build a large and thriving open- source community effort
  36. 36. Selenium WebDriver is the standard for browser automation, with libraries in every* language
  37. 37. Selenium WebDriver is used every single day by thousands of developers familiar with its model
  38. 38. Selenium WebDriver is a W3C working draft
  39. 39. Appium architecture
  40. 40. Appium is an HTTP server that creates and handles WebDriver sessions
  41. 41. On iOS, Appium proxies commands to a UIAutomation script running in Instruments
  42. 42. On Android, Appium proxies commands to a UiAutomator test case running on the device
  43. 43. Appium opens the door to cross- platform mobile testing: one test, two mobile platforms
  44. 44. (just like how Selenium started...)
  45. 45. Demo!
  46. 46. Sample code:
  47. 47. 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:  '' };
  48. 48. Set... //  Instantiate  a  new  wd  session var  client  =  wd.remote("localhost",  4723);    ,  browser  =  client.browser    ,  sync  =  client.sync;
  49. 49. 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(); });
  50. 50. Now for something (not) completely different
  51. 51. Remember when I said “like a robot”?
  52. 52. Well...
  53. 53. 2011 2011
  54. 54. 2012
  55. 55. 2013 2013
  56. 56. tapsterbot.com github.com/hugs/tapsterbot @Tapsterbot
  57. 57. Demo!
  58. 58. Sauce Labs?
  59. 59. Servers Time Unit of Work
  60. 60. Servers Time Unit of Work
  61. 61. saucelabs.com @saucelabs

×