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

PDF
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
PDF
Dev ops, from theory to practice, by vahid rahimian
PPTX
PHP Symfony MicroServices Migration @MeeticTech
PPTX
SP2010 Developer Tools
PPTX
Whats New In 2010 (Msdn & Visual Studio)
PPT
Testing soa, web services and application development framework applications
PPT
Best Practices Configuring And Developing Share Point Solutions
PDF
Kasten securing access to your kubernetes applications
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
Dev ops, from theory to practice, by vahid rahimian
PHP Symfony MicroServices Migration @MeeticTech
SP2010 Developer Tools
Whats New In 2010 (Msdn & Visual Studio)
Testing soa, web services and application development framework applications
Best Practices Configuring And Developing Share Point Solutions
Kasten securing access to your kubernetes applications

What's hot (20)

PDF
Application Testing Suite
PPT
Vsts 2
PPT
Frequently Used Off Host Developer Toolsl
PPT
Team Foundation Server Version Control
PPTX
Team Foundation Server - Source Control
PPTX
Performance Testing REST APIs
PPT
Vsts Msdn Presentation2003
PPTX
Xamarin.Forms Bootcamp
PDF
Oracle Application Testing Suite. Competitive Edge
PDF
REX Meetic, Comment la qualité reflète-t-elle nos organisations ?
PPTX
Develop business apps cross-platform development using visual studio with x...
PPTX
What's new in ALM using Visual Studio 2013 and TFS 2013
PPTX
Selenium WebDriver
PDF
VishalSinha_Resume_Ora
PPTX
Oracle application testing suite online training
PPT
Symantec I3 - Inquire & Cluster
PPT
Introduction To CodeIgniter
PDF
Crafting ColdFusion Applications like an Architect
PDF
CodeIgniter - PHP MVC Framework by silicongulf.com
PPTX
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
Application Testing Suite
Vsts 2
Frequently Used Off Host Developer Toolsl
Team Foundation Server Version Control
Team Foundation Server - Source Control
Performance Testing REST APIs
Vsts Msdn Presentation2003
Xamarin.Forms Bootcamp
Oracle Application Testing Suite. Competitive Edge
REX Meetic, Comment la qualité reflète-t-elle nos organisations ?
Develop business apps cross-platform development using visual studio with x...
What's new in ALM using Visual Studio 2013 and TFS 2013
Selenium WebDriver
VishalSinha_Resume_Ora
Oracle application testing suite online training
Symantec I3 - Inquire & Cluster
Introduction To CodeIgniter
Crafting ColdFusion Applications like an Architect
CodeIgniter - PHP MVC Framework by silicongulf.com
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
Ad

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

PPT
Selenium
PPTX
#2 integration + ui tests
PPT
selenium.ppt
PPT
selenium.ppt
PPT
selenium.ppt
PPT
Selenium
PDF
Robot Framework Introduction & Sauce Labs Integration
PDF
Selenium -Test automation for web applications
PPT
Stepin evening presented
PPTX
Introduction to the Selenium_Session1.pptx
PPTX
Automated Web Testing With Selenium
PPTX
Selenium
PPTX
Selenium Basics and Overview topics.pptx
PPTX
Selenium Basics and Overview1233444.pptx
PPTX
Test automation using selenium
PPTX
Automated Testing using JavaScript
PPT
Selenium
PPT
By combining Selenium for frontend testing and tools
PPT
ASP.NET OVERVIEW
PPTX
Selenium ui paradigm - DDD North 2
Selenium
#2 integration + ui tests
selenium.ppt
selenium.ppt
selenium.ppt
Selenium
Robot Framework Introduction & Sauce Labs Integration
Selenium -Test automation for web applications
Stepin evening presented
Introduction to the Selenium_Session1.pptx
Automated Web Testing With Selenium
Selenium
Selenium Basics and Overview topics.pptx
Selenium Basics and Overview1233444.pptx
Test automation using selenium
Automated Testing using JavaScript
Selenium
By combining Selenium for frontend testing and tools
ASP.NET OVERVIEW
Selenium ui paradigm - DDD North 2
Ad

Recently uploaded (20)

PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
PPTX
Introduction to Windows Operating System
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PPTX
Airline CRS | Airline CRS Systems | CRS System
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
Guide to Food Delivery App Development.pdf
PDF
MCP Security Tutorial - Beginner to Advanced
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
"Secure File Sharing Solutions on AWS".pptx
PDF
AI Guide for Business Growth - Arna Softech
PDF
E-Commerce Website Development Companyin india
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
Microsoft Office 365 Crack Download Free
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Cybersecurity: Protecting the Digital World
Practical Indispensable Project Management Tips for Delivering Successful Exp...
Introduction to Windows Operating System
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Airline CRS | Airline CRS Systems | CRS System
iTop VPN Crack Latest Version Full Key 2025
Guide to Food Delivery App Development.pdf
MCP Security Tutorial - Beginner to Advanced
Tech Workshop Escape Room Tech Workshop
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
"Secure File Sharing Solutions on AWS".pptx
AI Guide for Business Growth - Arna Softech
E-Commerce Website Development Companyin india
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
Microsoft Office 365 Crack Download Free
GSA Content Generator Crack (2025 Latest)
Salesforce Agentforce AI Implementation.pdf
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Computer Software - Technology and Livelihood Education
Cybersecurity: Protecting the Digital World

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