SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Selenium
  Concepts


By Swati Bansal
Agenda
•   What is Automation Testing?

•   Getting Familiar with ‘Selenium’.

•   Selenese – Heart Of Selenium

•   Digging Into Selenium Components.

•   Record with Selenium IDE

•   Code with Selenium RC.

•   Integrate with Junit Framework – A Visual delight!

•   Scale with Selenium Grid

•   Myths and Realities

•   Where are we heading To??

•   Open House!!
The Testing Process: Automation
                  Testing & Manual Testing!!

• Manual Testing – is       • Automation testing - is
  defined as developing       defined as developing
  and executing tests that    and executing tests that
  rely primarily on direct    can run unattended,
  human interaction           comparing the actual to
  throughout the entire test expected results and
  case, especially in terms   logging status.
  of evaluating correctness
  and ascertaining test
  status.
Win-Win With Automation!
•   Virtually unlimited iterations of test case
    execution.

•   Reduces effort spent in regressing old features.

•   Emulate exact user behaviors thus verifies an
    end to end business process. This gives us
    more confidence in the quality of the
    application.

•   Catch Regressions in frequently changing code
    and mainstream scenarios.

•   Aids in testing a large test matrix.

•   Disciplined documentation of test cases.
Some Myths n Realities About
                  Test Automation!!
•   Myth: Automation replaces testers.
    Reality: Manual Testing can never be eliminated.

•   Myth: Automation training is a lengthy process.
    Reality: Learning curve can be reduced by
    following a correct methodology..

•   Myth: Automation tool is difficult to use.
    Reality: With adequate training the testers can be
    easily migrated to any new testing tool.

•   Myth: A single tester can easily perform a dual role
    of manual and automation.
    Reality: A set of resources dedicated only to test
    automation is imperative for avoiding dilemma
    situations.
All About Selenium!!
Selenium...
• Is a suite of tools to automate web application testing.

• Tests run directly in a browser, just as real users do.

• Works by simulating user actions such as mouse clicks
  and key presses.

• Runs in many browsers and operating systems.

• Can be controlled by many programming languages and
  testing frameworks.
Selenium Tests..

• Browser compatibility testing.
   – Test your application to see if it works correctly on
     different browsers and operating systems. The same
     script can run on any supported Selenium platform.



• System functional testing.
   – Create regression tests to verify application
     functionality and user acceptance.
Selenese – Heart of Selenium!
• Selenium commands, aka selenese, are the set of commands that run your
    tests.
• Selenese commands consists of':
     • Actions

     • Accessors

     • Assertions

     • Element Locators

     • Patterns

•   Each command call is one line in the test table of the form:
Selenese Components – Actions!

• Actions are commands that generally manipulate the state of the
  application. They do things like "click this link" and "select that
  option". If an Action fails, or has an error, the execution of the current
  test is stopped. Examples of Actions include:
   • check - check a checkbox
   • click - click a link, button, image, etc
   • open - opens a URL in the browser
   • select - selects a value from a drop-down
   • submit - submits a form
   • type - types a value in to a textfield/textarea
Selenese Component – Assertions!
• Assertions verify that the state of the application
  conforms to what is expected.
• All Selenium Assertions can be used in 3 modes: "assert",
  "verify", and "waitFor“.
• Examples include "make sure the page title is X" and
  "verify that this checkbox is checked".
• assertTrue, assertEquals, waitForPageToLoad,
  verifyTextPresent.
Selenium Component – Element Locators!

• Element Locators tell Selenium which HTML element a command
  refers to.
• Many commands require an Element Locator as the "target" attribute.
• Element Locators primarily fall under 3 categories: identifier, dom,
  xpath.
• Examples:
    – Identifier: sel.type(“<textFieldId>”, “Enter Some Text”);
    – Dom: sel.select(“document.forms['myForm'].myDropdown”,
      “label=Select This Item”);
    – XPATH: sel.click(“//img[@alt='The image alt text'] “);
Selenese Component – Patterns!

• Patterns are used for various reasons, e.g. to
  specify the expected value of an input field, or
  identify a select option.

• Selenium supports various types of patterns.

• Examples of Patterns include glob, regexp, exact.
Selenium IDE                   Selenium RC




         Flavors Of Selenium!




               Selenium Grid
Selenium IDE
Selenium IDE – The Recording
                                      Tool!
• Selenium-IDE is the Integrated Development Environment for
  building Selenium test cases.
• Firefox plug-in that helps with recording Selenium scripts. Keeps
  account of user actions as they are performed and stores them as a
  reusable script to play back.
• Recorded script are shown in easily readable table format in IDE.
• Key feature: Record
     Traces what the user does
     Identifies clicks, key selections
     Generates script to re-enact what is recorded
Live Demo Of IDE!
IDE Striking features 

 Record, edit, and debug tests.

 Intelligent field selection uses IDs, names, or XPath as needed.

 Uses Base URL to Run Test Cases in Different Domains.

 Can export tests in HTML, Java, Ruby, and more.

 Execute Selenium-IDE Tests on Different Browsers using
  Selenium RC.
What IDE Does Not Have? 

• Selenium-IDE is a Firefox only add-on. Dependency on Selenium RC to run
   against other browsers.
• Scripts written using IDE follow a linear execution and lack any
   programming logic.
• Difficulty in automating scenarios like:
    – Performing search multiple times (iteration logic).

    – Data Driven Testing (read different data set from external files each time).

    – Handling for unexpected behaviors like element not found (Error Handling)

    – Registration process where in registered email address is to be retrieved from
       database. (Database Interactins)
Selenium RC
Selenium RC – The Code
                                 Master!
• Selenium Remote Control (RC) is :
    a test tool that allows you to write automated web application UI tests

    in any high level programming language

    against any HTTP website

    using any mainstream JavaScript-enabled browser.

• While leveraging the full power of programming languages
  (iterations, conditional logic, error recovery), the tests can be written
  for virtually anything like read and write external files, make queries
  to a database, send emails with test reports and so on..
RC Architecture!
• RC Components
  include:
 The Selenium
  Server
 Client Libraries
RC Component - Selenium
•   Same Origin Policy: A site’s content can never be accessible by a script from other site. This policy

                                                Server
    implies that Selenium Core (JavaScript program, a set of JavaScript functions, which interprets and
    executes Selenium commands using the browser’s built-in JavaScript interpreter) must be placed in
    the same origin as the AUT i.e. the same url.

•   Selenium RC Server is an alternative to allow testers to use Selenium to test sites without deploying
    their JS code. Hence is a solution to XSS (Cross Site Scripting and security concerns).

•   The Selenium Server acts as a client-configured HTTP proxy, that stands in between the browser
    and the AUT:
     –   Client Configured: The client browser is launched with a configuration profile that has set
         localhost:4444 as HTTP proxy such that any HTTP request/response will pass through the
         Selenium Server.

     –   HTTP Proxy: Acts as a web server that delivers the AUT to the browser. Being a proxy gives it
         the ability to mask the whole AUT under a fictional URL (embedding Selenium Core and its
         Java Script tests, delivering them as if they are coming from the same origin.)
RC Component - Client Libraries!
• A Selenium client library provides a programming interface, i.e., a set
   of functions, which run Selenium commands from your program.
• It takes a Selenium command and passes it to the Selenium Server for
   processing a specific action or test against the AUT.
• It then receives the result of that command and passes it back to the
   test program.
• Selenium-IDE can directly translate its Selenium commands into a
   client-driver’s API function calls.
• Client libraries are available in all of: HTML, Java, C#, Perl, PHP,
   Python, and Ruby.
What happens When A Test Runs (I)
What happens When A Test Runs (II)
•   The client/driver establishes a connection with the selenium-RC server.

•   Selenium-RC server launches a browser with an URL that will load Selenium-Core in
    the web page.

•   Selenium-Core gets the first instruction from the client/driver (via another HTTP
    request made to the Selenium-RC Server).

•   Selenium-Core acts on that first instruction, typically opening a page of the AUT.

•   The browser receives the open request and asks for the website’s content to the
    Selenium-RC server (set as the HTTP proxy for the browser to use).

•   Selenium-RC server communicates with the Web server asking for the page and once
    it receives it, it sends the page to the browser masking the origin to look like the page
    comes from the same server as Selenium-Core (this allows Selenium-Core to comply
    with the Same Origin Policy).

•   The browser receives the web page and renders it in the window reserved for it.
Integrate With JUNIT Framework -
                   Lets See Ourselves!

• Once you’ve chosen a language to work with, you
  simply need to:
   Install the Selenium-RC Server.

   Set up a programming project using a language
    specific client driver.

• Here we rely on Java’s JUNIT framework to see it
  all working.
Selenium + Junit Framework – A Demo!
Issues With Selenium RC?? 
• The Selenium remote control is quite slow at driving
  the browser.

• You can only run a limited number of concurrent tests
  on the same remote control before seriously impacting
  its stability.

• Automation of pages involving AJAX is tedious.

• XPATH heavy, sensitive to design change.
Selenium Grid
Selenium Grid – Scale It Up!

• Run your tests in parallel heterogeneous
  environments.

• Dramatically speeds up end-to-end web testing.

• Distribute your tests on multiple machines.
The Grid Layout!!
Lets Revise What We Studied!!
             
What Selenium has to Offer!


• All flexible.

• Customize Your Test Automation.

• All Extensible.

• Open Source project

• Free Of Cost!
References To Refer!
•   http://seleniumhq.org/docs/ : The complete encyclopedia to Selenium.

•   http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/java/ :
    The RC API documentation

•   http://release.seleniumhq.org/selenium-core/1.0/reference.html

•   http://loggingselenium.sourceforge.net/usage.html :Logging Selenium

•   http://seleniumhq.org/docs/06_test_design_considerations.html :Test Design
    Considerations and Common Errors.

•   http://openqa.org/

•   http://selenium-grid.seleniumhq.org/how_it_works.html :The grid help.
Open House!!
Selenium Concepts

Weitere ähnliche Inhalte

Was ist angesagt?

Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaEdureka!
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Simplilearn
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using SeleniumNaresh Chintalcheru
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using SeleniumWeifeng Zhang
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introductionPankaj Dubey
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.pptAna Sarbescu
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...Simplilearn
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with SeleniumKerry Buckley
 

Was ist angesagt? (20)

Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
Selenium
SeleniumSelenium
Selenium
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | Edureka
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
 
Selenium
SeleniumSelenium
Selenium
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using Selenium
 
Selenium WebDriver training
Selenium WebDriver trainingSelenium WebDriver training
Selenium WebDriver training
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.ppt
 
SELENIUM PPT.pdf
SELENIUM PPT.pdfSELENIUM PPT.pdf
SELENIUM PPT.pdf
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
 

Ähnlich wie Selenium Concepts

Selenium
SeleniumSelenium
Seleniumeduquer
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using JavaF K
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using seleniumTờ Rang
 
test-automation-selenium-160216124839.pptx
test-automation-selenium-160216124839.pptxtest-automation-selenium-160216124839.pptx
test-automation-selenium-160216124839.pptxSyedZaeem9
 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Simplilearn
 
Learn Test Automation using Selenium - Lesson 1
Learn Test Automation using Selenium - Lesson 1Learn Test Automation using Selenium - Lesson 1
Learn Test Automation using Selenium - Lesson 1Furqan Ud Din
 

Ähnlich wie Selenium Concepts (20)

Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Selenium (1) (1)
Selenium (1) (1)Selenium (1) (1)
Selenium (1) (1)
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Selenium Primer
Selenium PrimerSelenium Primer
Selenium Primer
 
test-automation-selenium-160216124839.pptx
test-automation-selenium-160216124839.pptxtest-automation-selenium-160216124839.pptx
test-automation-selenium-160216124839.pptx
 
Selenium
SeleniumSelenium
Selenium
 
Sel
SelSel
Sel
 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
 
Learn Test Automation using Selenium - Lesson 1
Learn Test Automation using Selenium - Lesson 1Learn Test Automation using Selenium - Lesson 1
Learn Test Automation using Selenium - Lesson 1
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 

Kürzlich hochgeladen

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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Kürzlich hochgeladen (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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
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...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Selenium Concepts

  • 1. Selenium Concepts By Swati Bansal
  • 2. Agenda • What is Automation Testing? • Getting Familiar with ‘Selenium’. • Selenese – Heart Of Selenium • Digging Into Selenium Components. • Record with Selenium IDE • Code with Selenium RC. • Integrate with Junit Framework – A Visual delight! • Scale with Selenium Grid • Myths and Realities • Where are we heading To?? • Open House!!
  • 3.
  • 4. The Testing Process: Automation Testing & Manual Testing!! • Manual Testing – is • Automation testing - is defined as developing defined as developing and executing tests that and executing tests that rely primarily on direct can run unattended, human interaction comparing the actual to throughout the entire test expected results and case, especially in terms logging status. of evaluating correctness and ascertaining test status.
  • 5. Win-Win With Automation! • Virtually unlimited iterations of test case execution. • Reduces effort spent in regressing old features. • Emulate exact user behaviors thus verifies an end to end business process. This gives us more confidence in the quality of the application. • Catch Regressions in frequently changing code and mainstream scenarios. • Aids in testing a large test matrix. • Disciplined documentation of test cases.
  • 6. Some Myths n Realities About Test Automation!! • Myth: Automation replaces testers. Reality: Manual Testing can never be eliminated. • Myth: Automation training is a lengthy process. Reality: Learning curve can be reduced by following a correct methodology.. • Myth: Automation tool is difficult to use. Reality: With adequate training the testers can be easily migrated to any new testing tool. • Myth: A single tester can easily perform a dual role of manual and automation. Reality: A set of resources dedicated only to test automation is imperative for avoiding dilemma situations.
  • 8. Selenium... • Is a suite of tools to automate web application testing. • Tests run directly in a browser, just as real users do. • Works by simulating user actions such as mouse clicks and key presses. • Runs in many browsers and operating systems. • Can be controlled by many programming languages and testing frameworks.
  • 9. Selenium Tests.. • Browser compatibility testing. – Test your application to see if it works correctly on different browsers and operating systems. The same script can run on any supported Selenium platform. • System functional testing. – Create regression tests to verify application functionality and user acceptance.
  • 10. Selenese – Heart of Selenium! • Selenium commands, aka selenese, are the set of commands that run your tests. • Selenese commands consists of': • Actions • Accessors • Assertions • Element Locators • Patterns • Each command call is one line in the test table of the form:
  • 11. Selenese Components – Actions! • Actions are commands that generally manipulate the state of the application. They do things like "click this link" and "select that option". If an Action fails, or has an error, the execution of the current test is stopped. Examples of Actions include: • check - check a checkbox • click - click a link, button, image, etc • open - opens a URL in the browser • select - selects a value from a drop-down • submit - submits a form • type - types a value in to a textfield/textarea
  • 12. Selenese Component – Assertions! • Assertions verify that the state of the application conforms to what is expected. • All Selenium Assertions can be used in 3 modes: "assert", "verify", and "waitFor“. • Examples include "make sure the page title is X" and "verify that this checkbox is checked". • assertTrue, assertEquals, waitForPageToLoad, verifyTextPresent.
  • 13. Selenium Component – Element Locators! • Element Locators tell Selenium which HTML element a command refers to. • Many commands require an Element Locator as the "target" attribute. • Element Locators primarily fall under 3 categories: identifier, dom, xpath. • Examples: – Identifier: sel.type(“<textFieldId>”, “Enter Some Text”); – Dom: sel.select(“document.forms['myForm'].myDropdown”, “label=Select This Item”); – XPATH: sel.click(“//img[@alt='The image alt text'] “);
  • 14. Selenese Component – Patterns! • Patterns are used for various reasons, e.g. to specify the expected value of an input field, or identify a select option. • Selenium supports various types of patterns. • Examples of Patterns include glob, regexp, exact.
  • 15. Selenium IDE Selenium RC Flavors Of Selenium! Selenium Grid
  • 17. Selenium IDE – The Recording Tool! • Selenium-IDE is the Integrated Development Environment for building Selenium test cases. • Firefox plug-in that helps with recording Selenium scripts. Keeps account of user actions as they are performed and stores them as a reusable script to play back. • Recorded script are shown in easily readable table format in IDE. • Key feature: Record  Traces what the user does  Identifies clicks, key selections  Generates script to re-enact what is recorded
  • 18. Live Demo Of IDE!
  • 19. IDE Striking features   Record, edit, and debug tests.  Intelligent field selection uses IDs, names, or XPath as needed.  Uses Base URL to Run Test Cases in Different Domains.  Can export tests in HTML, Java, Ruby, and more.  Execute Selenium-IDE Tests on Different Browsers using Selenium RC.
  • 20. What IDE Does Not Have?  • Selenium-IDE is a Firefox only add-on. Dependency on Selenium RC to run against other browsers. • Scripts written using IDE follow a linear execution and lack any programming logic. • Difficulty in automating scenarios like: – Performing search multiple times (iteration logic). – Data Driven Testing (read different data set from external files each time). – Handling for unexpected behaviors like element not found (Error Handling) – Registration process where in registered email address is to be retrieved from database. (Database Interactins)
  • 22. Selenium RC – The Code Master! • Selenium Remote Control (RC) is :  a test tool that allows you to write automated web application UI tests  in any high level programming language  against any HTTP website  using any mainstream JavaScript-enabled browser. • While leveraging the full power of programming languages (iterations, conditional logic, error recovery), the tests can be written for virtually anything like read and write external files, make queries to a database, send emails with test reports and so on..
  • 23. RC Architecture! • RC Components include:  The Selenium Server  Client Libraries
  • 24. RC Component - Selenium • Same Origin Policy: A site’s content can never be accessible by a script from other site. This policy Server implies that Selenium Core (JavaScript program, a set of JavaScript functions, which interprets and executes Selenium commands using the browser’s built-in JavaScript interpreter) must be placed in the same origin as the AUT i.e. the same url. • Selenium RC Server is an alternative to allow testers to use Selenium to test sites without deploying their JS code. Hence is a solution to XSS (Cross Site Scripting and security concerns). • The Selenium Server acts as a client-configured HTTP proxy, that stands in between the browser and the AUT: – Client Configured: The client browser is launched with a configuration profile that has set localhost:4444 as HTTP proxy such that any HTTP request/response will pass through the Selenium Server. – HTTP Proxy: Acts as a web server that delivers the AUT to the browser. Being a proxy gives it the ability to mask the whole AUT under a fictional URL (embedding Selenium Core and its Java Script tests, delivering them as if they are coming from the same origin.)
  • 25. RC Component - Client Libraries! • A Selenium client library provides a programming interface, i.e., a set of functions, which run Selenium commands from your program. • It takes a Selenium command and passes it to the Selenium Server for processing a specific action or test against the AUT. • It then receives the result of that command and passes it back to the test program. • Selenium-IDE can directly translate its Selenium commands into a client-driver’s API function calls. • Client libraries are available in all of: HTML, Java, C#, Perl, PHP, Python, and Ruby.
  • 26. What happens When A Test Runs (I)
  • 27. What happens When A Test Runs (II) • The client/driver establishes a connection with the selenium-RC server. • Selenium-RC server launches a browser with an URL that will load Selenium-Core in the web page. • Selenium-Core gets the first instruction from the client/driver (via another HTTP request made to the Selenium-RC Server). • Selenium-Core acts on that first instruction, typically opening a page of the AUT. • The browser receives the open request and asks for the website’s content to the Selenium-RC server (set as the HTTP proxy for the browser to use). • Selenium-RC server communicates with the Web server asking for the page and once it receives it, it sends the page to the browser masking the origin to look like the page comes from the same server as Selenium-Core (this allows Selenium-Core to comply with the Same Origin Policy). • The browser receives the web page and renders it in the window reserved for it.
  • 28. Integrate With JUNIT Framework - Lets See Ourselves! • Once you’ve chosen a language to work with, you simply need to:  Install the Selenium-RC Server.  Set up a programming project using a language specific client driver. • Here we rely on Java’s JUNIT framework to see it all working.
  • 29. Selenium + Junit Framework – A Demo!
  • 30.
  • 31. Issues With Selenium RC??  • The Selenium remote control is quite slow at driving the browser. • You can only run a limited number of concurrent tests on the same remote control before seriously impacting its stability. • Automation of pages involving AJAX is tedious. • XPATH heavy, sensitive to design change.
  • 33. Selenium Grid – Scale It Up! • Run your tests in parallel heterogeneous environments. • Dramatically speeds up end-to-end web testing. • Distribute your tests on multiple machines.
  • 35. Lets Revise What We Studied!! 
  • 36.
  • 37. What Selenium has to Offer! • All flexible. • Customize Your Test Automation. • All Extensible. • Open Source project • Free Of Cost!
  • 38. References To Refer! • http://seleniumhq.org/docs/ : The complete encyclopedia to Selenium. • http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/java/ : The RC API documentation • http://release.seleniumhq.org/selenium-core/1.0/reference.html • http://loggingselenium.sourceforge.net/usage.html :Logging Selenium • http://seleniumhq.org/docs/06_test_design_considerations.html :Test Design Considerations and Common Errors. • http://openqa.org/ • http://selenium-grid.seleniumhq.org/how_it_works.html :The grid help.