SlideShare a Scribd company logo
RELOADED
SELENIUM
TESTING
PATTERNS
JAVAONE 2017
CON3276
SAN FRANCISCO - 4 OCTOBER 2017
JORGE HIDALGO
VICENTE GONZÁLEZ
ACCENTURE DELIVERY CENTER IN SPAIN
ACCENTURE GLOBAL JAVA CAPABILITY
SEQUELS ARE NEVER ANY GOOD… REALLY?
Copyright © 2017 Accenture All rights reserved.
PRESENTER INTRODUCTIONS
Jorge Hidalgo
@_deors
deors
Senior Technology Architect
Global Java Community Lead
Accenture Spain
Father of two children, husband, Irish flute &
whistle player, video gamer, master chief
apprentice, sci-fi ‘junkie’, Star Wars fan,
eternal Lego journeyman, gadget lover and
in love with Raspberry Pi computers
Vicente González
@viarellano
viarellano
Technology Architect
Global Java Community Champion
Accenture Spain
52 month experience husband, proud father
of 3 years old princess Regina, senior beach
user, cooking lover, associate paddle player,
master Feria de Abril enthusiast, Sevilla FC fan
and Pearl Jam ninja evangelizer
REVISITING SELENIUM BEST PRACTICES AND PATTERNS
Copyright 2017 Accenture. All rights reserved. 3
SELENIUM RELOADED
Tips for Setting up a Selenium Grid
XPath and Testability
Effective use of APIs and Interfaces
Continuous Testing for Microservices
#TIP 1:
USING JSON FOR
CONFIGURATION
Copyright 2017 Accenture. All rights reserved. 4
#TIP 1: USING JSON FOR CONFIGURATION
Copyright 2017 Accenture. All rights reserved. 5
#TIP 2:
MANAGING NODES
WITH
VISGRID
Copyright 2017 Accenture. All rights reserved. 6
#TIP 2: MANAGING NODES WITH VISGRID
Copyright 2017 Accenture. All rights reserved. 7
VISGRID
DESKTOP JAVA APPLICATION THAT HELPS MANAGING HUBS AND
NODES
• Download from https://codoid.com/wp-content/uploads/2017/09/Visgrid-<version>.zip
• Decompress Visgrid-<version>.zip
• java –jar visgrid-1.14.jar
VisGrid is provided by Codoid (https://codoid.com/) under Apache License
#TIP 3:
CREATING AN
EPHEMERAL GRID
Copyright 2017 Accenture. All rights reserved. 8
#TIP 3: CREATING AN EPHEMERAL GRID
Copyright 2017 Accenture. All rights reserved. 9
YOU CAN CONFIGURE AND LAUNCH NODES FROM YOUR
CODE
• Add the Selenium Server dependency to your POM
#TIP 3: CREATING AN EPHEMERAL GRID
Copyright 2017 Accenture. All rights reserved. 10
Use the GridLauncher to create server instances with different roles
#TIP 4:
MANAGING DRIVERS
BINARIES
WEBDRIVERMANAGER
Copyright 2017 Accenture. All rights reserved. 11
#TIP 4: MANAGING DRIVERS BINARIES
WEBDRIVERMANAGER
Copyright 2017 Accenture. All rights reserved. 12
WebDriverManager
An OpenSource Project that helps one of the most commons
nightmares while using Selenium:
Managing the webdriver binaries.
https://github.com/bonigarcia/webdrivermanager
#TIP 4: MANAGING DRIVERS WITH
WEBDRIVERMANAGER
Copyright 2017 Accenture. All rights reserved. 13
Add the dependency
Use the DriverManager
#TIP 4: MANAGING DRIVERS WITH
WEBDRIVERMANAGER
Copyright 2017 Accenture. All rights reserved. 14
Fully configurable using the API
Or parameters
#TIP 5:
XPATH IS NOT
UNDER YOUR
CONTROL
Copyright 2017 Accenture. All rights reserved. 15
XPath usage in Selenium depends on:
Native capabilities for XPath of each browser
If not available, Selenium provides its own implementation
#TIP5: XPATH IS NOT UNDER YOUR CONTROL
An example from the Selenium documentation
#TIP5: XPATH IS NOT UNDER YOUR CONTROL
COROLLARY:
NEVER, NEVER
USE XPATH
Using XPath for
interacting with
your web is not
a PREDICTABLE
nor
REPEATABLE
approach.
#TIP 6:
ALTERNATIVES:
PROVIDE PREDICTABLE
ID TO YOUR WEB
ELEMENTS
Copyright 2017 Accenture. All rights reserved. 19
Instead of investing a lot in creating highly
complicated ways to interact with the elements in
your application, consider change the application
instead
- Overriding ID of your web elements
- Creating anchor elements that helps on
accessing your elements
#TIP6: ALTERNATIVES: PROVIDE
PREDICTABLE ID TO YOUR WEB ELEMENTS
COROLLARY:
THINK ON
TESTABILITY
One of the
drivers when
you define your
web framework
should be the
ability to test
the application
#TIP 7:
USING API
EFFECTIVELY:
THE ISELECT
INTERFACE
Copyright 2017 Accenture. All rights reserved. 22
The ISelect Interface provide methods to interact
with elements of type Select.
The Select implementation provides methods for:
• Select (by Index, by Value, by Text)
• Deselect (All, by Index, by Value, by Text)
Works with MultiSelect
#TIP7: USING API EFFECTIVELY: THE ISELECT
INTERFACE
#TIP 8:
THE ACTION
BUILDER CAN
ALSO HELPS
Copyright 2017 Accenture. All rights reserved. 24
We are using Selenium to emulate human
interaction with the application under test
The Action Interface Builder can be useful when
try to explicitly guide the interaction through your
web page
#TIP8: THE ACTION BUILDER CAN ALSO
HELPS
#TIP 9:
CONTINUOUS
TESTING FOR
MICROSERVICES
Copyright 2017 Accenture. All rights reserved. 26
Jenkins as Orchestrator
CONTINUOUS DELIVERY PIPELINES
Copyright © 2017 Accenture. All rights reserved. 27
Test scope is limited
to one service/app
Test scope is
end-to-end
Jenkins as Orchestrator
CONTINUOUS DELIVERY TRIGGERS
Copyright © 2017 Accenture. All rights reserved. 28
Trigger on code/config/test change
Tests are in the same code repo
Trigger after any component
is promoted and deployed
Trigger on end-to-end test change
End-to-end tests (and test data)
are in separate code repo
May reuse tests from components
corollary:
consider it as an
application
When you are
using Selenium
you are creating
an application
to test your
application
creditsRepositories:
https://github.com/viarellano/deors.demos.petclinic
https://github.com/deors/deors.demos.petclinic
Presentation from JavaOne 2016
https://es.slideshare.net/deors/javaone-2016-con3080-testing-
java-web-applications-with-selenium-a-cookbook

More Related Content

PDF
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
PPTX
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
PPTX
How to build Sdk? Best practices
KEY
OSGi, Eclipse and API Tooling
PDF
Operating Docker
PPTX
Banfootguns devseccon 2019
PPT
Eclipse Plug-in Develompent Tips And Tricks
PPTX
Infrastrucutre as Code
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
How to build Sdk? Best practices
OSGi, Eclipse and API Tooling
Operating Docker
Banfootguns devseccon 2019
Eclipse Plug-in Develompent Tips And Tricks
Infrastrucutre as Code

What's hot (20)

PDF
A Journey to Improve Infrastructure Compliance With InSpec
PPTX
Cloud Collaboration with Eclipse Che
PDF
.Net Hijacking to Defend PowerShell BSidesSF2017
PDF
From zero to hero with React Native!
PPTX
PDE builds or Maven
PDF
Building Rich Applications with Appcelerator
PDF
Reverse engineering and instrumentation of android apps
PPTX
Gabriele Provinciali/Gabriele Folchi/Luca Postacchini - Sviluppo con piattafo...
PPTX
Iterative Development with Swagger on the JDK
PDF
Developing modern java web applications with java ee 7 and angular js
PDF
Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)
PDF
Formacion en movilidad: Conceptos de desarrollo en iOS (I)
PDF
Android talks #08 dagger2
PDF
Lean Engineering. Applying Lean Principles to Building Experiences
PDF
Gwt and JSR 269's Pluggable Annotation Processing API
PPTX
Rancher master class globalized edge workloads with k3s
PDF
.NET Online TechTalk “Azure Cloud for DEV”
PDF
Using Go in DevOps
PDF
Working effectively with OpenShift
PPTX
Writer APIs in Java faster with Swagger Inflector
A Journey to Improve Infrastructure Compliance With InSpec
Cloud Collaboration with Eclipse Che
.Net Hijacking to Defend PowerShell BSidesSF2017
From zero to hero with React Native!
PDE builds or Maven
Building Rich Applications with Appcelerator
Reverse engineering and instrumentation of android apps
Gabriele Provinciali/Gabriele Folchi/Luca Postacchini - Sviluppo con piattafo...
Iterative Development with Swagger on the JDK
Developing modern java web applications with java ee 7 and angular js
Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)
Formacion en movilidad: Conceptos de desarrollo en iOS (I)
Android talks #08 dagger2
Lean Engineering. Applying Lean Principles to Building Experiences
Gwt and JSR 269's Pluggable Annotation Processing API
Rancher master class globalized edge workloads with k3s
.NET Online TechTalk “Azure Cloud for DEV”
Using Go in DevOps
Working effectively with OpenShift
Writer APIs in Java faster with Swagger Inflector
Ad

Similar to JavaOne 2017 CON3276 - Selenium Testing Patterns Reloaded (20)

PPTX
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
PDF
SCQAA-SF Selenium Presentation
PDF
How to use selenium successfully
PPTX
Selenium In The Real World
PDF
Selenium with testng and eclipse ide
PDF
Mastering Test Automation: How to Use Selenium Successfully
PDF
How To Use Selenium Successfully (Java Edition)
PPTX
Mastering Test Automation: How To Use Selenium Successfully
PDF
Learning selenium sample
PPTX
Selenium training
PDF
Handson Selenium Webdriver With Java A Deep Dive Into The Development Of Endt...
PDF
Selenium Online Training.pdf
PDF
Selenium Online Training.pdf
PDF
Selenium Online Training.pdf
PDF
Selenium Online Training.pdf
PDF
Selenium for Tester.pdf
PDF
Getting Started with Selenium
PPTX
Selenium for Jobseekers
PDF
Selenium Testing The Complete Step-by-Step Tutorial.pdf
PDF
Selenium webdriver practical_guide
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
SCQAA-SF Selenium Presentation
How to use selenium successfully
Selenium In The Real World
Selenium with testng and eclipse ide
Mastering Test Automation: How to Use Selenium Successfully
How To Use Selenium Successfully (Java Edition)
Mastering Test Automation: How To Use Selenium Successfully
Learning selenium sample
Selenium training
Handson Selenium Webdriver With Java A Deep Dive Into The Development Of Endt...
Selenium Online Training.pdf
Selenium Online Training.pdf
Selenium Online Training.pdf
Selenium Online Training.pdf
Selenium for Tester.pdf
Getting Started with Selenium
Selenium for Jobseekers
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Selenium webdriver practical_guide
Ad

More from Jorge Hidalgo (20)

PDF
GraalVM - MadridJUG 2019-10-22
PDF
GraalVM - OpenSlava 2019-10-18
PDF
Architecture 2020 - eComputing 2019-07-01
PDF
GraalVM - JBCNConf 2019-05-28
PDF
GraalVM - MálagaJUG 2018-11-29
PDF
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)
PDF
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Oracle Code One ...
PDF
Multilanguage pipelines with Jenkins, Docker and Kubernetes (DevOpsDays Riga ...
PPTX
DevOps Te Cambia la Vida - eComputing 2018-07-03
PPTX
Open Source Power Tools - Opensouthcode 2018-06-02
PDF
All Your Faces Belong to Us - Opensouthcode 2017-05-06
PDF
Por qué DevOps, por qué ahora @ CHAPI 2017
PDF
Accenture Liquid Architectures (for Master EMSE UPM-FI - April 2017)
PPTX
La JVM y el Internet de las Cosas @ MálagaJUG 2016-11-17
PPTX
OpenSlava 2016 - Lightweight Java Architectures
PPTX
OpenSouthCode 2016 - Accenture DevOps Platform 2016-05-07
PPTX
JavaOne 2015 - CON6489 - Smart Open Spaces Powered by Low Cost Computers
PPTX
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
PPTX
Next-gen IDE v2 - OpenSlava 2013-10-11
PPTX
The Usual Suspects - Red Hat Developer Day 2012-11-01
GraalVM - MadridJUG 2019-10-22
GraalVM - OpenSlava 2019-10-18
Architecture 2020 - eComputing 2019-07-01
GraalVM - JBCNConf 2019-05-28
GraalVM - MálagaJUG 2018-11-29
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Oracle Code One ...
Multilanguage pipelines with Jenkins, Docker and Kubernetes (DevOpsDays Riga ...
DevOps Te Cambia la Vida - eComputing 2018-07-03
Open Source Power Tools - Opensouthcode 2018-06-02
All Your Faces Belong to Us - Opensouthcode 2017-05-06
Por qué DevOps, por qué ahora @ CHAPI 2017
Accenture Liquid Architectures (for Master EMSE UPM-FI - April 2017)
La JVM y el Internet de las Cosas @ MálagaJUG 2016-11-17
OpenSlava 2016 - Lightweight Java Architectures
OpenSouthCode 2016 - Accenture DevOps Platform 2016-05-07
JavaOne 2015 - CON6489 - Smart Open Spaces Powered by Low Cost Computers
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
Next-gen IDE v2 - OpenSlava 2013-10-11
The Usual Suspects - Red Hat Developer Day 2012-11-01

Recently uploaded (20)

PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
System and Network Administraation Chapter 3
PDF
System and Network Administration Chapter 2
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPT
Introduction Database Management System for Course Database
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Transform Your Business with a Software ERP System
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
top salesforce developer skills in 2025.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
history of c programming in notes for students .pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
System and Network Administraation Chapter 3
System and Network Administration Chapter 2
PTS Company Brochure 2025 (1).pdf.......
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction Database Management System for Course Database
Designing Intelligence for the Shop Floor.pdf
Transform Your Business with a Software ERP System
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Softaken Excel to vCard Converter Software.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
top salesforce developer skills in 2025.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Computer Software and OS of computer science of grade 11.pptx
history of c programming in notes for students .pptx

JavaOne 2017 CON3276 - Selenium Testing Patterns Reloaded

  • 1. RELOADED SELENIUM TESTING PATTERNS JAVAONE 2017 CON3276 SAN FRANCISCO - 4 OCTOBER 2017 JORGE HIDALGO VICENTE GONZÁLEZ ACCENTURE DELIVERY CENTER IN SPAIN ACCENTURE GLOBAL JAVA CAPABILITY SEQUELS ARE NEVER ANY GOOD… REALLY?
  • 2. Copyright © 2017 Accenture All rights reserved. PRESENTER INTRODUCTIONS Jorge Hidalgo @_deors deors Senior Technology Architect Global Java Community Lead Accenture Spain Father of two children, husband, Irish flute & whistle player, video gamer, master chief apprentice, sci-fi ‘junkie’, Star Wars fan, eternal Lego journeyman, gadget lover and in love with Raspberry Pi computers Vicente González @viarellano viarellano Technology Architect Global Java Community Champion Accenture Spain 52 month experience husband, proud father of 3 years old princess Regina, senior beach user, cooking lover, associate paddle player, master Feria de Abril enthusiast, Sevilla FC fan and Pearl Jam ninja evangelizer
  • 3. REVISITING SELENIUM BEST PRACTICES AND PATTERNS Copyright 2017 Accenture. All rights reserved. 3 SELENIUM RELOADED Tips for Setting up a Selenium Grid XPath and Testability Effective use of APIs and Interfaces Continuous Testing for Microservices
  • 4. #TIP 1: USING JSON FOR CONFIGURATION Copyright 2017 Accenture. All rights reserved. 4
  • 5. #TIP 1: USING JSON FOR CONFIGURATION Copyright 2017 Accenture. All rights reserved. 5
  • 6. #TIP 2: MANAGING NODES WITH VISGRID Copyright 2017 Accenture. All rights reserved. 6
  • 7. #TIP 2: MANAGING NODES WITH VISGRID Copyright 2017 Accenture. All rights reserved. 7 VISGRID DESKTOP JAVA APPLICATION THAT HELPS MANAGING HUBS AND NODES • Download from https://codoid.com/wp-content/uploads/2017/09/Visgrid-<version>.zip • Decompress Visgrid-<version>.zip • java –jar visgrid-1.14.jar VisGrid is provided by Codoid (https://codoid.com/) under Apache License
  • 8. #TIP 3: CREATING AN EPHEMERAL GRID Copyright 2017 Accenture. All rights reserved. 8
  • 9. #TIP 3: CREATING AN EPHEMERAL GRID Copyright 2017 Accenture. All rights reserved. 9 YOU CAN CONFIGURE AND LAUNCH NODES FROM YOUR CODE • Add the Selenium Server dependency to your POM
  • 10. #TIP 3: CREATING AN EPHEMERAL GRID Copyright 2017 Accenture. All rights reserved. 10 Use the GridLauncher to create server instances with different roles
  • 11. #TIP 4: MANAGING DRIVERS BINARIES WEBDRIVERMANAGER Copyright 2017 Accenture. All rights reserved. 11
  • 12. #TIP 4: MANAGING DRIVERS BINARIES WEBDRIVERMANAGER Copyright 2017 Accenture. All rights reserved. 12 WebDriverManager An OpenSource Project that helps one of the most commons nightmares while using Selenium: Managing the webdriver binaries. https://github.com/bonigarcia/webdrivermanager
  • 13. #TIP 4: MANAGING DRIVERS WITH WEBDRIVERMANAGER Copyright 2017 Accenture. All rights reserved. 13 Add the dependency Use the DriverManager
  • 14. #TIP 4: MANAGING DRIVERS WITH WEBDRIVERMANAGER Copyright 2017 Accenture. All rights reserved. 14 Fully configurable using the API Or parameters
  • 15. #TIP 5: XPATH IS NOT UNDER YOUR CONTROL Copyright 2017 Accenture. All rights reserved. 15
  • 16. XPath usage in Selenium depends on: Native capabilities for XPath of each browser If not available, Selenium provides its own implementation #TIP5: XPATH IS NOT UNDER YOUR CONTROL
  • 17. An example from the Selenium documentation #TIP5: XPATH IS NOT UNDER YOUR CONTROL
  • 18. COROLLARY: NEVER, NEVER USE XPATH Using XPath for interacting with your web is not a PREDICTABLE nor REPEATABLE approach.
  • 19. #TIP 6: ALTERNATIVES: PROVIDE PREDICTABLE ID TO YOUR WEB ELEMENTS Copyright 2017 Accenture. All rights reserved. 19
  • 20. Instead of investing a lot in creating highly complicated ways to interact with the elements in your application, consider change the application instead - Overriding ID of your web elements - Creating anchor elements that helps on accessing your elements #TIP6: ALTERNATIVES: PROVIDE PREDICTABLE ID TO YOUR WEB ELEMENTS
  • 21. COROLLARY: THINK ON TESTABILITY One of the drivers when you define your web framework should be the ability to test the application
  • 22. #TIP 7: USING API EFFECTIVELY: THE ISELECT INTERFACE Copyright 2017 Accenture. All rights reserved. 22
  • 23. The ISelect Interface provide methods to interact with elements of type Select. The Select implementation provides methods for: • Select (by Index, by Value, by Text) • Deselect (All, by Index, by Value, by Text) Works with MultiSelect #TIP7: USING API EFFECTIVELY: THE ISELECT INTERFACE
  • 24. #TIP 8: THE ACTION BUILDER CAN ALSO HELPS Copyright 2017 Accenture. All rights reserved. 24
  • 25. We are using Selenium to emulate human interaction with the application under test The Action Interface Builder can be useful when try to explicitly guide the interaction through your web page #TIP8: THE ACTION BUILDER CAN ALSO HELPS
  • 26. #TIP 9: CONTINUOUS TESTING FOR MICROSERVICES Copyright 2017 Accenture. All rights reserved. 26
  • 27. Jenkins as Orchestrator CONTINUOUS DELIVERY PIPELINES Copyright © 2017 Accenture. All rights reserved. 27 Test scope is limited to one service/app Test scope is end-to-end
  • 28. Jenkins as Orchestrator CONTINUOUS DELIVERY TRIGGERS Copyright © 2017 Accenture. All rights reserved. 28 Trigger on code/config/test change Tests are in the same code repo Trigger after any component is promoted and deployed Trigger on end-to-end test change End-to-end tests (and test data) are in separate code repo May reuse tests from components
  • 29. corollary: consider it as an application When you are using Selenium you are creating an application to test your application
  • 30. creditsRepositories: https://github.com/viarellano/deors.demos.petclinic https://github.com/deors/deors.demos.petclinic Presentation from JavaOne 2016 https://es.slideshare.net/deors/javaone-2016-con3080-testing- java-web-applications-with-selenium-a-cookbook