Successfully reported this slideshow.

The Future of Selenium Testing for Mobile Web and Native Apps

5,384 views

Published on

Published in: Technology

The Future of Selenium Testing for Mobile Web and Native Apps

  1. 1. The future of Selenium testingfor mobile web and native apps
  2. 2. Hi.I’m JASON CARR. I work at sauce LABS.
  3. 3. @maudineormsby
  4. 4. I’m a developerand contributor to selenium and appium
  5. 5. Context
  6. 6. For mobile web, Web Driver
  7. 7. Selenium Grid Selenium Grid iWebDriver.appScript Script (optional) (optional)
  8. 8. Script Script iWebDriver.app
  9. 9. from selenium import webdriver from selenium import webdriverhub ==‘http://localhost:3001/wd/hub’ hub ‘http://localhost:3001/wd/hub’ iWebDriver.appcaps ==webdriver.DesiredCapabilities.IPHONE caps webdriver.DesiredCapabilities.IPHONEdriver ==webdriver.Remote(hub, caps) driver webdriver.Remote(hub, caps)
  10. 10. Limitations
  11. 11. iframes
  12. 12. driver.quit()
  13. 13. Alert handling
  14. 14. Javascript
  15. 15. UIAutomation
  16. 16. “…a bit like being dropped off in afield somewhere with no map,tools or supplies and being toldyou need to build a house.” -Alex Vollmer
  17. 17. js js Instruments.app Instruments.app App
  18. 18. js js Instruments.app Instruments.app App client device
  19. 19. UI Automation only runs in Instruments.app
  20. 20. Tests have to be in Javascript
  21. 21. No realtime interaction with tests
  22. 22. Hard to reuse code
  23. 23. One test at a time
  24. 24. An aside:Android automation…
  25. 25. Monkey Runner
  26. 26. So what have we learned so far?
  27. 27. Two attempted approaches to automation
  28. 28. Script/ Script/ App Screen Capture Screen CaptureFramework Framework client device
  29. 29. Hard to abstract
  30. 30. Very brittle
  31. 31. Hard to use with real devices
  32. 32. Hard to use with CI or parallelize
  33. 33. script script Client library Client library App client device
  34. 34. Requires code modification
  35. 35. Real devices are hard
  36. 36. New framework and new tests
  37. 37. The right way to automate ios
  38. 38. Remember the testing pyramid
  39. 39. Are you writing unit tests for apps? It’s not that hard!
  40. 40. Test your views appropriately
  41. 41. For UIWebViews use iWebDriver
  42. 42. Yes, yes, but now what?
  43. 43. Code reuse is good.
  44. 44. Realtime interaction
  45. 45. Integrate with existing automation
  46. 46. Parallel tests and real devices
  47. 47. That sounds great, but how?
  48. 48. Appium
  49. 49. Open SourceCan be extended
  50. 50. Uses webdriver APIRuns with off-the-shelf client libraries Language agnostic
  51. 51. Real timeInteract with js interpreter or client
  52. 52. Real devices
  53. 53. Works in parallel (architecturally)
  54. 54. No code modification
  55. 55. test script test script AppAppium Server Appium Server Instruments.app Instruments.app client device
  56. 56. Easy to get started
  57. 57. Clone Appium
  58. 58. pip install bottle
  59. 59. python server.py /path/to/my.app
  60. 60. from selenium import webdrivercommand_url = “http://localhost:4723/wd/hub”iphone = webdriver.DesiredCapabilities.IPHONEdriver = 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()
  61. 61. demo
  62. 62. Doesn’t support execute_script() …yet. More on this later.
  63. 63. 1 Second delay between commands UI Automation limitation
  64. 64. Still uses UIAutomation ‘Accessibility’ is important
  65. 65. where do we go from here?
  66. 66. WebKit remote debugging protocol
  67. 67. Drive mobile safari
  68. 68. Drive desktop safari
  69. 69. Drive chrome on android!
  70. 70. Android RC
  71. 71. Questions? Thank you!
  72. 72. ResourcesAppium Github Repo:http://goo.gl/4E5F0Dan Cuellar’s talk on Appium:http://goo.gl/qgLhaFrançois Reynaud on ios-driver:http://goo.gl/pzn75Simon Stewart’s blog on mobile testing:http://goo.gl/8wl8j

×