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)

PPT
Selenium
Sun Technlogies
 
PPTX
#2 integration + ui tests
eleksdev
 
PPT
selenium.ppt
rajnexient
 
PPT
selenium.ppt
AmenSheikh
 
PPT
selenium.ppt
ssuser7b4894
 
PPT
Selenium
Purna Chandar
 
PDF
Robot Framework Introduction & Sauce Labs Integration
Sauce Labs
 
PDF
Selenium -Test automation for web applications
AnisGhelissi
 
PPT
Stepin evening presented
Vijayan Reddy
 
PPTX
Automated Web Testing With Selenium
Jodie Miners
 
PPTX
Selenium
Milind Hali
 
PPTX
Selenium Basics and Overview topics.pptx
sountharyaravi010
 
PPTX
Selenium Basics and Overview1233444.pptx
sountharyaravi010
 
PPTX
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
PPTX
Automated Testing using JavaScript
Simon Guest
 
PPT
Selenium
Daksh Sharma
 
PPT
By combining Selenium for frontend testing and tools
sivanandhumanickam84
 
PPT
ASP.NET OVERVIEW
Rishi Kothari
 
PPTX
Selenium ui paradigm - DDD North 2
Nathan Gloyn
 
PPTX
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Agile Testing Alliance
 
Selenium
Sun Technlogies
 
#2 integration + ui tests
eleksdev
 
selenium.ppt
rajnexient
 
selenium.ppt
AmenSheikh
 
selenium.ppt
ssuser7b4894
 
Selenium
Purna Chandar
 
Robot Framework Introduction & Sauce Labs Integration
Sauce Labs
 
Selenium -Test automation for web applications
AnisGhelissi
 
Stepin evening presented
Vijayan Reddy
 
Automated Web Testing With Selenium
Jodie Miners
 
Selenium
Milind Hali
 
Selenium Basics and Overview topics.pptx
sountharyaravi010
 
Selenium Basics and Overview1233444.pptx
sountharyaravi010
 
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
Automated Testing using JavaScript
Simon Guest
 
Selenium
Daksh Sharma
 
By combining Selenium for frontend testing and tools
sivanandhumanickam84
 
ASP.NET OVERVIEW
Rishi Kothari
 
Selenium ui paradigm - DDD North 2
Nathan Gloyn
 
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Agile Testing Alliance
 
Ad

Recently uploaded (20)

PDF
Dealing with JSON in the relational world
Andres Almiray
 
PDF
Power BI vs Tableau vs Looker - Which BI Tool is Right for You?
MagnusMinds IT Solution LLP
 
PDF
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
 
PDF
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
 
PDF
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
 
PDF
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
PPTX
EO4EU Ocean Monitoring: Maritime Weather Routing Optimsation Use Case
EO4EU
 
PPTX
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
 
PDF
Rewards and Recognition (2).pdf
ethan Talor
 
PPTX
Automatic_Iperf_Log_Result_Excel_visual_v2.pptx
Chen-Chih Lee
 
PPTX
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
PPTX
CONCEPT OF PROGRAMMING in language .pptx
tamim41
 
PPTX
Wondershare Filmora Crack 14.5.18 + Key Full Download [Latest 2025]
HyperPc soft
 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
 
PDF
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
 
PPTX
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
PDF
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
 
PPTX
NeuroStrata: Harnessing Neuro-Symbolic Paradigms for Improved Testability and...
Ivan Ruchkin
 
PPTX
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
Dealing with JSON in the relational world
Andres Almiray
 
Power BI vs Tableau vs Looker - Which BI Tool is Right for You?
MagnusMinds IT Solution LLP
 
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
 
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
 
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
 
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
EO4EU Ocean Monitoring: Maritime Weather Routing Optimsation Use Case
EO4EU
 
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
 
Rewards and Recognition (2).pdf
ethan Talor
 
Automatic_Iperf_Log_Result_Excel_visual_v2.pptx
Chen-Chih Lee
 
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
CONCEPT OF PROGRAMMING in language .pptx
tamim41
 
Wondershare Filmora Crack 14.5.18 + Key Full Download [Latest 2025]
HyperPc soft
 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
 
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
 
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
 
NeuroStrata: Harnessing Neuro-Symbolic Paradigms for Improved Testability and...
Ivan Ruchkin
 
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
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