SlideShare a Scribd company logo
30.09.2014 
1 
MOBILE TEST AUTOMATION 
SELENIUM 
SELENDROID 
IOS-DRIVER
AGENDA 
● Welcome 
● Selenium Crash Course 
● ios-driver + Selendroid 
● Building a cross platform infrastructure 
2
WHO AM I ? 
3 
Gridfusion Software Solutions 
Michael Palotas 
Dipl. Ing. (FH) Nachrichtentechnik 
Email: michael.palotas@gridfusion.net 
LinkedIn: http://ch.linkedin.com/in/michaelpalotas/ 
Xing: https://www.xing.com/profile/Michael_Palotas 
Twitter: @michael_palotas 
Kontakt: 
Gerbiweg 2 
8853 Lachen 
SWITZERLAND 
Tel.: +41 79 6690708 
Founder / Principal Consultant 
Gridfusion Software Solutions 
Head of 
Productivity & Test Engineering 
eBay International
WARM-UP 
4 
Why do you automate tests? 
Which tests should be automated? 
Who should automate? 
What is different about mobile?
DISCLAIMER 
5 
THIS IS NOT A SELENDROID OR IOS-DRIVER 
TRAINING
MOBILE TEST AUTOMATION 
6 
Not as mature as web automation 
Immature tools market 
Tools are usually platform specific 
Multi code base
EMULATORS VS. DEVICES 
7 
What to test where?
SAME AUTOMATION CODE BETWEEN 
PLATFORMS? 
8 
Sounds good first 
but 
Most apps are different between platforms 
Different element locator strategy 
Do reuse the helper functions
TEST INFRASTRUCTURE 
9 
AUT 
API 
DB 
Browsers 
Mobiles
2. SELENIUM 
10
A LITTLE SELENIUM HISTORY 
Selenium was so named because Huggins, dissatisfied with testing 
tools on the market, was seeking a name that would position the 
product as an alternative to Mercury Interactive QuickTest 
Professional commercial testing software. The name, Selenium, was 
selected because selenium mineral supplements serve as a cure for 
mercury poisoning, Huggins explained. 
11
WHAT IS SELENIUM? 
12 
SELENIUM AUTOMATES BROWSERS 
THAT'S IT 
... One more thing ... 
Selenium is becoming a W3C standard: http://www.w3.org/TR/webdriver
WHAT IS SELENIUM? 
13 
Protocol which describes user interactions 
Supports most browsers 
Supports most programming languages
SELENIUM – WHAT IT IS NOT 
14 
a drag & drop tool 
a network testing / monitoring tool 
a performance testing tool 
a reporting tool 
a testcase management tool
WHY OPEN SOURCE? 
15 
It is free (…) 
Independent of 3rd parties 
Faster innovation cycles 
Motivated employees 
Easier hiring
THE SELENIUM „FLAVORS“ 
16 
Selenium IDE 
Selenium 
Selenium GRID 
Let’s forget about this one real quick
5. WEBDRIVER PROTOCOL 
17
SELENIUM 2 / WEBDRIVER 
18 
JSON WIRE 
PROTOCOL 
Client 
Java 
C# 
Ruby 
Python 
Server 
Server 
Server 
i.e. Selendroid, iOS-Driver
SELENIUM CLIENT 
19 
Is seen as Selenium by the users 
Generates HTTP request, which are received by 
the server 
Is called by the test framework or the CI server 
Supported languages: Java, C#, Python, Ruby, 
Perl, PHP, JS
SELENIUM SERVER 
20 
Receives HTTP requests from server 
Start and teardown of browser 
Translates requests into browser specific 
commands 
Communicates back to the client
6. SELENIUM BASICS 
21
DOWNLOADS 
- http://www.seleniumhq.org/ 
- http://selenium.googlecode.com/files/ 
selenium-server-standalone-2.42.2.jar 
- Maven example: 
22
DRIVER 
23 
Each browser has its own driver 
Firefox driver is part of the standalone jar 
http://selenium.googlecode.com/files/selenium-server-standalone-2.42.2.jar 
Chrome: https://code.google.com/p/selenium/wiki/ChromeDriver 
Opera: https://code.google.com/p/selenium/wiki/OperaDriver 
Internet Explorer: https://code.google.com/p/selenium/wiki/ 
InternetExplorerDriver
DRIVER 
Each driver implements the JSON Wire Protocol 
Driver interacts with the browser (or mobile) 
CLIENT 
SERVER 
24 
JSON Wire Protocol 
BROWSER 
DRIVER
OUR FIRST TEST 
Open a Firefox Browser 
Go to http://gridfusion.net 
Close the browser 
@Test 
public void myFirstTest() { 
WebDriver driver = new FirefoxDriver(); 
driver.get("http://gridfusion.net"); 
driver.quit(); 
} 
25
DRIVER API 
26
PAGE TITLE 
Open a Firefox browser 
Go to http://gridfusion.net 
Print the page title in the console 
Close the browser 
@Test 
public void pageTitleTest() { 
WebDriver driver = new FirefoxDriver(); 
driver.get("http://gridfusion.net"); 
String pageTitle = driver.getTitle(); 
System.out.println(pageTitle); 
driver.quit(); 
} 
27
ASSERTS 
Open a Firefox Browser 
Go to: http://gridfusion.net 
Verify Page Title = GRIDFUSION.net – Home 
Close the browser 
28
WEBELEMENT 
29 
Represents an HTML Element 
Interactions on a page happen via WebElement 
http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html
LOCATORS 
id 
cssSelector 
linkText 
name 
partialLinkText 
tagName 
xpath 
30 
driver.findElement(By.XYZ)
7. REMOTE WEBDRIVER 
31
REMOTE WEBDRIVER 
Decouples tests from browsers 
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), DesiredCapabilities); 
32 
Machine 1 
Eclipse 
TestNG 
CI 
Machine 2 
HTTP Browser
DESIRED CAPABILITIES - BROWSER 
33 
DesiredCapabilities capability = new DesiredCapabilities(); 
capability.setBrowserName(“firefox”); 
https://code.google.com/p/selenium/wiki/DesiredCapabilities
REMOTEWEBDRIVER 
● Start a selenium server: 
34 
● java –jar selenium-server-standalone-2.42.2.jar 
● Use RemoteWebDriver and set DesiredCapabilities to Firefox 
● Open a Firefox browser 
● Go to: http://gridfusion.net 
● Close the browser 
@Test 
public void remoteWebdriverFireFoxTest() throws MalformedURLException { 
DesiredCapabilities capability = DesiredCapabilities.firefox(); 
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability); 
driver.get("http://gridfusion.net"); 
driver.quit(); 
}
8. SELENIUM GRID 
35
WHY SELENIUM GRID? 
36 
Environment Management & Control 
Scaling 
Parallel execution of tests 
Reduction of execution times 
Crossover tests (web, mobile)
SELENIUM GRID 
37 
SEQUENTIAL EXECUTION 
TEST TEST TEST TEST 
TIME 
n 
PARALLEL EXECUTION 
TEST TEST TEST TEST 
TEST TEST TEST TEST 
TEST TEST TEST TEST 
TEST TEST TEST TEST 
TIME 
n
SCALING – SELENIUM GRID 
38 
DEV 
CI 
…. 
SELENIUM GRID 
HUB 
IOS ANDROID 
WINDOWS 
LINUX 
OSX
1. STEP– START THE GRID HUB 
39 
Open a new terminal window 
Start the Selenium GRID hub by typing: 
java -jar selenium-server-standalone-2.42.jar -role hub 
Enter http://localhost:4444/grid/console into the browser
2. STEP– REGISTER A NODE 
40 
Open a second terminal window 
Start and register a Selenium node by entering: 
java -jar selenium-server-standalone-x.y.z.jar –role wd -hub 
http://localhost:4444/grid/register
SELENIUM NODE – STANDARD CONFIG 
- Go to: http://localhost:4444/grid/console 
Standard Configuration: 
5 Firefox 
5 Chrome 
1 Internet Explorer 
41
SCREENSHOTS 
42
10. REPORTING 
43
STANDARD REPORTS 
- TestNG reports are put into: **/test-output 
- Look for: emailable-report.html 
44
CUSTOM REPORTING 
- By calling Reporter.log(“your log message”), 
you can add additional information to the 
report 
45
SCREENSHOTS 
- Screenshots can also be placed directly into 
the report 
46
12. MOBILE 
AUTOMATION 
47
SELENIUM 2 / WEBDRIVER 
48 
JSON WIRE 
PROTOCOL 
Client 
Java 
C# 
Ruby 
Python 
Server 
Server 
Server 
i.e. Selendroid, iOS-Driver
(SOME) MOBILE AUTOMATION REQUIREMENTS 
* Reuse of the existing Selenium infrastructure for the web 
* Implementation of the Selenium protocol (JSON wire protocol) 
* The application under test (aut) should not need to be modified 
* Support for emulators/simulators as well as real devices 
* Parallel execution of tests in a Selenium Grid 
* Management of multiple applications, versions, languages 
* Support for runtime inspection for the app 
* Hybrid app support 
* No jailbreaking of device required 
49
IOS-DRIVER + SELENDROID 
50 
IOS: 
http://ios-driver.github.io/ios-driver/index.html 
ANDROID: 
http://selendroid.io/ 
Both projects implement the Webdriver API (JSON 
Wire Protocol)
ANDROID: MOBILE WEB 
51
ANDROID: NATIVE APP 
52
IOS: MOBILE WEB 
53
WRITE ONCE RUN EVERYWHERE 
54
WRITE ONCE RUN EVERYWHERE 
55
INSPECTOR 
56
SAUCELABS CLOUD 
57
WHAT HAVE YOU LEARNED TODAY? 
58
59 
THANK YOU

More Related Content

PDF
Upgrade to java 16 or 17
PPTX
Test Automation Using Selenium
PPTX
Java dev mar_2021_keynote
PPTX
Automation Tools Overview
PPTX
PDF
Selenium Maven With Eclipse | Edureka
PPT
Automation Testing on Selenium by Quontra Solutions
PPTX
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, Finland
Upgrade to java 16 or 17
Test Automation Using Selenium
Java dev mar_2021_keynote
Automation Tools Overview
Selenium Maven With Eclipse | Edureka
Automation Testing on Selenium by Quontra Solutions
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, Finland

What's hot (20)

PPTX
BDD using Cucumber JVM
PPTX
KEY
Testing with Jenkins, Selenium and Continuous Deployment
DOCX
Selenium_WebDriver_Java_TestNG
PPTX
Selenium topic 1- Selenium Basic
PPTX
Introduction to Maven
PPTX
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, Finland
PPTX
Apache Maven
PPTX
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
PPTX
Selenium test automation
PPTX
An Overview of Selenium
PPTX
Selenium topic 3 -Web Driver Basics
PPTX
Maven plugins, properties en profiles: Advanced concepts in Maven
PDF
Agile Software Development & Tools
PPTX
Selenium introduction
PDF
Jenkins & Selenium
PPTX
Selenium basic
PPTX
Maven 3 New Features
BDD using Cucumber JVM
Testing with Jenkins, Selenium and Continuous Deployment
Selenium_WebDriver_Java_TestNG
Selenium topic 1- Selenium Basic
Introduction to Maven
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, Finland
Apache Maven
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
Selenium test automation
An Overview of Selenium
Selenium topic 3 -Web Driver Basics
Maven plugins, properties en profiles: Advanced concepts in Maven
Agile Software Development & Tools
Selenium introduction
Jenkins & Selenium
Selenium basic
Maven 3 New Features
Ad

Viewers also liked (20)

DOCX
BonnieLAdamsLinkedInresume2016.doc
PDF
Blu-ray, DVD- und CD-Neuheiten Februar 2013 Nr. 1 (Im Vertrieb der NAXOS Deut...
PDF
From Purpose to Person (Matthew Niederberger)
DOCX
DOCX
Community_Partners - PBworks: Online Collaboration
PPTX
Manual de streaming con youtube
PDF
Lista depurada de participantes a taller i
PDF
Administrative Projects from " DESIGNERS Consultants "
PDF
Lista Roja IUCN - Jessica Sánchez
PDF
Sage 100 ERP 2013 Product Update 7 Release Notes
PDF
Manual bosch horno multifuncion hbr43 s451e
PPTX
Juan josé morosoli
PPT
Mac Donald Tesol 2010, Teaching Acdemic English: Changing Teacher Roles and I...
PPTX
El correo comercial
PDF
Reto 071 CFE - Smartplace - Manual de Usuario
PDF
La bible grecque des septante
PDF
José Jiménez: Optimiza tu perfil de infojobs para mejorar tus resultados
PDF
El dia cero
PDF
Forest fires, polymers, and the chemistry of nappies
BonnieLAdamsLinkedInresume2016.doc
Blu-ray, DVD- und CD-Neuheiten Februar 2013 Nr. 1 (Im Vertrieb der NAXOS Deut...
From Purpose to Person (Matthew Niederberger)
Community_Partners - PBworks: Online Collaboration
Manual de streaming con youtube
Lista depurada de participantes a taller i
Administrative Projects from " DESIGNERS Consultants "
Lista Roja IUCN - Jessica Sánchez
Sage 100 ERP 2013 Product Update 7 Release Notes
Manual bosch horno multifuncion hbr43 s451e
Juan josé morosoli
Mac Donald Tesol 2010, Teaching Acdemic English: Changing Teacher Roles and I...
El correo comercial
Reto 071 CFE - Smartplace - Manual de Usuario
La bible grecque des septante
José Jiménez: Optimiza tu perfil de infojobs para mejorar tus resultados
El dia cero
Forest fires, polymers, and the chemistry of nappies
Ad

Similar to Mobile Test Automation using one API and one infrastructure (20)

PPTX
Android Automation Testing with Selendroid
PPTX
Basics of selenium containing features of selenium
PDF
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
PPTX
Cross platform browser automation tests sdp
PPTX
Python selenium
PDF
Selenium Testing The Complete Step-by-Step Tutorial.pdf
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
PDF
Selenium Automation Testing - A Complete Guide
PPTX
Test automation using selenium
PDF
Automation Testing using Selenium
PPTX
Selenium
PPTX
A Simple Guide to Selenium Software Testing
PPTX
PPTX
Demystifying Selenium framework
PDF
Mobile WebDriver Selendroid
PPTX
Selenium Testing
PPTX
test-automation-selenium-160216124839.pptx
PPTX
Selenium Basics and Overview topics.pptx
PPTX
Selenium Basics and Overview1233444.pptx
PDF
Selenium Automation Testing - A Complete Guide.pdf
Android Automation Testing with Selendroid
Basics of selenium containing features of selenium
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Cross platform browser automation tests sdp
Python selenium
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Automation Testing - A Complete Guide
Test automation using selenium
Automation Testing using Selenium
Selenium
A Simple Guide to Selenium Software Testing
Demystifying Selenium framework
Mobile WebDriver Selendroid
Selenium Testing
test-automation-selenium-160216124839.pptx
Selenium Basics and Overview topics.pptx
Selenium Basics and Overview1233444.pptx
Selenium Automation Testing - A Complete Guide.pdf

More from Michael Palotas (19)

PDF
Berlin Selenium Meetup - Galen Framework
PDF
Selenium - The page object pattern
PDF
Berlin Selenium Meetup - A quick introduction to Selenium
PDF
Zürich selenium meetup mobile and web automation under one umbrella
PDF
Agile breakfast St. Gallen - Mindset. Skillset. Toolset
PDF
Agile Bodensee - Testautomation & Continuous Delivery Workshop
PDF
Agile bodensee - Agile Testing: Bug prevention vs. bug detection
PDF
Testing in the new world-bug prevention vs. bug detection
PDF
Mobile test automation with Selenium, Selendroid and ios-driver
PDF
German Testing Day Keynote - Testing at ebay - a look at a rather unconvent...
PDF
Scrum breakfast skillset_toolset_mindset
PDF
EBAY - A LOOK BEHIND THE SCENES
PPTX
JAVA User Group Bern - Selenium
PPTX
Mobile Testing and Mobile Automation at eBay
PDF
ebay @ Hasso Plattner Institut Potsdam
PDF
How we Test at eBay Europe
PDF
Swiss Testing Day - Testautomation, 10 (sometimes painful) lessons learned
PPTX
Implementing Test Automation in Agile Projects
PDF
Test Automation and Innovation with Open Source Tools
Berlin Selenium Meetup - Galen Framework
Selenium - The page object pattern
Berlin Selenium Meetup - A quick introduction to Selenium
Zürich selenium meetup mobile and web automation under one umbrella
Agile breakfast St. Gallen - Mindset. Skillset. Toolset
Agile Bodensee - Testautomation & Continuous Delivery Workshop
Agile bodensee - Agile Testing: Bug prevention vs. bug detection
Testing in the new world-bug prevention vs. bug detection
Mobile test automation with Selenium, Selendroid and ios-driver
German Testing Day Keynote - Testing at ebay - a look at a rather unconvent...
Scrum breakfast skillset_toolset_mindset
EBAY - A LOOK BEHIND THE SCENES
JAVA User Group Bern - Selenium
Mobile Testing and Mobile Automation at eBay
ebay @ Hasso Plattner Institut Potsdam
How we Test at eBay Europe
Swiss Testing Day - Testautomation, 10 (sometimes painful) lessons learned
Implementing Test Automation in Agile Projects
Test Automation and Innovation with Open Source Tools

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
System and Network Administraation Chapter 3
PDF
medical staffing services at VALiNTRY
PPTX
ai tools demonstartion for schools and inter college
PPTX
history of c programming in notes for students .pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Introduction to Artificial Intelligence
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Softaken Excel to vCard Converter Software.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
System and Network Administraation Chapter 3
medical staffing services at VALiNTRY
ai tools demonstartion for schools and inter college
history of c programming in notes for students .pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
2025 Textile ERP Trends: SAP, Odoo & Oracle
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Operating system designcfffgfgggggggvggggggggg
Reimagine Home Health with the Power of Agentic AI​
Introduction to Artificial Intelligence
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PTS Company Brochure 2025 (1).pdf.......
L1 - Introduction to python Backend.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
CHAPTER 2 - PM Management and IT Context

Mobile Test Automation using one API and one infrastructure

  • 1. 30.09.2014 1 MOBILE TEST AUTOMATION SELENIUM SELENDROID IOS-DRIVER
  • 2. AGENDA ● Welcome ● Selenium Crash Course ● ios-driver + Selendroid ● Building a cross platform infrastructure 2
  • 3. WHO AM I ? 3 Gridfusion Software Solutions Michael Palotas Dipl. Ing. (FH) Nachrichtentechnik Email: michael.palotas@gridfusion.net LinkedIn: http://ch.linkedin.com/in/michaelpalotas/ Xing: https://www.xing.com/profile/Michael_Palotas Twitter: @michael_palotas Kontakt: Gerbiweg 2 8853 Lachen SWITZERLAND Tel.: +41 79 6690708 Founder / Principal Consultant Gridfusion Software Solutions Head of Productivity & Test Engineering eBay International
  • 4. WARM-UP 4 Why do you automate tests? Which tests should be automated? Who should automate? What is different about mobile?
  • 5. DISCLAIMER 5 THIS IS NOT A SELENDROID OR IOS-DRIVER TRAINING
  • 6. MOBILE TEST AUTOMATION 6 Not as mature as web automation Immature tools market Tools are usually platform specific Multi code base
  • 7. EMULATORS VS. DEVICES 7 What to test where?
  • 8. SAME AUTOMATION CODE BETWEEN PLATFORMS? 8 Sounds good first but Most apps are different between platforms Different element locator strategy Do reuse the helper functions
  • 9. TEST INFRASTRUCTURE 9 AUT API DB Browsers Mobiles
  • 11. A LITTLE SELENIUM HISTORY Selenium was so named because Huggins, dissatisfied with testing tools on the market, was seeking a name that would position the product as an alternative to Mercury Interactive QuickTest Professional commercial testing software. The name, Selenium, was selected because selenium mineral supplements serve as a cure for mercury poisoning, Huggins explained. 11
  • 12. WHAT IS SELENIUM? 12 SELENIUM AUTOMATES BROWSERS THAT'S IT ... One more thing ... Selenium is becoming a W3C standard: http://www.w3.org/TR/webdriver
  • 13. WHAT IS SELENIUM? 13 Protocol which describes user interactions Supports most browsers Supports most programming languages
  • 14. SELENIUM – WHAT IT IS NOT 14 a drag & drop tool a network testing / monitoring tool a performance testing tool a reporting tool a testcase management tool
  • 15. WHY OPEN SOURCE? 15 It is free (…) Independent of 3rd parties Faster innovation cycles Motivated employees Easier hiring
  • 16. THE SELENIUM „FLAVORS“ 16 Selenium IDE Selenium Selenium GRID Let’s forget about this one real quick
  • 18. SELENIUM 2 / WEBDRIVER 18 JSON WIRE PROTOCOL Client Java C# Ruby Python Server Server Server i.e. Selendroid, iOS-Driver
  • 19. SELENIUM CLIENT 19 Is seen as Selenium by the users Generates HTTP request, which are received by the server Is called by the test framework or the CI server Supported languages: Java, C#, Python, Ruby, Perl, PHP, JS
  • 20. SELENIUM SERVER 20 Receives HTTP requests from server Start and teardown of browser Translates requests into browser specific commands Communicates back to the client
  • 22. DOWNLOADS - http://www.seleniumhq.org/ - http://selenium.googlecode.com/files/ selenium-server-standalone-2.42.2.jar - Maven example: 22
  • 23. DRIVER 23 Each browser has its own driver Firefox driver is part of the standalone jar http://selenium.googlecode.com/files/selenium-server-standalone-2.42.2.jar Chrome: https://code.google.com/p/selenium/wiki/ChromeDriver Opera: https://code.google.com/p/selenium/wiki/OperaDriver Internet Explorer: https://code.google.com/p/selenium/wiki/ InternetExplorerDriver
  • 24. DRIVER Each driver implements the JSON Wire Protocol Driver interacts with the browser (or mobile) CLIENT SERVER 24 JSON Wire Protocol BROWSER DRIVER
  • 25. OUR FIRST TEST Open a Firefox Browser Go to http://gridfusion.net Close the browser @Test public void myFirstTest() { WebDriver driver = new FirefoxDriver(); driver.get("http://gridfusion.net"); driver.quit(); } 25
  • 27. PAGE TITLE Open a Firefox browser Go to http://gridfusion.net Print the page title in the console Close the browser @Test public void pageTitleTest() { WebDriver driver = new FirefoxDriver(); driver.get("http://gridfusion.net"); String pageTitle = driver.getTitle(); System.out.println(pageTitle); driver.quit(); } 27
  • 28. ASSERTS Open a Firefox Browser Go to: http://gridfusion.net Verify Page Title = GRIDFUSION.net – Home Close the browser 28
  • 29. WEBELEMENT 29 Represents an HTML Element Interactions on a page happen via WebElement http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html
  • 30. LOCATORS id cssSelector linkText name partialLinkText tagName xpath 30 driver.findElement(By.XYZ)
  • 32. REMOTE WEBDRIVER Decouples tests from browsers WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), DesiredCapabilities); 32 Machine 1 Eclipse TestNG CI Machine 2 HTTP Browser
  • 33. DESIRED CAPABILITIES - BROWSER 33 DesiredCapabilities capability = new DesiredCapabilities(); capability.setBrowserName(“firefox”); https://code.google.com/p/selenium/wiki/DesiredCapabilities
  • 34. REMOTEWEBDRIVER ● Start a selenium server: 34 ● java –jar selenium-server-standalone-2.42.2.jar ● Use RemoteWebDriver and set DesiredCapabilities to Firefox ● Open a Firefox browser ● Go to: http://gridfusion.net ● Close the browser @Test public void remoteWebdriverFireFoxTest() throws MalformedURLException { DesiredCapabilities capability = DesiredCapabilities.firefox(); WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability); driver.get("http://gridfusion.net"); driver.quit(); }
  • 36. WHY SELENIUM GRID? 36 Environment Management & Control Scaling Parallel execution of tests Reduction of execution times Crossover tests (web, mobile)
  • 37. SELENIUM GRID 37 SEQUENTIAL EXECUTION TEST TEST TEST TEST TIME n PARALLEL EXECUTION TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TIME n
  • 38. SCALING – SELENIUM GRID 38 DEV CI …. SELENIUM GRID HUB IOS ANDROID WINDOWS LINUX OSX
  • 39. 1. STEP– START THE GRID HUB 39 Open a new terminal window Start the Selenium GRID hub by typing: java -jar selenium-server-standalone-2.42.jar -role hub Enter http://localhost:4444/grid/console into the browser
  • 40. 2. STEP– REGISTER A NODE 40 Open a second terminal window Start and register a Selenium node by entering: java -jar selenium-server-standalone-x.y.z.jar –role wd -hub http://localhost:4444/grid/register
  • 41. SELENIUM NODE – STANDARD CONFIG - Go to: http://localhost:4444/grid/console Standard Configuration: 5 Firefox 5 Chrome 1 Internet Explorer 41
  • 44. STANDARD REPORTS - TestNG reports are put into: **/test-output - Look for: emailable-report.html 44
  • 45. CUSTOM REPORTING - By calling Reporter.log(“your log message”), you can add additional information to the report 45
  • 46. SCREENSHOTS - Screenshots can also be placed directly into the report 46
  • 48. SELENIUM 2 / WEBDRIVER 48 JSON WIRE PROTOCOL Client Java C# Ruby Python Server Server Server i.e. Selendroid, iOS-Driver
  • 49. (SOME) MOBILE AUTOMATION REQUIREMENTS * Reuse of the existing Selenium infrastructure for the web * Implementation of the Selenium protocol (JSON wire protocol) * The application under test (aut) should not need to be modified * Support for emulators/simulators as well as real devices * Parallel execution of tests in a Selenium Grid * Management of multiple applications, versions, languages * Support for runtime inspection for the app * Hybrid app support * No jailbreaking of device required 49
  • 50. IOS-DRIVER + SELENDROID 50 IOS: http://ios-driver.github.io/ios-driver/index.html ANDROID: http://selendroid.io/ Both projects implement the Webdriver API (JSON Wire Protocol)
  • 54. WRITE ONCE RUN EVERYWHERE 54
  • 55. WRITE ONCE RUN EVERYWHERE 55
  • 58. WHAT HAVE YOU LEARNED TODAY? 58