SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
Intro
          * I’m Dave Haeffner                                Show of hands
          * I’ve been doing QA and automated                 new to Selenium?
          web testing for 4 years                            some experience with?
          * Most of that time was spent at                   experienced?
          The Motley Fool
          * More recently I started my own                   new to programming?
          consulting company and work with                   some experience with?
          soft ware development shops to help                experienced?
          them with QA strategy and                          not sure how to answer?
          implementing automated web
          testing




                                   SELENIUM BASICS
                                      brought to you by the QA Lounge




Tuesday, September 25, 12
“WHAT IS SELENIUM? TELL
                    ME LIKE I’M 5.”
                               Selenium is a soft ware
                               robot sent from the
                               future to test our
                               soft ware.




Tuesday, September 25, 12
PREFACE

          There are many ways to implement Selenium & a framework

                            I will show you one that has worked for me

                            There will be code involved (and opinions!)

         These examples do not reflect a comprehensive QA strategy

                                       But it’s a good start


Tuesday, September 25, 12
SELENIUM IDE
                                    I debated showing you the IDE since it’s the unloved
                                    child of the Selenium community.

                                    But it is responsible for the wide spread success of
                                    Selenium.

                                    I consider it to be less of an unloved orphan and
                                    more of a gateway drug




Tuesday, September 25, 12
SELENIUM IDIOMS


    • Verify           vs. Assert

    • Location, location, location!

    • ClickAndWait, and             wait, and wait...




Tuesday, September 25, 12
LET ME EXPLAIN

    • Ruby            is approachable -- it can read like English

    • There’s                also that “standing on the shoulder of giants thing”

    • RSpec                 is an open-source testing tool built in Ruby for Ruby

         • It’s      kind of a big deal

         • Loads             of functionality out of the box

         • Quite             customizable

Tuesday, September 25, 12
“SHUT UP AND SHOW
                           ME THE CODE!”



Tuesday, September 25, 12
COMMON ACTIONS

                      Name                Action            Sub-Action
                       get             fetch a page
                     navigate          same as get        to, forward, back
                               (:id, “idtext”)
                               (:class, “classtext”)
                               (:tag_name, “tagtext”)
           find_element
                               (:name, “nametext”)           click, text
      (a.k.a. “by” strategies)
                               (:link, “linktext”)
                               (:partial_link_text, “”)
                               (:css, “csstext”)

Tuesday, September 25, 12
HONORABLE MENTION

    • Moving                between windows and frames

    • Pop-up                dialogs

    • Drag            and Drop

    • Cookies

    • Changing                the User Agent


Tuesday, September 25, 12
ASSERTIONS THRU RSPEC
                            Thing      Action         Sub-Action
                                                     include(“text”)
                                                   start_with(“text”)
                                                   end_with(“text”)
                                                    equal(expected)
                                       should         be(expected)
                            object
                                     should_not      be > expected
                                                    be >= expected
                                                    be <= expected
                                                     be < expected
                                                  match(/expression/)

Tuesday, September 25, 12
“NO REALLY,
                 SHUT UP AND SHOW ME
                      THE CODE!”



Tuesday, September 25, 12
PAGE OBJECT PATTERN
                                                         Create a class
                                                         Pass the session to it
                                                         Store and use it through an instance variable
                                                         Assertions done outside of the class
    • Relieves              many test maintenance woes

    • Keeps             things DRY rather than WET

    • Create   an object that represents a page (or component of a
        page) and test against that

    • If    the UI changes, you change just the object, not the tests

    • Also           helps you make things more readable

Tuesday, September 25, 12
“IS THAT IT?”




Tuesday, September 25, 12
robot/
                                                 DIY FRAMEWORK
                     .rspec
                     Rakefile
                     Gemfile
                     art/
                            results.html
                     brains/
                            config.rb
                            page_objects/
                              google_search.rb
                     guts/



Tuesday, September 25, 12
FRAMEWORK CONT’D

                            rake robot:run




      Code available at github.com/tourdedave/diy_framework



Tuesday, September 25, 12
RECAP

    • Selenium                IDE is cool in theory...

    • WebDriver                 is cool.

    • The          Page Object Pattern will make you happy and successful

    • Rolling               your own framework is within your grasp

    • And           it positions you for automation success!


Tuesday, September 25, 12
SOME RESOURCES
    • Selenium                HQ (SeleniumHQ.com/docs/03_webdriver.html)

    • Official               Selenium Blog (SeleniumHQ.Wordpress.com)

    • Ruby            Selenium Bindings (http://bit.ly/seruby)

    • RSpec                 (http://github.com/rspec)

    • Why             Everyone Should Be Code Literate (http://bit.ly/sauceio)

    •A        book to get you started (http://bit.ly/se2book)

    •A        self-proclaimed great resource* (QA-Lounge.com)
Tuesday, September 25, 12
Q&A

                            @TourDeDave
                            QA-Lounge.com



Tuesday, September 25, 12

Weitere ähnliche Inhalte

Andere mochten auch

How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DCPivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
Dave Haeffner
 

Andere mochten auch (18)

Cucumber Crash Course
Cucumber Crash CourseCucumber Crash Course
Cucumber Crash Course
 
Open Source Investing
Open Source InvestingOpen Source Investing
Open Source Investing
 
Selenium Frameworks
Selenium FrameworksSelenium Frameworks
Selenium Frameworks
 
How To Find Information On Your Own
How To Find Information On Your OwnHow To Find Information On Your Own
How To Find Information On Your Own
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
Selenium Tips & Tricks
Selenium Tips & TricksSelenium Tips & Tricks
Selenium Tips & Tricks
 
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
 
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DCPivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
 
Web testing with Selenium
Web testing with SeleniumWeb testing with Selenium
Web testing with Selenium
 
Continuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.orgContinuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.org
 
Selenium
SeleniumSelenium
Selenium
 
KISS Automation.py
KISS Automation.pyKISS Automation.py
KISS Automation.py
 
Web ui tests examples with selenide, nselene, selene & capybara
Web ui tests examples with  selenide, nselene, selene & capybaraWeb ui tests examples with  selenide, nselene, selene & capybara
Web ui tests examples with selenide, nselene, selene & capybara
 
You do not need automation engineer - Sqa Days - 2015 - EN
You do not need automation engineer  - Sqa Days - 2015 - ENYou do not need automation engineer  - Sqa Days - 2015 - EN
You do not need automation engineer - Sqa Days - 2015 - EN
 
Cross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToCross Platform Appium Tests: How To
Cross Platform Appium Tests: How To
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Write Selenide in Python 15 min
Write Selenide in Python 15 minWrite Selenide in Python 15 min
Write Selenide in Python 15 min
 

Ähnlich wie Selenium Basics

Symfony - Introduction
Symfony - IntroductionSymfony - Introduction
Symfony - Introduction
Piers Warmers
 
Products = Mess - How to avoid it? By Suman Mukherjee
Products = Mess - How to avoid it?  By Suman MukherjeeProducts = Mess - How to avoid it?  By Suman Mukherjee
Products = Mess - How to avoid it? By Suman Mukherjee
WebGeek Philippines
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
dimakovalenko
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)
Mehdi Khalili
 
TripCase Unit Testing with Jasmine
TripCase Unit Testing with JasmineTripCase Unit Testing with Jasmine
TripCase Unit Testing with Jasmine
Stephen Pond
 
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
Mark Rackley
 

Ähnlich wie Selenium Basics (20)

Symfony - Introduction
Symfony - IntroductionSymfony - Introduction
Symfony - Introduction
 
Flaky No More: Find the Right Framework for Your Selenium Tests
Flaky No More: Find the Right Framework for Your Selenium TestsFlaky No More: Find the Right Framework for Your Selenium Tests
Flaky No More: Find the Right Framework for Your Selenium Tests
 
Property-Based Testing for Services
Property-Based Testing for ServicesProperty-Based Testing for Services
Property-Based Testing for Services
 
Products = Mess - How to avoid it? By Suman Mukherjee
Products = Mess - How to avoid it?  By Suman MukherjeeProducts = Mess - How to avoid it?  By Suman Mukherjee
Products = Mess - How to avoid it? By Suman Mukherjee
 
Zero to tested
Zero to testedZero to tested
Zero to tested
 
Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflow
 
From 0 to 100: How we jump-started our frontend testing
From 0 to 100: How we jump-started our frontend testingFrom 0 to 100: How we jump-started our frontend testing
From 0 to 100: How we jump-started our frontend testing
 
Gemboys
GemboysGemboys
Gemboys
 
Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008
 
Method Swizzling with Objective-C
Method Swizzling with Objective-CMethod Swizzling with Objective-C
Method Swizzling with Objective-C
 
Test automation with selenide
Test automation with selenideTest automation with selenide
Test automation with selenide
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
 
Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011
 
Berlin.JS Meetup
Berlin.JS MeetupBerlin.JS Meetup
Berlin.JS Meetup
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)
 
TripCase Unit Testing with Jasmine
TripCase Unit Testing with JasmineTripCase Unit Testing with Jasmine
TripCase Unit Testing with Jasmine
 
Responsive widget-design-with-word press
Responsive widget-design-with-word pressResponsive widget-design-with-word press
Responsive widget-design-with-word press
 
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
 
Workshop: Introduction to the Disruptor
Workshop: Introduction to the DisruptorWorkshop: Introduction to the Disruptor
Workshop: Introduction to the Disruptor
 
Running a Lean Startup with AWS
Running a Lean Startup with AWSRunning a Lean Startup with AWS
Running a Lean Startup with AWS
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Selenium Basics

  • 1. Intro * I’m Dave Haeffner Show of hands * I’ve been doing QA and automated new to Selenium? web testing for 4 years some experience with? * Most of that time was spent at experienced? The Motley Fool * More recently I started my own new to programming? consulting company and work with some experience with? soft ware development shops to help experienced? them with QA strategy and not sure how to answer? implementing automated web testing SELENIUM BASICS brought to you by the QA Lounge Tuesday, September 25, 12
  • 2. “WHAT IS SELENIUM? TELL ME LIKE I’M 5.” Selenium is a soft ware robot sent from the future to test our soft ware. Tuesday, September 25, 12
  • 3. PREFACE There are many ways to implement Selenium & a framework I will show you one that has worked for me There will be code involved (and opinions!) These examples do not reflect a comprehensive QA strategy But it’s a good start Tuesday, September 25, 12
  • 4. SELENIUM IDE I debated showing you the IDE since it’s the unloved child of the Selenium community. But it is responsible for the wide spread success of Selenium. I consider it to be less of an unloved orphan and more of a gateway drug Tuesday, September 25, 12
  • 5. SELENIUM IDIOMS • Verify vs. Assert • Location, location, location! • ClickAndWait, and wait, and wait... Tuesday, September 25, 12
  • 6. LET ME EXPLAIN • Ruby is approachable -- it can read like English • There’s also that “standing on the shoulder of giants thing” • RSpec is an open-source testing tool built in Ruby for Ruby • It’s kind of a big deal • Loads of functionality out of the box • Quite customizable Tuesday, September 25, 12
  • 7. “SHUT UP AND SHOW ME THE CODE!” Tuesday, September 25, 12
  • 8. COMMON ACTIONS Name Action Sub-Action get fetch a page navigate same as get to, forward, back (:id, “idtext”) (:class, “classtext”) (:tag_name, “tagtext”) find_element (:name, “nametext”) click, text (a.k.a. “by” strategies) (:link, “linktext”) (:partial_link_text, “”) (:css, “csstext”) Tuesday, September 25, 12
  • 9. HONORABLE MENTION • Moving between windows and frames • Pop-up dialogs • Drag and Drop • Cookies • Changing the User Agent Tuesday, September 25, 12
  • 10. ASSERTIONS THRU RSPEC Thing Action Sub-Action include(“text”) start_with(“text”) end_with(“text”) equal(expected) should be(expected) object should_not be > expected be >= expected be <= expected be < expected match(/expression/) Tuesday, September 25, 12
  • 11. “NO REALLY, SHUT UP AND SHOW ME THE CODE!” Tuesday, September 25, 12
  • 12. PAGE OBJECT PATTERN Create a class Pass the session to it Store and use it through an instance variable Assertions done outside of the class • Relieves many test maintenance woes • Keeps things DRY rather than WET • Create an object that represents a page (or component of a page) and test against that • If the UI changes, you change just the object, not the tests • Also helps you make things more readable Tuesday, September 25, 12
  • 13. “IS THAT IT?” Tuesday, September 25, 12
  • 14. robot/ DIY FRAMEWORK .rspec Rakefile Gemfile art/ results.html brains/ config.rb page_objects/ google_search.rb guts/ Tuesday, September 25, 12
  • 15. FRAMEWORK CONT’D rake robot:run Code available at github.com/tourdedave/diy_framework Tuesday, September 25, 12
  • 16. RECAP • Selenium IDE is cool in theory... • WebDriver is cool. • The Page Object Pattern will make you happy and successful • Rolling your own framework is within your grasp • And it positions you for automation success! Tuesday, September 25, 12
  • 17. SOME RESOURCES • Selenium HQ (SeleniumHQ.com/docs/03_webdriver.html) • Official Selenium Blog (SeleniumHQ.Wordpress.com) • Ruby Selenium Bindings (http://bit.ly/seruby) • RSpec (http://github.com/rspec) • Why Everyone Should Be Code Literate (http://bit.ly/sauceio) •A book to get you started (http://bit.ly/se2book) •A self-proclaimed great resource* (QA-Lounge.com) Tuesday, September 25, 12
  • 18. Q&A @TourDeDave QA-Lounge.com Tuesday, September 25, 12