Top Banner
Selenium, Appium, and Robots! Jason Huggins @hugs Sauce Labs
71

Selenium, Appium, and Robots!

Sep 08, 2014

Download

Technology

hugs

Presented at Tokyo Selenium Meetup, January 18, 2014
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Selenium, Appium, and Robots!

Selenium, Appium, and Robots!

Jason Huggins@hugsSauce Labs

Page 2: Selenium, Appium, and Robots!

A brief history oftest automation...

Page 3: Selenium, Appium, and Robots!

2004:

Page 4: Selenium, Appium, and Robots!

Google Maps, Gmail, Rails,etc...

Page 5: Selenium, Appium, and Robots!

aka

Page 6: Selenium, Appium, and Robots!

“AJAX”

Page 7: Selenium, Appium, and Robots!

“Web 2.0”

Page 8: Selenium, Appium, and Robots!

“It’s now safe to use JavaScript!”

Page 9: Selenium, Appium, and Robots!

But how do you test it?

Page 10: Selenium, Appium, and Robots!

With Selenium!

Page 11: Selenium, Appium, and Robots!

What’s Selenium?

Page 12: Selenium, Appium, and Robots!

“It’s like a robot that tests your app!”

Page 13: Selenium, Appium, and Robots!
Page 14: Selenium, Appium, and Robots!

Today:

Page 15: Selenium, Appium, and Robots!

It’s popular!

Page 16: Selenium, Appium, and Robots!
Page 17: Selenium, Appium, and Robots!

More popular thanthe competition!

Page 18: Selenium, Appium, and Robots!
Page 19: Selenium, Appium, and Robots!

But now...

Page 20: Selenium, Appium, and Robots!

the game has changed.

Page 21: Selenium, Appium, and Robots!

s/desktop/mobile/

Page 22: Selenium, Appium, and Robots!

2007: mobile

Page 23: Selenium, Appium, and Robots!

2008: mobile

Page 24: Selenium, Appium, and Robots!

2009: mobile

Page 25: Selenium, Appium, and Robots!

2010: mobile

Page 26: Selenium, Appium, and Robots!

2011: mobile

Page 27: Selenium, Appium, and Robots!

2012: mobile

Page 28: Selenium, Appium, and Robots!

mobile

Page 29: Selenium, Appium, and Robots!

!

Page 30: Selenium, Appium, and Robots!

But how do you test it?

Page 31: Selenium, Appium, and Robots!
Page 32: Selenium, Appium, and Robots!

What’s Appium?

Page 33: Selenium, Appium, and Robots!

Appium is the cross-platform solution for native and hybrid mobile automation

Page 34: Selenium, Appium, and Robots!

appium.iogithub.com/appium/appium@AppiumDevs

Page 35: Selenium, Appium, and Robots!

Appium Philosophy

Page 36: Selenium, Appium, and Robots!

Rule 1Test the same app you submit to the marketplace

Page 37: Selenium, Appium, and Robots!

Rule 2Write your tests in any language, using any framework

Page 38: Selenium, Appium, and Robots!

Rule 3Use a standard automation specification and API

Page 39: Selenium, Appium, and Robots!

Rule 4Build a large and thriving open- source community effort

Page 40: Selenium, Appium, and Robots!

Selenium WebDriver is the standard for browser automation, with libraries in every* language

Page 41: Selenium, Appium, and Robots!

Selenium WebDriver is used every single day by thousands of developers familiar with its model

Page 42: Selenium, Appium, and Robots!

Selenium WebDriver is a W3C working draft

Page 43: Selenium, Appium, and Robots!

Appium architecture

Page 44: Selenium, Appium, and Robots!

Appium is an HTTP serverthat creates and handles WebDriver sessions

Page 45: Selenium, Appium, and Robots!

On iOS, Appium proxies commands to a UIAutomation script running in Instruments

Page 46: Selenium, Appium, and Robots!
Page 47: Selenium, Appium, and Robots!

On Android, Appium proxies commands to a UiAutomator test case running on the device

Page 48: Selenium, Appium, and Robots!
Page 49: Selenium, Appium, and Robots!

Appium opens the door to cross- platform mobile testing: one test, two mobile platforms

Page 50: Selenium, Appium, and Robots!

(just like how Selenium started...)

Page 51: Selenium, Appium, and Robots!

Demo!

Page 52: Selenium, Appium, and Robots!

Sample code:

Page 53: Selenium, Appium, and Robots!

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:  ''};

Page 54: Selenium, Appium, and Robots!

Set...//  Instantiate  a  new  wd  sessionvar  client  =  wd.remote("localhost",  4723);    ,  browser  =  client.browser    ,  sync  =  client.sync;

Page 55: Selenium, Appium, and Robots!

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();});

Page 56: Selenium, Appium, and Robots!

Now for something (not) completely different

Page 57: Selenium, Appium, and Robots!

Remember when I said “like a robot”?

Page 58: Selenium, Appium, and Robots!
Page 59: Selenium, Appium, and Robots!

Well...

Page 60: Selenium, Appium, and Robots!
Page 61: Selenium, Appium, and Robots!

20112011

Page 62: Selenium, Appium, and Robots!

2012

Page 63: Selenium, Appium, and Robots!

20132013

Page 64: Selenium, Appium, and Robots!

tapsterbot.comgithub.com/hugs/tapsterbot@Tapsterbot

Page 65: Selenium, Appium, and Robots!

Demo!

Page 66: Selenium, Appium, and Robots!

Sauce Labs?

Page 67: Selenium, Appium, and Robots!
Page 68: Selenium, Appium, and Robots!
Page 69: Selenium, Appium, and Robots!

Time

Servers

Unit of Work

Page 70: Selenium, Appium, and Robots!

Time

Servers

Unit of Work

Page 71: Selenium, Appium, and Robots!

saucelabs.com@saucelabs