SlideShare a Scribd company logo
Automated Web Testing with SeleniumBy Jodie MinersPresented to SBTUG30 September 2009
What is Selenium?It’s Free and Open SourceIt originally came from ThoughtworksIt comes in 3 flavoursIDE (Integrated Development Environment) – for recording test cases in FirefoxRC (Remote Control) – for running automated tests on any browserGrid – for large scale test runs of multiple tests in parallel You can get it here http://www.seleniumhq.org/“Selenium tests run directly in a browser, just as real users do”
Why use SeleniumYou are always doing the same steps over and over againYou need to get to the last step in a wizard to test that stepYou want to pre-fill some dummy dataFormal Functional and Regression TestingLoad Testing *
Selenium IDEA Firefox add-on that allows you to record tests for playing back in any browser.Very simple to useAllows non developers to get up and running with automated testing very quicklyThen they can pass on to developers for refinement or inclusion into a continuous build systemCan extend it easily with a little bit of HTML knowledge
Recording and PlaybackFirst Decide what you are testing and work out your test case(s)IDE DemoRecord a testPlay back a testDebug a testStep through a testCapture screen shotAsserts
SeleneseThe language of selenium. It is quite easy to learn3 parts to itCommand – eg TypeLocator – eg Input BoxValue – eg “ABC”Can easily be written in HTMLThings to help build the IDE testsAssert / Wait for Page to Load / Verify Text Present / Verify element present on each pageSlow things down with pauses and timeoutsStep through firs then run, add pauses and wait’s if it fails because it’s going too fastAdd think times
Selenese LocatorsCan Locate page elements by the following 4 methodsID, DOM, Xpath, CSSIDE recorderwill choose the best one to use, or you can choose which ever method if you are coding the tests. Can also use Wildcards and Regular Expressions See http://seleniumhq.org/docs/04_selenese_commands.html for more info - it’s very comprehensiveInstall Firebug to help with working out the locators
Selenium RCTakes a little time and effort to get it up and runningCan then run your tests scripts from IDE in different browsersWith good results reportingOr write the tests in code and automate the testing even furtherIssuesNeed to Install and use JavaVery command line / batch file basedSelenium RC Demo
DemoRun the test in FirefoxRun the test in IERun the test in ChromeNote that they are all in sequence
Coding your testsCoding of Selenium testing can be done inJava, Ruby, Groovy, C#, Perl, PHP, PythonMost examples are Java or Ruby, not that many people using C#Add If statementsEg if stock exists then add to cart (rather than having an error message)Add looping statementsFor each product found, add to cartEasier to add parameterisation or data driven testseg have a list of products in a file or table – add each of the products to the cart(you can do data driven tests in IDE – see here http://wiki.openqa.org/display/SEL/datadriven )Multiple test runsRun the test 4 times, each time logged in as a different userSelenium Code Demo with NUnit
DemoShow the codePaste the selenese inShow NunitvsMSTest?Run the Nunit testHave one prepared ready to go
ReportingThere is a great reporting framework if you code in Java or use TestNGLogging Selenium http://loggingselenium.sourceforge.net/For C# these are the options: Just capture the Selenium output to a fileCode a reporting framework yourselfUse the Visual Studio Team System Test Edition frameworkUse the NUnit reportingI use a combination of VSTT reporting and some additional logging to a database that I created myself.
Selenium GridScale out the tests to run on multiple browsers at the same timeSaves time in doing the testingBut you need to rely on the reporting as you can’t watch 5+ browsers do the testingGreat tutorial and demo here http://selenium-grid.seleniumhq.org/Requires Java SDK and Apache Ant to run
My Grid Setup
Taking the Grid FurtherScale out your grid to the Cloud using Amazon EC2 serviceOr use a third party serviceSauce Labs http://www.saucelabs.comIn early betaUses your own code So can set up the code to either run locally or via web Current special US$100 for 5000 minutesLots of Browser / OS combinationsTest Environment PictureBrowserMobhttp://www.browsermob.comTime consuming to set upSome limitations on which selenium commands can be usedLots of options (eg can test with specific bandwidth limitations)Can be used as for http requests only, as well as real browser testsAround US$2.00 per browser per hour
More Advanced TopicsUI Element mapping – How developers can make it easier for end users to build Selenium tests using element locator names that they can understandhttp://ttwhy.org/home/blog/2007/05/12/selenium-ui-element-locator/Using Xpath references with the Ext-JS javascript framework http://www.xeolabs.com/portal/node/34
Load TestingPurists say Selenium is not for load testingThat is mainly because of the hardware required to run multiple browsers on the same machine.I hit limits of 5-8 browsers on a standard desktop machine and 12-15 browsers on a serverUse Browser Mob or SauceLabs to overcome these issues.Also as Selenium uses Real Browsers it requires real logins to simulate real loads – so you have to log in as real users on your systemIt does not do virtual load and virtual users
Recording in IE (just for @aussienick)Watin for .nethttp://watin.sourceforge.net/Has a built in recorder for IEThere are also Watir (ruby), and Watij (java) variants http://wtr.rubyforge.org/Visual Studio Team System 2008 Test Edition (VSTT)Visual Studio Team System 2010 Test Edition + Team Foundation ServerLooks FantasticWill also record and play back windows appsMust use TFS

More Related Content

PPTX
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 
PPT
Selenium2 and Jenkins: Almost pain-free UI Testing
mikereedell
 
ODP
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Yuriy Gerasimov
 
KEY
Testing with Jenkins, Selenium and Continuous Deployment
Max Klymyshyn
 
ODP
Mastering selenium for automated acceptance tests
Nick Belhomme
 
PPTX
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
hugs
 
PPT
Selenium
conect2krish
 
PPT
Selenium Introduction
Mayur Khairnar
 
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 
Selenium2 and Jenkins: Almost pain-free UI Testing
mikereedell
 
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Yuriy Gerasimov
 
Testing with Jenkins, Selenium and Continuous Deployment
Max Klymyshyn
 
Mastering selenium for automated acceptance tests
Nick Belhomme
 
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
hugs
 
Selenium
conect2krish
 
Selenium Introduction
Mayur Khairnar
 

What's hot (20)

PPT
Selenium Primer
Debashish Chakrabarty
 
PDF
Selenium Ide Tutorial
metapix
 
PDF
Selenium IDE Introduction, Installation and Working
Disha Srivastava
 
PPT
Selenium
Daksh Sharma
 
PPTX
Selenium
Satyam Pandey
 
PPTX
Automated Testing Overview
antsh
 
PPT
Selenium
Anil Babu
 
PDF
Basics of Selenium IDE,Core, Remote Control
usha kannappan
 
PPT
Selenium
Adam Goucher
 
PPT
Selenium Primer
gueste1e4db
 
PPT
Selenium
Ruturaj Doshi
 
PDF
Jenkins & Selenium
adamcarmi
 
ODP
Automated UI testing with Selenium
Yuriy Gerasimov
 
PDF
First steps with selenium rc
Dang Nguyen
 
PPT
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
PPTX
CI / CD w/ Codeception
Tudor Barbu
 
PDF
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Dave Haeffner
 
PDF
Practical Tips & Tricks for Selenium Test Automation
Sauce Labs
 
PPTX
Selenium WebDriver - Test automation for web applications
TSundberg
 
Selenium Primer
Debashish Chakrabarty
 
Selenium Ide Tutorial
metapix
 
Selenium IDE Introduction, Installation and Working
Disha Srivastava
 
Selenium
Daksh Sharma
 
Selenium
Satyam Pandey
 
Automated Testing Overview
antsh
 
Selenium
Anil Babu
 
Basics of Selenium IDE,Core, Remote Control
usha kannappan
 
Selenium
Adam Goucher
 
Selenium Primer
gueste1e4db
 
Selenium
Ruturaj Doshi
 
Jenkins & Selenium
adamcarmi
 
Automated UI testing with Selenium
Yuriy Gerasimov
 
First steps with selenium rc
Dang Nguyen
 
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
CI / CD w/ Codeception
Tudor Barbu
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Dave Haeffner
 
Practical Tips & Tricks for Selenium Test Automation
Sauce Labs
 
Selenium WebDriver - Test automation for web applications
TSundberg
 
Ad

Similar to Automated Web Testing With Selenium (20)

PPT
Selenium (1)
onlinemindq
 
PPT
Karate _Framework.ppt
SamKhan531862
 
PPT
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
PPT
Selenium
BugRaptors
 
DOC
Sel
Sandeep A R
 
PPT
Automation using Selenium Your score increases as you pick a category, fill o...
SENTHILR44
 
PPT
Test_Automation using Selenium.ppt
SamKhan531862
 
PPT
Web Test Automation with Selenium
vivek_prahlad
 
PPT
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Puneet Kala
 
PDF
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
PPT
Selenium By Pravin Mishra
Pravin Mishra
 
PPT
Tanvir Afzal: Selenium
SQABD
 
PPT
Selenium
tanvir afzal
 
PDF
Selenium by using JAVA
mahirayavarapu
 
PDF
selenium
ayeshsiddika
 
PDF
white and grey modern website application education project group school pres...
DreamTheory
 
PPT
Selenium
shrialinda
 
PPT
JavaScript Unit Testing
Christian Johansen
 
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Ondřej Machulda
 
Selenium (1)
onlinemindq
 
Karate _Framework.ppt
SamKhan531862
 
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
Selenium
BugRaptors
 
Automation using Selenium Your score increases as you pick a category, fill o...
SENTHILR44
 
Test_Automation using Selenium.ppt
SamKhan531862
 
Web Test Automation with Selenium
vivek_prahlad
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Puneet Kala
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
Selenium By Pravin Mishra
Pravin Mishra
 
Tanvir Afzal: Selenium
SQABD
 
Selenium
tanvir afzal
 
Selenium by using JAVA
mahirayavarapu
 
selenium
ayeshsiddika
 
white and grey modern website application education project group school pres...
DreamTheory
 
Selenium
shrialinda
 
JavaScript Unit Testing
Christian Johansen
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Ondřej Machulda
 
Ad

Recently uploaded (20)

PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Best ERP System for Manufacturing in India | Elite Mindz
Elite Mindz
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PPT
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Best ERP System for Manufacturing in India | Elite Mindz
Elite Mindz
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
Software Development Methodologies in 2025
KodekX
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 

Automated Web Testing With Selenium

  • 1. Automated Web Testing with SeleniumBy Jodie MinersPresented to SBTUG30 September 2009
  • 2. What is Selenium?It’s Free and Open SourceIt originally came from ThoughtworksIt comes in 3 flavoursIDE (Integrated Development Environment) – for recording test cases in FirefoxRC (Remote Control) – for running automated tests on any browserGrid – for large scale test runs of multiple tests in parallel You can get it here http://www.seleniumhq.org/“Selenium tests run directly in a browser, just as real users do”
  • 3. Why use SeleniumYou are always doing the same steps over and over againYou need to get to the last step in a wizard to test that stepYou want to pre-fill some dummy dataFormal Functional and Regression TestingLoad Testing *
  • 4. Selenium IDEA Firefox add-on that allows you to record tests for playing back in any browser.Very simple to useAllows non developers to get up and running with automated testing very quicklyThen they can pass on to developers for refinement or inclusion into a continuous build systemCan extend it easily with a little bit of HTML knowledge
  • 5. Recording and PlaybackFirst Decide what you are testing and work out your test case(s)IDE DemoRecord a testPlay back a testDebug a testStep through a testCapture screen shotAsserts
  • 6. SeleneseThe language of selenium. It is quite easy to learn3 parts to itCommand – eg TypeLocator – eg Input BoxValue – eg “ABC”Can easily be written in HTMLThings to help build the IDE testsAssert / Wait for Page to Load / Verify Text Present / Verify element present on each pageSlow things down with pauses and timeoutsStep through firs then run, add pauses and wait’s if it fails because it’s going too fastAdd think times
  • 7. Selenese LocatorsCan Locate page elements by the following 4 methodsID, DOM, Xpath, CSSIDE recorderwill choose the best one to use, or you can choose which ever method if you are coding the tests. Can also use Wildcards and Regular Expressions See http://seleniumhq.org/docs/04_selenese_commands.html for more info - it’s very comprehensiveInstall Firebug to help with working out the locators
  • 8. Selenium RCTakes a little time and effort to get it up and runningCan then run your tests scripts from IDE in different browsersWith good results reportingOr write the tests in code and automate the testing even furtherIssuesNeed to Install and use JavaVery command line / batch file basedSelenium RC Demo
  • 9. DemoRun the test in FirefoxRun the test in IERun the test in ChromeNote that they are all in sequence
  • 10. Coding your testsCoding of Selenium testing can be done inJava, Ruby, Groovy, C#, Perl, PHP, PythonMost examples are Java or Ruby, not that many people using C#Add If statementsEg if stock exists then add to cart (rather than having an error message)Add looping statementsFor each product found, add to cartEasier to add parameterisation or data driven testseg have a list of products in a file or table – add each of the products to the cart(you can do data driven tests in IDE – see here http://wiki.openqa.org/display/SEL/datadriven )Multiple test runsRun the test 4 times, each time logged in as a different userSelenium Code Demo with NUnit
  • 11. DemoShow the codePaste the selenese inShow NunitvsMSTest?Run the Nunit testHave one prepared ready to go
  • 12. ReportingThere is a great reporting framework if you code in Java or use TestNGLogging Selenium http://loggingselenium.sourceforge.net/For C# these are the options: Just capture the Selenium output to a fileCode a reporting framework yourselfUse the Visual Studio Team System Test Edition frameworkUse the NUnit reportingI use a combination of VSTT reporting and some additional logging to a database that I created myself.
  • 13. Selenium GridScale out the tests to run on multiple browsers at the same timeSaves time in doing the testingBut you need to rely on the reporting as you can’t watch 5+ browsers do the testingGreat tutorial and demo here http://selenium-grid.seleniumhq.org/Requires Java SDK and Apache Ant to run
  • 15. Taking the Grid FurtherScale out your grid to the Cloud using Amazon EC2 serviceOr use a third party serviceSauce Labs http://www.saucelabs.comIn early betaUses your own code So can set up the code to either run locally or via web Current special US$100 for 5000 minutesLots of Browser / OS combinationsTest Environment PictureBrowserMobhttp://www.browsermob.comTime consuming to set upSome limitations on which selenium commands can be usedLots of options (eg can test with specific bandwidth limitations)Can be used as for http requests only, as well as real browser testsAround US$2.00 per browser per hour
  • 16. More Advanced TopicsUI Element mapping – How developers can make it easier for end users to build Selenium tests using element locator names that they can understandhttp://ttwhy.org/home/blog/2007/05/12/selenium-ui-element-locator/Using Xpath references with the Ext-JS javascript framework http://www.xeolabs.com/portal/node/34
  • 17. Load TestingPurists say Selenium is not for load testingThat is mainly because of the hardware required to run multiple browsers on the same machine.I hit limits of 5-8 browsers on a standard desktop machine and 12-15 browsers on a serverUse Browser Mob or SauceLabs to overcome these issues.Also as Selenium uses Real Browsers it requires real logins to simulate real loads – so you have to log in as real users on your systemIt does not do virtual load and virtual users
  • 18. Recording in IE (just for @aussienick)Watin for .nethttp://watin.sourceforge.net/Has a built in recorder for IEThere are also Watir (ruby), and Watij (java) variants http://wtr.rubyforge.org/Visual Studio Team System 2008 Test Edition (VSTT)Visual Studio Team System 2010 Test Edition + Team Foundation ServerLooks FantasticWill also record and play back windows appsMust use TFS
  • 19. ReferencesSelenium Tutorial http://dynamitemap.com/selenium/including a good videoFull list of software testing tools http://www.softwareqatest.com/qatweb1.htmlVSTT Quick Reference http://vstt2008qrg.codeplex.com/
  • 20. X-Path ReferencesThere is a great deal of help online for Xpath, here are some of the best sites I’ve foundXpath reference http://www.w3schools.com/Xpath/default.aspSome nice simple examples (on the Xpath tab) http://confluence.sakaiproject.org/display/QA/SeleniumQuick Reference Card http://confluence.sakaiproject.org/display/QA/SeleniumMSDN http://msdn.microsoft.com/en-us/library/ms256115.aspxGreat tutorial with lots of examples http://www.zvon.org/xxl/XPathTutorial/General/examples.htmlSelenium Wiki Xpath reference http://wiki.openqa.org/display/SEL/Help+With+XPath