SlideShare a Scribd company logo
Test Client & User Interface
using Selenium
Peyman Fakharian
Hamed Salimian
Software Testing
Computer Department, Sharif University of Technology
2017-12
1
Web testing
 Automated testing is an extremely useful bug-killing tool
for the modern Web development
 Testing a Web application is a complex task
 several layers of logic
 test-execution framework
 Web testing main parts
 Database
 URL- Context
 HTTP requests
 Client/User Interface
2
Client Testing
 Simulate GET and POST requests on a URL and observe the
response
 See the chain of redirects (if any) and check the URL and
status code at each step.
 Test that a given request is rendered with a context that
contains certain values.
 HTTP-based Client tests vs. in-browser frameworks
3
HTTP-based Testing
 Get/POST requests
 API
 Login/Register
 Search
 Status codes
4
HTTP-based Testing (cont.)
 Let’s see in action!
5
Selenium
 So what is Selenium?
 Selenium automates browsers
 automating web applications for testing purposes
 automating Boring web-based administration tasks
 Selenium Web Driver
 create robust, browser-based regression automation suites and tests
 Previously known as Selenium RC (Remote Control)
 Selenium IDE
 create quick bug reproduction scripts
 Firefox add-on
6
Selenium available
languages
Selenium WebDriver
 Driving a browser natively as a user would either locally or
on a remote machine
 An API driven browser
 Chrome
 Firefox,
 Safari
 IE
 PhantomJS Driver
 Remote web Driver
7
Selenium (cont.)
 So why we need selenium?
 Simulate user interactions
 Test in different browsers
 AJAX applications
 DO all things a user could do in a browser! Not just http
requests, any thing!
 Selenium is humanized!
 Not only your code
 Also your interactions!
 Integration with different web frameworks
8
Getting started!
 Walk through the selenium docs example
9
Testing forms
Let’s try
this
example
step by
step!
10
Testing form fields
a simple regex to detect
phone numbers with
exact 11 digits
11
Navigation Utilities
 Selenium provides different navigation utilities
 Click links
 Submit forms
 Drag and drop
 Moving between windows
 Browser history
 Also provides cookies
 So you can use session
 Login, authentication, authorization, … made easy now!
Drag & drop from selenium documentation
12
Locating Elements
 Let’s see through an example
13
Waits capability
 most of the web apps are using AJAX
 if an element is not yet present in the DOM, a locate
function will raise an ElementNotVisibleException exception
 Waiting provides some slack between actions performed
 Implicit (makes WebDriver poll the DOM for a certain amount
of time)
 Explicit (certain condition)
 Let’s see in action!
14
Test design
 Types of tests
 Static content
 Links
 Function tests
 Ajax tests
 Locating strategy
 Dynamic elements
 User interface mapping
 makes script maintenance more efficient
 more human-readable names
 Database Validation
15
Data driven testing
 using the same test (or tests) multiple times with varying
data
 data sets are often from external files i.e. .csv
 validate an application against many varying inputs
 Let’s write some codes!
16
Page object design pattern
 A page object represents an area in the web application user
interface that your test is interacting.
 Benefits of using page object pattern:
 Creating reusable code that can be shared across multiple test
cases
 improve readability
 Reducing the amount of duplicated code
 If the user interface changes, the fix needs changes in only one
place
 creating an object for each web page
 create robust, browser-based regression automation suites and
tests
 By following this technique a layer of separation between the
test code and technical implementation is created
17
Page object design pattern
(cont.)
Image source: blazemeter tech. blog
18
Page object design pattern
(cont.)
 Consist of two/three/four main parts:
 Locators
 Elements
 Pages
 Tests
 Page object design pattern has been evolved in screenplay
pattern.
 Let’s execute some codes!
19
Selenium grid
 Selenium-Grid allows you run your tests on different machines
against different browsers in parallel.
 support distributed test execution
 When you should use selenium grid?
 To reduce the time it takes for the test suite to complete
 To run your tests against multiple browsers, multiple versions of
browser, and browsers running on different operating systems.
 Steps:
 Install selenium server/grid (jar file)
 Run selenium server and create a hub
 Create multiple nodes as you want
20
Notable features
 Use proxy for browser startup
 Action chains
 Key up, hover, key down, enter, move, etc.
 Remote web-driver
 Desired Capabilities
 Color support
Example of desired capacities
21
Notable features (cont.)
 Save/download/upload files
 Custom Firefox profile
 Take screenshot
 All user navigations
 Selenium Web Driver
Custom Firefox profile
22
Other Selenium applications
 Not only for test automation
 Crawl/scrape ajax based pages
 Monitoring/Metric collections
Examples of Yektanet ads
23
Selenium project has a
conference!
 The Official 2017 European Selenium Conference
 Berlin, Germany | 9–10 October
 You can watch the talks in selenium YouTube channel
 https://www.youtube.com/user/seleniumconf/videos
24
Conclusion
 Selenium automates browsers
 automating web applications for testing purposes
 You can do anything a real user does on your website
 Simulate various type/version of the browsers
 Great features, human readable
 Introduce/develop some test design patterns
25
Any Question?26

More Related Content

What's hot (20)

PDF
Application Testing Suite
oracleonthebrain
 
PPT
Vsts 2
Mohamed Samy
 
PPT
Frequently Used Off Host Developer Toolsl
Sharan S
 
PPT
Team Foundation Server Version Control
Steve Lange
 
PPTX
Team Foundation Server - Source Control
Dhirendra Singh
 
PPTX
Performance Testing REST APIs
Jason Weden
 
PPT
Vsts Msdn Presentation2003
John Sanderson
 
PPTX
Xamarin.Forms Bootcamp
Mike Melusky
 
PDF
Oracle Application Testing Suite. Competitive Edge
Maija Laksa
 
PDF
REX Meetic, Comment la qualité reflète-t-elle nos organisations ?
meeticTech
 
PPTX
Develop business apps cross-platform development using visual studio with x...
Alexander Meijers
 
PPTX
What's new in ALM using Visual Studio 2013 and TFS 2013
Microsoft Visual Studio
 
PPTX
Selenium WebDriver
Sachin-QA
 
PDF
VishalSinha_Resume_Ora
Vishal Sinha
 
PPTX
Oracle application testing suite online training
Glory IT Technologies Pvt. Ltd.
 
PPT
Symantec I3 - Inquire & Cluster
sebastian.guerrero
 
PPT
Introduction To CodeIgniter
schwebbie
 
PDF
Crafting ColdFusion Applications like an Architect
ColdFusionConference
 
PDF
CodeIgniter - PHP MVC Framework by silicongulf.com
Christopher Cubos
 
PPTX
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
Richard Robinson
 
Application Testing Suite
oracleonthebrain
 
Vsts 2
Mohamed Samy
 
Frequently Used Off Host Developer Toolsl
Sharan S
 
Team Foundation Server Version Control
Steve Lange
 
Team Foundation Server - Source Control
Dhirendra Singh
 
Performance Testing REST APIs
Jason Weden
 
Vsts Msdn Presentation2003
John Sanderson
 
Xamarin.Forms Bootcamp
Mike Melusky
 
Oracle Application Testing Suite. Competitive Edge
Maija Laksa
 
REX Meetic, Comment la qualité reflète-t-elle nos organisations ?
meeticTech
 
Develop business apps cross-platform development using visual studio with x...
Alexander Meijers
 
What's new in ALM using Visual Studio 2013 and TFS 2013
Microsoft Visual Studio
 
Selenium WebDriver
Sachin-QA
 
VishalSinha_Resume_Ora
Vishal Sinha
 
Oracle application testing suite online training
Glory IT Technologies Pvt. Ltd.
 
Symantec I3 - Inquire & Cluster
sebastian.guerrero
 
Introduction To CodeIgniter
schwebbie
 
Crafting ColdFusion Applications like an Architect
ColdFusionConference
 
CodeIgniter - PHP MVC Framework by silicongulf.com
Christopher Cubos
 
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
Richard Robinson
 

Similar to Web UI Tests: Introduce UI tests using Selenium (20)

PDF
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
PPTX
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
PDF
Selenium Automation Testing - A Complete Guide.pdf
flufftailshop
 
PDF
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Steve Wortham
 
PDF
Selenium Automation Testing - A Complete Guide
Abhay Kumar
 
PDF
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Dave Haeffner
 
PDF
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
PPT
Selenium
Sun Technlogies
 
PPT
selenium.ppt
ssuser7b4894
 
PPT
selenium.ppt
AmenSheikh
 
PPT
selenium.ppt
rajnexient
 
PDF
How To Use Selenium Successfully (Java Edition)
Sauce Labs
 
PDF
Selenium course training institute ameerpet hyderabad – Best software trainin...
Sathya Technologies
 
PDF
Selenium course training institute ameerpet hyderabad
Sathya Technologies
 
PDF
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
PDF
Selenium Testing: A Comprehensive Guide to Automated Web Testing
pCloudy
 
PPTX
Selenium.pptx
Pandiya Rajan
 
PDF
How To Use Selenium Successfully
Dave Haeffner
 
PPTX
Selenium Automation
Anuradha Malalasena
 
DOC
Selenium course syllabus
lakshmipriyaaka
 
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
Selenium Automation Testing - A Complete Guide.pdf
flufftailshop
 
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Steve Wortham
 
Selenium Automation Testing - A Complete Guide
Abhay Kumar
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Dave Haeffner
 
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
Selenium
Sun Technlogies
 
selenium.ppt
ssuser7b4894
 
selenium.ppt
AmenSheikh
 
selenium.ppt
rajnexient
 
How To Use Selenium Successfully (Java Edition)
Sauce Labs
 
Selenium course training institute ameerpet hyderabad – Best software trainin...
Sathya Technologies
 
Selenium course training institute ameerpet hyderabad
Sathya Technologies
 
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
Selenium Testing: A Comprehensive Guide to Automated Web Testing
pCloudy
 
Selenium.pptx
Pandiya Rajan
 
How To Use Selenium Successfully
Dave Haeffner
 
Selenium Automation
Anuradha Malalasena
 
Selenium course syllabus
lakshmipriyaaka
 
Ad

Recently uploaded (20)

PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Tally software_Introduction_Presentation
AditiBansal54083
 
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Ad

Web UI Tests: Introduce UI tests using Selenium

  • 1. Test Client & User Interface using Selenium Peyman Fakharian Hamed Salimian Software Testing Computer Department, Sharif University of Technology 2017-12 1
  • 2. Web testing  Automated testing is an extremely useful bug-killing tool for the modern Web development  Testing a Web application is a complex task  several layers of logic  test-execution framework  Web testing main parts  Database  URL- Context  HTTP requests  Client/User Interface 2
  • 3. Client Testing  Simulate GET and POST requests on a URL and observe the response  See the chain of redirects (if any) and check the URL and status code at each step.  Test that a given request is rendered with a context that contains certain values.  HTTP-based Client tests vs. in-browser frameworks 3
  • 4. HTTP-based Testing  Get/POST requests  API  Login/Register  Search  Status codes 4
  • 5. HTTP-based Testing (cont.)  Let’s see in action! 5
  • 6. Selenium  So what is Selenium?  Selenium automates browsers  automating web applications for testing purposes  automating Boring web-based administration tasks  Selenium Web Driver  create robust, browser-based regression automation suites and tests  Previously known as Selenium RC (Remote Control)  Selenium IDE  create quick bug reproduction scripts  Firefox add-on 6 Selenium available languages
  • 7. Selenium WebDriver  Driving a browser natively as a user would either locally or on a remote machine  An API driven browser  Chrome  Firefox,  Safari  IE  PhantomJS Driver  Remote web Driver 7
  • 8. Selenium (cont.)  So why we need selenium?  Simulate user interactions  Test in different browsers  AJAX applications  DO all things a user could do in a browser! Not just http requests, any thing!  Selenium is humanized!  Not only your code  Also your interactions!  Integration with different web frameworks 8
  • 9. Getting started!  Walk through the selenium docs example 9
  • 11. Testing form fields a simple regex to detect phone numbers with exact 11 digits 11
  • 12. Navigation Utilities  Selenium provides different navigation utilities  Click links  Submit forms  Drag and drop  Moving between windows  Browser history  Also provides cookies  So you can use session  Login, authentication, authorization, … made easy now! Drag & drop from selenium documentation 12
  • 13. Locating Elements  Let’s see through an example 13
  • 14. Waits capability  most of the web apps are using AJAX  if an element is not yet present in the DOM, a locate function will raise an ElementNotVisibleException exception  Waiting provides some slack between actions performed  Implicit (makes WebDriver poll the DOM for a certain amount of time)  Explicit (certain condition)  Let’s see in action! 14
  • 15. Test design  Types of tests  Static content  Links  Function tests  Ajax tests  Locating strategy  Dynamic elements  User interface mapping  makes script maintenance more efficient  more human-readable names  Database Validation 15
  • 16. Data driven testing  using the same test (or tests) multiple times with varying data  data sets are often from external files i.e. .csv  validate an application against many varying inputs  Let’s write some codes! 16
  • 17. Page object design pattern  A page object represents an area in the web application user interface that your test is interacting.  Benefits of using page object pattern:  Creating reusable code that can be shared across multiple test cases  improve readability  Reducing the amount of duplicated code  If the user interface changes, the fix needs changes in only one place  creating an object for each web page  create robust, browser-based regression automation suites and tests  By following this technique a layer of separation between the test code and technical implementation is created 17
  • 18. Page object design pattern (cont.) Image source: blazemeter tech. blog 18
  • 19. Page object design pattern (cont.)  Consist of two/three/four main parts:  Locators  Elements  Pages  Tests  Page object design pattern has been evolved in screenplay pattern.  Let’s execute some codes! 19
  • 20. Selenium grid  Selenium-Grid allows you run your tests on different machines against different browsers in parallel.  support distributed test execution  When you should use selenium grid?  To reduce the time it takes for the test suite to complete  To run your tests against multiple browsers, multiple versions of browser, and browsers running on different operating systems.  Steps:  Install selenium server/grid (jar file)  Run selenium server and create a hub  Create multiple nodes as you want 20
  • 21. Notable features  Use proxy for browser startup  Action chains  Key up, hover, key down, enter, move, etc.  Remote web-driver  Desired Capabilities  Color support Example of desired capacities 21
  • 22. Notable features (cont.)  Save/download/upload files  Custom Firefox profile  Take screenshot  All user navigations  Selenium Web Driver Custom Firefox profile 22
  • 23. Other Selenium applications  Not only for test automation  Crawl/scrape ajax based pages  Monitoring/Metric collections Examples of Yektanet ads 23
  • 24. Selenium project has a conference!  The Official 2017 European Selenium Conference  Berlin, Germany | 9–10 October  You can watch the talks in selenium YouTube channel  https://www.youtube.com/user/seleniumconf/videos 24
  • 25. Conclusion  Selenium automates browsers  automating web applications for testing purposes  You can do anything a real user does on your website  Simulate various type/version of the browsers  Great features, human readable  Introduce/develop some test design patterns 25