SlideShare a Scribd company logo
1 of 26
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

Frequently Used Off Host Developer Toolsl
Frequently Used Off Host Developer ToolslFrequently Used Off Host Developer Toolsl
Frequently Used Off Host Developer ToolslSharan S
 
Team Foundation Server Version Control
Team Foundation Server Version ControlTeam Foundation Server Version Control
Team Foundation Server Version ControlSteve Lange
 
Team Foundation Server - Source Control
Team Foundation Server - Source ControlTeam Foundation Server - Source Control
Team Foundation Server - Source ControlDhirendra Singh
 
Performance Testing REST APIs
Performance Testing REST APIsPerformance Testing REST APIs
Performance Testing REST APIsJason Weden
 
Vsts Msdn Presentation2003
Vsts Msdn Presentation2003Vsts Msdn Presentation2003
Vsts Msdn Presentation2003John Sanderson
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms BootcampMike Melusky
 
Oracle Application Testing Suite. Competitive Edge
Oracle Application Testing Suite. Competitive EdgeOracle Application Testing Suite. Competitive Edge
Oracle Application Testing Suite. Competitive EdgeMaija Laksa
 
REX Meetic, Comment la qualité reflète-t-elle nos organisations ?
REX Meetic, Comment la qualité reflète-t-elle nos organisations ?REX Meetic, Comment la qualité reflète-t-elle nos organisations ?
REX Meetic, Comment la qualité reflète-t-elle nos organisations ?meeticTech
 
Develop business apps cross-platform development using visual studio with x...
Develop business apps   cross-platform development using visual studio with x...Develop business apps   cross-platform development using visual studio with x...
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
What's new in ALM using Visual Studio 2013 and TFS 2013What's new in ALM using Visual Studio 2013 and TFS 2013
What's new in ALM using Visual Studio 2013 and TFS 2013Microsoft Visual Studio
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriverSachin-QA
 
VishalSinha_Resume_Ora
VishalSinha_Resume_OraVishalSinha_Resume_Ora
VishalSinha_Resume_OraVishal Sinha
 
Symantec I3 - Inquire & Cluster
Symantec I3 - Inquire & Cluster Symantec I3 - Inquire & Cluster
Symantec I3 - Inquire & Cluster sebastian.guerrero
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniterschwebbie
 
Crafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an ArchitectCrafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an ArchitectColdFusionConference
 
CodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comCodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comChristopher Cubos
 
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!Richard Robinson
 

What's hot (20)

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

Similar to Web UI Tests: Introduce UI tests using Selenium

#2 integration + ui tests
#2 integration + ui tests#2 integration + ui tests
#2 integration + ui testseleksdev
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs IntegrationRobot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs IntegrationSauce Labs
 
Selenium -Test automation for web applications
Selenium -Test automation for web applicationsSelenium -Test automation for web applications
Selenium -Test automation for web applicationsAnisGhelissi
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presentedVijayan Reddy
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With SeleniumJodie Miners
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScriptSimon Guest
 
Selenium ui paradigm - DDD North 2
Selenium ui paradigm - DDD North 2Selenium ui paradigm - DDD North 2
Selenium ui paradigm - DDD North 2Nathan Gloyn
 
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh PrajapatiSession on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh PrajapatiAgile Testing Alliance
 
Selenium 4 - What's coming our way - v1.0.pptx
Selenium 4 - What's coming our way - v1.0.pptxSelenium 4 - What's coming our way - v1.0.pptx
Selenium 4 - What's coming our way - v1.0.pptxHitesh Prajapati
 
Web development concepts using microsoft technologies
Web development concepts using microsoft technologiesWeb development concepts using microsoft technologies
Web development concepts using microsoft technologiesHosam Kamel
 
What is Selenium Testing.pdf
What is Selenium Testing.pdfWhat is Selenium Testing.pdf
What is Selenium Testing.pdfAnanthReddy38
 

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

Selenium
SeleniumSelenium
Selenium
 
#2 integration + ui tests
#2 integration + ui tests#2 integration + ui tests
#2 integration + ui tests
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
Selenium
SeleniumSelenium
Selenium
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs IntegrationRobot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
 
Selenium -Test automation for web applications
Selenium -Test automation for web applicationsSelenium -Test automation for web applications
Selenium -Test automation for web applications
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presented
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
Selenium
SeleniumSelenium
Selenium
 
ASP.NET OVERVIEW
ASP.NET OVERVIEWASP.NET OVERVIEW
ASP.NET OVERVIEW
 
Selenium ui paradigm - DDD North 2
Selenium ui paradigm - DDD North 2Selenium ui paradigm - DDD North 2
Selenium ui paradigm - DDD North 2
 
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh PrajapatiSession on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
 
Selenium 4 - What's coming our way - v1.0.pptx
Selenium 4 - What's coming our way - v1.0.pptxSelenium 4 - What's coming our way - v1.0.pptx
Selenium 4 - What's coming our way - v1.0.pptx
 
Web development concepts using microsoft technologies
Web development concepts using microsoft technologiesWeb development concepts using microsoft technologies
Web development concepts using microsoft technologies
 
What is Selenium Testing.pdf
What is Selenium Testing.pdfWhat is Selenium Testing.pdf
What is Selenium Testing.pdf
 

Recently uploaded

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 

Recently uploaded (20)

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 

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