SlideShare a Scribd company logo
Selenium and Selenium on Rails
Agenda Overview of Selenium Simple Selenium Tests Selenium IDE Overview of Selenium on Rails Problems with Selenium
Selenium Overview Selenium is composed of four things: Selenium Core Selenium IDE Selenium RC Selenium on Rails
Overview of Selenium Open source browser based integration test framework built originally by Thoughtworks 100% Javascript and HTML Designed to make test writing easy Ability to run whole suites of tests or individual tests Ability to step through individual tests Cross browser – IE 6/7, Firefox .8+, Opera, Safari 2.0+ Lets see an example of a selenium test suite…
Overview of Selenium Downloads and Documentation can be found at:  www.openqa.org Getting started: Download Selenium core off of  www.openqa.org Place the contents of the zip file on a web server in a selenium-core directory Go to http://web-server-host/selenium-core/index.html
Simple Selenium Tests Selenium understands two types of files Tests Test Suites Every test must be contained within a test suite Both tests and test suites are defined by using simple tables in HTML To execute a test suite you must point TestRunner.html at it
Format of Selenium Test Suite More complex than Selenium Tests  Easiest just to copy TestSuite.html from the samples Mostly a table that points to the tests
Format of a Selenium Test HTML Table with 3 columns  First Column: Selenium command Second Column: Required first parameter Third Column: Optional second parameter Selenium commands are broken into 3 types: Actions – Command the browser to do something Accessors – Store/retrieve data from selenium variables Asserts – Verify that the browser is in a certain state
Format of a Selenium Test Two types of Selenium Parameters Locators – Used to find elements in html trees Pattern Matchers – Used to verify values Lots of locator types.  Some examples are: Id based, xpath based, css selector based Pattern matchers are typically exact matches or regular expressions Lots more info at: http://www.openqa.org/selenium-core/reference.html So lets try to write a simple Selenium test…
Gotchas in HTML Selenium Test Writing Selenium is sensitive to the format of the table All selenium command rows must have three columns or they will not be recognized as commands You can only test URL’s that are in the same domain as the selenium core Separation of concerns is hard – Tests become very dependent on the internal structure of the HTML
Wow, that was hard! Lesson learned: Never ever write this by hand There are a lot of commands - you can even add your own custom commands into the user-extensions.js Firebug is very useful for developing your accessors
Selenium IDE Firefox extension that allows recording and editing of tests Can be download off of www.openqa.org Allows easier development of tests Can even output Ruby for it’s Ruby based API Lets see it in action…
Selenium IDE Much easier to use  Only really works with synchronous requests Only automates commands, assert still must be entered by hand Still requires lots of work to get Selenium to run it as part of a Test Suite
Selenium on Rails Plugin for Rails that allows tests to be expressed in Ruby Selenium core files no longer go in public – they are part of the Plugin Supports two kinds of files SEL files and RSEL files  SEL files are pipe separated files that look much like Selenium HTML RSEL files talk to a Ruby API that closely mirrors the normal commands – more info at: http://www.openqa.org/classes/SeleniumOnRails/TestBuilder.html
Selenium on Rails Each test becomes a single RSEL file which contains Ruby calls closely resembling the Selenium Commands RSEL files work much like views in Ruby and can be broken down into partials Selenium on Rails takes over the /selenium/ URL space RSEL files are used to automatically generate Selenium HTML table based tests  Selenium on Rails then generates it’s own Test Suite containing all of the tests
Selenium on Rails RSEL files can reference fixtures and clear session state on startup RSEL files support partials Test development is much more Rails like -> Edit RSEL file, hit Reload in browser, run updated test Lets see it in action…
That was still pretty hard… Selenium on Rails does not initially make WRITING tests any easier Selenium on Rails makes deploying and the development cycle of tests easier Selenium on Rails makes writing tests more natural for RoR developers – it also gives your tests access to the rest of the code you have developed for your application Selenium on Rails should really be seen as a starting point for developing a DSL to test YOUR application
Problems with Selenium  The Xpath locators are basically worthless because of the poor performance in IE It is not designed to do AJAX type testing  waitForElement and waitForCondition are the tools that Selenium provides to deal with AJAX both of which add a lot of complexity to tests Custom Selenium commands added to user-extensions.js are difficult to write – Avoid doing so unless you must Timeouts are unreliable – sometimes tests hang Not all Javascript events are supported
?

More Related Content

What's hot (20)

PPT
Selenium (1)
onlinemindq
 
PPT
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
PPTX
Learn Test Automation using Selenium - Lesson 1
Furqan Ud Din
 
PPS
Selenium Demo
ankitslide
 
PPTX
An Overview of Selenium
adamcarmi
 
PDF
Automated Web Testing With Selenium
Deepak Mittal
 
PDF
Selenium Framework using Java | Selenium Tutorial | Selenium Training Online ...
Edureka!
 
PPTX
Automated Testing for Websites With Selenium IDE
Robert Greiner
 
PPT
Selenium By Pravin Mishra
Pravin Mishra
 
PPTX
Selenium
Andrew Krug
 
DOCX
Best Selenium Online Training
Samatha Kamuni
 
PPTX
Selenium ide made easy
Narayanan Palani
 
PPTX
Selenium IDE and Extensions
Yana Altunyan
 
PDF
First steps with selenium rc
Dang Nguyen
 
PPT
Selenium Ide Tutorials
gueste1e4db
 
PPTX
Automation Testing by Selenium Web Driver
Cuelogic Technologies Pvt. Ltd.
 
PPTX
Introduction to Selenium Web Driver
Return on Intelligence
 
PDF
Selenium IDE features
onewomanmore witl
 
PPTX
Selenium online training
mindmajixtrainings
 
PPTX
Python selenium
Ducat
 
Selenium (1)
onlinemindq
 
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
Learn Test Automation using Selenium - Lesson 1
Furqan Ud Din
 
Selenium Demo
ankitslide
 
An Overview of Selenium
adamcarmi
 
Automated Web Testing With Selenium
Deepak Mittal
 
Selenium Framework using Java | Selenium Tutorial | Selenium Training Online ...
Edureka!
 
Automated Testing for Websites With Selenium IDE
Robert Greiner
 
Selenium By Pravin Mishra
Pravin Mishra
 
Selenium
Andrew Krug
 
Best Selenium Online Training
Samatha Kamuni
 
Selenium ide made easy
Narayanan Palani
 
Selenium IDE and Extensions
Yana Altunyan
 
First steps with selenium rc
Dang Nguyen
 
Selenium Ide Tutorials
gueste1e4db
 
Automation Testing by Selenium Web Driver
Cuelogic Technologies Pvt. Ltd.
 
Introduction to Selenium Web Driver
Return on Intelligence
 
Selenium IDE features
onewomanmore witl
 
Selenium online training
mindmajixtrainings
 
Python selenium
Ducat
 

Viewers also liked (6)

PPTX
Advanced Appium
Dan Cuellar
 
PDF
Browser-level testing
Martin Kleppmann
 
PPTX
Advanced Appium: SeleniumConf UK 2016
Dan Cuellar
 
PPT
Test Driven
Alex Chaffee
 
PDF
Why you should be excited about ClojureScript
elliando dias
 
PDF
Clojurescript slides
elliando dias
 
Advanced Appium
Dan Cuellar
 
Browser-level testing
Martin Kleppmann
 
Advanced Appium: SeleniumConf UK 2016
Dan Cuellar
 
Test Driven
Alex Chaffee
 
Why you should be excited about ClojureScript
elliando dias
 
Clojurescript slides
elliando dias
 
Ad

Similar to Selenium and Selenium on Rails (20)

PPT
Selenium
Daksh Sharma
 
PPT
Selenium Primer
gueste1e4db
 
PPT
Selenium
Kalyan ch
 
PPT
Selenium Basics by Quontra Solutions
QUONTRASOLUTIONS
 
PPT
Web Test Automation with Selenium
vivek_prahlad
 
PPTX
Introduction to selenium
Archana Krushnan
 
PPT
BCS Selenium Workshop
Colin McDonald
 
PPT
Karate _Framework.ppt
SamKhan531862
 
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
PPT
Selenium
tanvir afzal
 
PPT
Tanvir Afzal: Selenium
SQABD
 
PPT
Selenium Primer
Debashish Chakrabarty
 
PPT
Test_Automation using Selenium.ppt
SamKhan531862
 
PPT
Automation using Selenium Your score increases as you pick a category, fill o...
SENTHILR44
 
PPTX
Automated Web Testing With Selenium
Jodie Miners
 
PPT
Selenium
conect2krish
 
PPT
Selenium Introduction
Mayur Khairnar
 
PDF
Testing world selenium_start_chapter1 (1)
Testing World
 
PDF
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
PDF
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
camp_drupal_ua
 
Selenium
Daksh Sharma
 
Selenium Primer
gueste1e4db
 
Selenium
Kalyan ch
 
Selenium Basics by Quontra Solutions
QUONTRASOLUTIONS
 
Web Test Automation with Selenium
vivek_prahlad
 
Introduction to selenium
Archana Krushnan
 
BCS Selenium Workshop
Colin McDonald
 
Karate _Framework.ppt
SamKhan531862
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
Selenium
tanvir afzal
 
Tanvir Afzal: Selenium
SQABD
 
Selenium Primer
Debashish Chakrabarty
 
Test_Automation using Selenium.ppt
SamKhan531862
 
Automation using Selenium Your score increases as you pick a category, fill o...
SENTHILR44
 
Automated Web Testing With Selenium
Jodie Miners
 
Selenium
conect2krish
 
Selenium Introduction
Mayur Khairnar
 
Testing world selenium_start_chapter1 (1)
Testing World
 
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
camp_drupal_ua
 
Ad

More from elliando dias (20)

PDF
Functional Programming with Immutable Data Structures
elliando dias
 
PPT
Nomenclatura e peças de container
elliando dias
 
PDF
Geometria Projetiva
elliando dias
 
PDF
Polyglot and Poly-paradigm Programming for Better Agility
elliando dias
 
PDF
Javascript Libraries
elliando dias
 
PDF
How to Make an Eight Bit Computer and Save the World!
elliando dias
 
PDF
Ragel talk
elliando dias
 
PDF
A Practical Guide to Connecting Hardware to the Web
elliando dias
 
PDF
Introdução ao Arduino
elliando dias
 
PDF
Minicurso arduino
elliando dias
 
PDF
Incanter Data Sorcery
elliando dias
 
PDF
Rango
elliando dias
 
PDF
Fab.in.a.box - Fab Academy: Machine Design
elliando dias
 
PDF
The Digital Revolution: Machines that makes
elliando dias
 
PDF
Hadoop + Clojure
elliando dias
 
PDF
Hadoop - Simple. Scalable.
elliando dias
 
PDF
Hadoop and Hive Development at Facebook
elliando dias
 
PDF
Multi-core Parallelization in Clojure - a Case Study
elliando dias
 
PDF
From Lisp to Clojure/Incanter and RAn Introduction
elliando dias
 
PDF
FleetDB A Schema-Free Database in Clojure
elliando dias
 
Functional Programming with Immutable Data Structures
elliando dias
 
Nomenclatura e peças de container
elliando dias
 
Geometria Projetiva
elliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
elliando dias
 
Javascript Libraries
elliando dias
 
How to Make an Eight Bit Computer and Save the World!
elliando dias
 
Ragel talk
elliando dias
 
A Practical Guide to Connecting Hardware to the Web
elliando dias
 
Introdução ao Arduino
elliando dias
 
Minicurso arduino
elliando dias
 
Incanter Data Sorcery
elliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
elliando dias
 
The Digital Revolution: Machines that makes
elliando dias
 
Hadoop + Clojure
elliando dias
 
Hadoop - Simple. Scalable.
elliando dias
 
Hadoop and Hive Development at Facebook
elliando dias
 
Multi-core Parallelization in Clojure - a Case Study
elliando dias
 
From Lisp to Clojure/Incanter and RAn Introduction
elliando dias
 
FleetDB A Schema-Free Database in Clojure
elliando dias
 

Recently uploaded (20)

PDF
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
GITLAB-CICD_For_Professionals_KodeKloud.pdf
deepaktyagi0048
 
PDF
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
PDF
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
DOCX
TLE9 COOKERY DLL WEEK3 technology and li
jamierha cabaero
 
PPTX
Earn Agentblazer Status with Slack Community Patna.pptx
SanjeetMishra29
 
PDF
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PPTX
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
PDF
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
PPTX
UI5Con 2025 - Beyond UI5 Controls with the Rise of Web Components
Wouter Lemaire
 
PPTX
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
PDF
How Current Advanced Cyber Threats Transform Business Operation
Eryk Budi Pratama
 
PDF
Upgrading to z_OS V2R4 Part 01 of 02.pdf
Flavio787771
 
PPTX
TYPES OF COMMUNICATION Presentation of ICT
JulieBinwag
 
PDF
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
Fwdays
 
PDF
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
PPTX
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
GITLAB-CICD_For_Professionals_KodeKloud.pdf
deepaktyagi0048
 
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
TLE9 COOKERY DLL WEEK3 technology and li
jamierha cabaero
 
Earn Agentblazer Status with Slack Community Patna.pptx
SanjeetMishra29
 
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
UI5Con 2025 - Beyond UI5 Controls with the Rise of Web Components
Wouter Lemaire
 
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
How Current Advanced Cyber Threats Transform Business Operation
Eryk Budi Pratama
 
Upgrading to z_OS V2R4 Part 01 of 02.pdf
Flavio787771
 
TYPES OF COMMUNICATION Presentation of ICT
JulieBinwag
 
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
Fwdays
 
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 

Selenium and Selenium on Rails

  • 2. Agenda Overview of Selenium Simple Selenium Tests Selenium IDE Overview of Selenium on Rails Problems with Selenium
  • 3. Selenium Overview Selenium is composed of four things: Selenium Core Selenium IDE Selenium RC Selenium on Rails
  • 4. Overview of Selenium Open source browser based integration test framework built originally by Thoughtworks 100% Javascript and HTML Designed to make test writing easy Ability to run whole suites of tests or individual tests Ability to step through individual tests Cross browser – IE 6/7, Firefox .8+, Opera, Safari 2.0+ Lets see an example of a selenium test suite…
  • 5. Overview of Selenium Downloads and Documentation can be found at: www.openqa.org Getting started: Download Selenium core off of www.openqa.org Place the contents of the zip file on a web server in a selenium-core directory Go to http://web-server-host/selenium-core/index.html
  • 6. Simple Selenium Tests Selenium understands two types of files Tests Test Suites Every test must be contained within a test suite Both tests and test suites are defined by using simple tables in HTML To execute a test suite you must point TestRunner.html at it
  • 7. Format of Selenium Test Suite More complex than Selenium Tests Easiest just to copy TestSuite.html from the samples Mostly a table that points to the tests
  • 8. Format of a Selenium Test HTML Table with 3 columns First Column: Selenium command Second Column: Required first parameter Third Column: Optional second parameter Selenium commands are broken into 3 types: Actions – Command the browser to do something Accessors – Store/retrieve data from selenium variables Asserts – Verify that the browser is in a certain state
  • 9. Format of a Selenium Test Two types of Selenium Parameters Locators – Used to find elements in html trees Pattern Matchers – Used to verify values Lots of locator types. Some examples are: Id based, xpath based, css selector based Pattern matchers are typically exact matches or regular expressions Lots more info at: http://www.openqa.org/selenium-core/reference.html So lets try to write a simple Selenium test…
  • 10. Gotchas in HTML Selenium Test Writing Selenium is sensitive to the format of the table All selenium command rows must have three columns or they will not be recognized as commands You can only test URL’s that are in the same domain as the selenium core Separation of concerns is hard – Tests become very dependent on the internal structure of the HTML
  • 11. Wow, that was hard! Lesson learned: Never ever write this by hand There are a lot of commands - you can even add your own custom commands into the user-extensions.js Firebug is very useful for developing your accessors
  • 12. Selenium IDE Firefox extension that allows recording and editing of tests Can be download off of www.openqa.org Allows easier development of tests Can even output Ruby for it’s Ruby based API Lets see it in action…
  • 13. Selenium IDE Much easier to use Only really works with synchronous requests Only automates commands, assert still must be entered by hand Still requires lots of work to get Selenium to run it as part of a Test Suite
  • 14. Selenium on Rails Plugin for Rails that allows tests to be expressed in Ruby Selenium core files no longer go in public – they are part of the Plugin Supports two kinds of files SEL files and RSEL files SEL files are pipe separated files that look much like Selenium HTML RSEL files talk to a Ruby API that closely mirrors the normal commands – more info at: http://www.openqa.org/classes/SeleniumOnRails/TestBuilder.html
  • 15. Selenium on Rails Each test becomes a single RSEL file which contains Ruby calls closely resembling the Selenium Commands RSEL files work much like views in Ruby and can be broken down into partials Selenium on Rails takes over the /selenium/ URL space RSEL files are used to automatically generate Selenium HTML table based tests Selenium on Rails then generates it’s own Test Suite containing all of the tests
  • 16. Selenium on Rails RSEL files can reference fixtures and clear session state on startup RSEL files support partials Test development is much more Rails like -> Edit RSEL file, hit Reload in browser, run updated test Lets see it in action…
  • 17. That was still pretty hard… Selenium on Rails does not initially make WRITING tests any easier Selenium on Rails makes deploying and the development cycle of tests easier Selenium on Rails makes writing tests more natural for RoR developers – it also gives your tests access to the rest of the code you have developed for your application Selenium on Rails should really be seen as a starting point for developing a DSL to test YOUR application
  • 18. Problems with Selenium The Xpath locators are basically worthless because of the poor performance in IE It is not designed to do AJAX type testing waitForElement and waitForCondition are the tools that Selenium provides to deal with AJAX both of which add a lot of complexity to tests Custom Selenium commands added to user-extensions.js are difficult to write – Avoid doing so unless you must Timeouts are unreliable – sometimes tests hang Not all Javascript events are supported
  • 19. ?