SlideShare una empresa de Scribd logo
1 de 18
Automated Web Testing with Selenium By Jodie Miners Presented to SBTUG 30 September 2009
What is Selenium? It’s Free and Open Source It originally came from Thoughtworks It comes in 3 flavours IDE (Integrated Development Environment) – for recording test cases in Firefox RC (Remote Control) – for running automated tests on any browser Grid – 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 Selenium You are always doing the same steps over and over again You need to get to the last step in a wizard to test that step You want to pre-fill some dummy data Formal Functional and Regression Testing Load Testing *
Selenium IDE A Firefox add-on that allows you to record tests for playing back in any browser. Very simple to use Allows non developers to get up and running with automated testing very quickly Then they can pass on to developers for refinement or inclusion into a continuous build system Can extend it easily with a little bit of HTML knowledge
Recording and Playback First Decide what you are testing and work out your test case(s) IDE Demo Record a test Play back a test Debug a test Step through a test Capture screen shot Asserts
Selenese The language of selenium. It is quite easy to learn 3 parts to it Command – eg Type Locator – eg Input Box Value – eg “ABC” Can easily be written in HTML Things to help build the IDE tests Assert / Wait for Page to Load / Verify Text Present / Verify element present on each page Slow things down with pauses and timeouts Step through firs then run, add pauses and wait’s if it fails because it’s going too fast Add think times
Selenese Locators Can Locate page elements by the following 4 methods ID, DOM, Xpath, CSS IDE 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 comprehensive Install Firebug to help with working out the locators
Selenium RC Takes a little time and effort to get it up and running Can then run your tests scripts from IDE in different browsers With good results reporting Or write the tests in code and automate the testing even further Issues Need to Install and use Java Very command line / batch file based Selenium RC Demo
Demo Run the test in Firefox Run the test in IE Run the test in Chrome Note that they are all in sequence
Coding your tests Coding of Selenium testing can be done in Java, Ruby, Groovy, C#, Perl, PHP, Python Most examples are Java or Ruby, not that many people using C# Add If statements Eg if stock exists then add to cart (rather than having an error message) Add looping statements For each product found, add to cart Easier to add parameterisation or data driven tests eg 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 runs Run the test 4 times, each time logged in as a different user Selenium Code Demo with NUnit
Demo Show the code Paste the selenese in Show NunitvsMSTest? Run the Nunit test Have one prepared ready to go
Reporting There is a great reporting framework if you code in Java or use TestNG Logging Selenium http://loggingselenium.sourceforge.net/ For C# these are the options:  Just capture the Selenium output to a file Code a reporting framework yourself Use the Visual Studio Team System Test Edition framework Use the NUnit reporting I use a combination of VSTT reporting and some additional logging to a database that I created myself.
Selenium Grid Scale out the tests to run on multiple browsers at the same time Saves time in doing the testing But you need to rely on the reporting as you can’t watch 5+ browsers do the testing Great tutorial and demo here http://selenium-grid.seleniumhq.org/ Requires Java SDK and Apache Ant to run
My Grid Setup
Taking the Grid Further Scale out your grid to the Cloud using Amazon EC2 service Or use a third party service Sauce Labs http://www.saucelabs.com In early beta Uses your own code  So can set up the code to either run locally or via web  Current special US$100 for 5000 minutes Lots of Browser / OS combinations Test Environment Picture BrowserMobhttp://www.browsermob.com Time consuming to set up Some limitations on which selenium commands can be used Lots of options (eg can test with specific bandwidth limitations) Can be used as for http requests only, as well as real browser tests Around US$2.00 per browser per hour
More Advanced Topics UI Element mapping – How developers can make it easier for end users to build Selenium tests using element locator names that they can understand http://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 Testing Purists say Selenium is not for load testing That 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 server Use 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 system It does not do virtual load and virtual users
Recording in IE (just for @aussienick) Watin for .net http://watin.sourceforge.net/ Has a built in recorder for IE There 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 Server Looks Fantastic Will also record and play back windows apps Must use TFS

Más contenido relacionado

La actualidad más candente

Selenium Ide Tutorial
Selenium Ide TutorialSelenium Ide Tutorial
Selenium Ide Tutorialmetapix
 
Selenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and WorkingSelenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and WorkingDisha Srivastava
 
Automated Testing Overview
Automated Testing OverviewAutomated Testing Overview
Automated Testing Overviewantsh
 
Basics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote ControlBasics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote Controlusha kannappan
 
Jenkins & Selenium
Jenkins & SeleniumJenkins & Selenium
Jenkins & Seleniumadamcarmi
 
Automated UI testing with Selenium
Automated UI testing with SeleniumAutomated UI testing with Selenium
Automated UI testing with SeleniumYuriy Gerasimov
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rcDang Nguyen
 
CI / CD w/ Codeception
CI / CD w/ CodeceptionCI / CD w/ Codeception
CI / CD w/ CodeceptionTudor Barbu
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupDave Haeffner
 
Practical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test AutomationPractical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test AutomationSauce Labs
 
Selenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applicationsSelenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applicationsTSundberg
 

La actualidad más candente (20)

Selenium Primer
Selenium PrimerSelenium Primer
Selenium Primer
 
Java notes
Java notesJava notes
Java notes
 
Selenium Ide Tutorial
Selenium Ide TutorialSelenium Ide Tutorial
Selenium Ide Tutorial
 
Selenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and WorkingSelenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and Working
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Automated Testing Overview
Automated Testing OverviewAutomated Testing Overview
Automated Testing Overview
 
Selenium
SeleniumSelenium
Selenium
 
Basics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote ControlBasics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote Control
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Primer
Selenium PrimerSelenium Primer
Selenium Primer
 
Selenium
SeleniumSelenium
Selenium
 
Jenkins & Selenium
Jenkins & SeleniumJenkins & Selenium
Jenkins & Selenium
 
Automated UI testing with Selenium
Automated UI testing with SeleniumAutomated UI testing with Selenium
Automated UI testing with Selenium
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
 
QSpiders - Automation using Selenium
QSpiders - Automation using SeleniumQSpiders - Automation using Selenium
QSpiders - Automation using Selenium
 
CI / CD w/ Codeception
CI / CD w/ CodeceptionCI / CD w/ Codeception
CI / CD w/ Codeception
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
 
Practical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test AutomationPractical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test Automation
 
Selenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applicationsSelenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applications
 

Similar a Automated Web Testing With Selenium

Karate _Framework.ppt
Karate _Framework.pptKarate _Framework.ppt
Karate _Framework.pptSamKhan531862
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesVijay Rangaiah
 
Test_Automation using Selenium.ppt
Test_Automation using Selenium.pptTest_Automation using Selenium.ppt
Test_Automation using Selenium.pptSamKhan531862
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Seleniumvivek_prahlad
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Puneet Kala
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin MishraPravin Mishra
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: SeleniumSQABD
 
Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVAmahirayavarapu
 
white and grey modern website application education project group school pres...
white and grey modern website application education project group school pres...white and grey modern website application education project group school pres...
white and grey modern website application education project group school pres...DreamTheory
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshopcoreyjack
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorialprad_123
 

Similar a Automated Web Testing With Selenium (20)

Selenium (1)
Selenium (1)Selenium (1)
Selenium (1)
 
Karate _Framework.ppt
Karate _Framework.pptKarate _Framework.ppt
Karate _Framework.ppt
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
 
Selenium
SeleniumSelenium
Selenium
 
Sel
SelSel
Sel
 
Test_Automation using Selenium.ppt
Test_Automation using Selenium.pptTest_Automation using Selenium.ppt
Test_Automation using Selenium.ppt
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Selenium
SeleniumSelenium
Selenium
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin Mishra
 
Selenium
SeleniumSelenium
Selenium
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: Selenium
 
Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVA
 
selenium
selenium selenium
selenium
 
white and grey modern website application education project group school pres...
white and grey modern website application education project group school pres...white and grey modern website application education project group school pres...
white and grey modern website application education project group school pres...
 
Selenium
SeleniumSelenium
Selenium
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshop
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorial
 

Último

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Automated Web Testing With Selenium

  • 1. Automated Web Testing with Selenium By Jodie Miners Presented to SBTUG 30 September 2009
  • 2. What is Selenium? It’s Free and Open Source It originally came from Thoughtworks It comes in 3 flavours IDE (Integrated Development Environment) – for recording test cases in Firefox RC (Remote Control) – for running automated tests on any browser Grid – 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 Selenium You are always doing the same steps over and over again You need to get to the last step in a wizard to test that step You want to pre-fill some dummy data Formal Functional and Regression Testing Load Testing *
  • 4. Selenium IDE A Firefox add-on that allows you to record tests for playing back in any browser. Very simple to use Allows non developers to get up and running with automated testing very quickly Then they can pass on to developers for refinement or inclusion into a continuous build system Can extend it easily with a little bit of HTML knowledge
  • 5. Recording and Playback First Decide what you are testing and work out your test case(s) IDE Demo Record a test Play back a test Debug a test Step through a test Capture screen shot Asserts
  • 6. Selenese The language of selenium. It is quite easy to learn 3 parts to it Command – eg Type Locator – eg Input Box Value – eg “ABC” Can easily be written in HTML Things to help build the IDE tests Assert / Wait for Page to Load / Verify Text Present / Verify element present on each page Slow things down with pauses and timeouts Step through firs then run, add pauses and wait’s if it fails because it’s going too fast Add think times
  • 7. Selenese Locators Can Locate page elements by the following 4 methods ID, DOM, Xpath, CSS IDE 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 comprehensive Install Firebug to help with working out the locators
  • 8. Selenium RC Takes a little time and effort to get it up and running Can then run your tests scripts from IDE in different browsers With good results reporting Or write the tests in code and automate the testing even further Issues Need to Install and use Java Very command line / batch file based Selenium RC Demo
  • 9. Demo Run the test in Firefox Run the test in IE Run the test in Chrome Note that they are all in sequence
  • 10. Coding your tests Coding of Selenium testing can be done in Java, Ruby, Groovy, C#, Perl, PHP, Python Most examples are Java or Ruby, not that many people using C# Add If statements Eg if stock exists then add to cart (rather than having an error message) Add looping statements For each product found, add to cart Easier to add parameterisation or data driven tests eg 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 runs Run the test 4 times, each time logged in as a different user Selenium Code Demo with NUnit
  • 11. Demo Show the code Paste the selenese in Show NunitvsMSTest? Run the Nunit test Have one prepared ready to go
  • 12. Reporting There is a great reporting framework if you code in Java or use TestNG Logging Selenium http://loggingselenium.sourceforge.net/ For C# these are the options: Just capture the Selenium output to a file Code a reporting framework yourself Use the Visual Studio Team System Test Edition framework Use the NUnit reporting I use a combination of VSTT reporting and some additional logging to a database that I created myself.
  • 13. Selenium Grid Scale out the tests to run on multiple browsers at the same time Saves time in doing the testing But you need to rely on the reporting as you can’t watch 5+ browsers do the testing Great tutorial and demo here http://selenium-grid.seleniumhq.org/ Requires Java SDK and Apache Ant to run
  • 15. Taking the Grid Further Scale out your grid to the Cloud using Amazon EC2 service Or use a third party service Sauce Labs http://www.saucelabs.com In early beta Uses your own code So can set up the code to either run locally or via web Current special US$100 for 5000 minutes Lots of Browser / OS combinations Test Environment Picture BrowserMobhttp://www.browsermob.com Time consuming to set up Some limitations on which selenium commands can be used Lots of options (eg can test with specific bandwidth limitations) Can be used as for http requests only, as well as real browser tests Around US$2.00 per browser per hour
  • 16. More Advanced Topics UI Element mapping – How developers can make it easier for end users to build Selenium tests using element locator names that they can understand http://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 Testing Purists say Selenium is not for load testing That 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 server Use 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 system It does not do virtual load and virtual users
  • 18. Recording in IE (just for @aussienick) Watin for .net http://watin.sourceforge.net/ Has a built in recorder for IE There 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 Server Looks Fantastic Will also record and play back windows apps Must use TFS
  • 19. References Selenium Tutorial http://dynamitemap.com/selenium/including a good video Full list of software testing tools http://www.softwareqatest.com/qatweb1.html VSTT Quick Reference http://vstt2008qrg.codeplex.com/
  • 20. X-Path References There is a great deal of help online for Xpath, here are some of the best sites I’ve found Xpath reference http://www.w3schools.com/Xpath/default.asp Some nice simple examples (on the Xpath tab) http://confluence.sakaiproject.org/display/QA/Selenium Quick Reference Card http://confluence.sakaiproject.org/display/QA/Selenium MSDN http://msdn.microsoft.com/en-us/library/ms256115.aspx Great tutorial with lots of examples http://www.zvon.org/xxl/XPathTutorial/General/examples.html Selenium Wiki Xpath reference http://wiki.openqa.org/display/SEL/Help+With+XPath