• Save
Selenium
Upcoming SlideShare
Loading in...5
×
 

Selenium

on

  • 6,386 views

My presentation on selenium

My presentation on selenium

Statistics

Views

Total Views
6,386
Views on SlideShare
6,340
Embed Views
46

Actions

Likes
7
Downloads
0
Comments
0

3 Embeds 46

http://www.slideshare.net 27
http://reddyphp.wordpress.com 18
http://webcache.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Selenium Selenium Presentation Transcript

  • Automated web application testing using Selenium - Muthukrishnan Shanmugam Automated web application testing using Selenium - Muthukrishnan Shanmugam
    • Browser based suite of tools to automate web application testing across many platforms.
    • Selenium is developed by ThoughtWorks.
    • An open source released under the Apache 2.0 license.
    • Developed in JavaScript/DHTML.
    • Official site - http://selenium.openqa.org/
    Introduction Overview
    • Alerts
    • Same origin policy
    • File uploads
    • and more..
    Overview
    • Supports testing apps built by web 2.0 technologies like AJAX
    • Suitable for Functionality and Browser Compatibility Testing
    • Table/Keyword driven Testing
    • Testing can be controlled by many programming languages and testing frameworks
    • Faster Test Execution
    Thumbs Up  Thumbs Down 
    • Selenium IDE
    • Selenium Core
    • Selenium Remote Control (RC)
    • Selenium Grid
    • Selenium on Rails
    • Cubic test
    Selenium Products Overview
  • Selenium IDE 1.0b2
  • Introduction Overview
    • Selenium IDE is a tool to test functionality of web applications
    • Acts as a complete IDE for selenium tests, as it lets the user to record, playback,
    • edit and debug tests, view test logs and results
    • Runs in the browser, Implemented as Firefox extension.
    • Platform support
      • Only Firefox 2+ browsers
      • All Operating systems
      • Programming Languages – HTML, C#, Java, Perl, PHP, Python and Ruby
    • Method 1 – From open qa’s site
    • http://selenium-ide.openqa.org/download.jsp
    • Method 2 – From Mozilla’s Add-ons site
    • https://addons.mozilla.org/en-US/firefox/addon/2079
    Installing Selenium IDE 1.0b2 Overview Exploring Selenium IDE 1.0b2
    • Run and Record toolbar
    • Script pane
    • Lower pane
    • Menu
    • Commands – tells sel. What to do
      • Actions – Manipulates the state of application
      • e.g. click/clickAndWait, type/typeAndWait
      • Accessors – Examines the state of application and stores the results in a variable
      • e.g. storeTitle
      • Assertions – Verifies the state of application and conforms to what is expected. All
      • selenium assertions can be used in 3 modes ‘assert’, ‘verify’ and ‘waitFor’.
    • Element Locators – tells sel. Which HTML element a command refers to
    • Locators could be of id, name, dom, xpath, link or css
    • Patterns – can be used for various reasons. e.g. can be used to specify an expected value
    • Patterns could be of values, exact/reg-ex/glob string
    Script pane – in detail Overview
    • By Default, the test is recorded as a Selenese HTML script
    • Recording can be done in any of the supported programming languages and same
    • could be exported for editing.
    • P.S : Selenium IDE does not allow the user to run scripts other than Selenese HTML
    Recording Overview Playing Back
    • Scripts could be played back with the following options
      • Playing the entire Test suite
      • Playing the current Test case
      • Playing with Sel. IDE Test runner
      • Playing by the speed of user’s choice
    • Plan your Test
    • Prepare Manual Test Cases
    • Record the Base scripts
    • Play it back for verification
    • Convert Manual Test cases into Automation Test Scripts (Editing / Inserting Test
    • scripts)
    • Run the Test scripts
    • Analyze the Test results
    Testing Functionality of a simple web app. using Selenium IDE Overview
  • Sample Test run using Selenium IDE…..
  • Selenium Core 0.8.3
  • Introduction Overview
    • Selenium Core is a tool to Test Functionality and Browser Compatibility of web
    • applications
    • Runs directly in the browser and lets the user only to run the tests
    • Platform support
      • Browsers – FF 3, FF 2, IE 7, Safari 3, Safari 2, Opera 9, Opera 8
      • OS – Windows, OS X, Linux, Solaris
    • How ever works on any platform with JavaScript enabled browsers
  • Installing Selenium Core 0.8.3 Overview
    • Download Sel. Core from http://selenium-core.openqa.org/download.jsp
    • Make it available from the same web server as the application you want to test
    • If you can’t modify the application’s web server you want to test, then core isn’t the right
    • tool for you !
    • Open Sel. Test runner as a http page and NOT as a file
  • How Selenium core works? Overview
    • Uses JavaScript and Iframes to embed a Test Automation engine in your browser
    • Why I’ve to Install Sel.core on the same place as web server is?
  • Exploring Selenium Test Runner 0.8.3 Overview
  • Testing using Selenium Core Overview
    • Generate Test Scripts using Selenium IDE
    • Place the Test Suite in Tests folder of Sel. Core
    • Give away the Test suite’s path in Test Runner and click Go
    • Run the Test Suite / Test Cases
    • Analyze the Test Results for its Functionality
    • Analyze the Test Results for its Browser Compatibility
  • Overview HTA mode
    • HTA mode works only with IE on windows, can’t use it for testing with any other browsers
    • HTA file is a special type of HTML file, that is allowed to violate the same origin policy
    • You don’t have to install core onto the web server
    • Just open TestRunner.hta file in the Sel. Core installation folder, you’re now free to run your tests
    • against any website
  • Selenium Remote Control 0.9.2
  • Introduction Overview
    • Selenium Remote Control is a tool to test the functionality and browser
    • compatibility of web applications
    • Test scripts can be generated in programming languages of user choice
    • Platform support
      • Programming Languages - HTML, C#, Java, Perl, PHP, Python and Ruby
      • Browsers – FF 3, FF 2, IE 7, Safari 3, Safari 2, Opera 9, Opera 8
      • OS – Windows, OS X, Linux, Solaris
    • How ever works on any platform with JavaScript enabled browsers
    • RC is great for testing complex AJAX based web UI under a continuous integration system
  • Selenium RC Architecture Overview
  • Overview
    • RC client driver reaches out the RC server
    • RC server launches a browser
    • RC server bundles selenium Core and automatically loads into the browser
    • TestRunner in core will now open AUT
    • The Test script starts running
    How Selenium RC works?
  • Installing Selenium RC 0.9.2 Overview
    • Download selenium RC from http://selenium-rc.openqa.org/download.html
    • Install the latest version of JRE and add it to path env. variable
    • check using java –version in the command prompt
    • Install the latest version of PERL
    • Install selenium PERL client driver, run the foll. commands in PERL client driver directory
      • perl makefile.pl – you’ll now find an auto-generated make file
      • nmake install (for windows) – PERL modules will be downloaded from CPAN
  • Testing options on Selenium RC Overview
    • Testing without Coding
      • Normal Mode
      • Interactive Mode – for rapid prototyping of tests
      • Proxy Injection Mode – Experimental feature for now
    • Programming the Test using any of the supported Programming Languages
  • A Sample Test using RC in Interactive mode Overview
    • Start the server in interactive mode the cmd line - java -jar selenium-server.jar -interactive
    • Launch the browser - cmd=getNewBrowserSession&1=*iexplore&2=http://www.google.com
    • (or)
    • cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com
    • Jot down the session id; say, session id = 260113
    • Lets do a Google search !
      • cmd=open&1=http://www.google.com/webhp&sessionId=260113
      • cmd=type&1=q&2=hello world&sessionId=260113
      • cmd=click&1=btnG&sessionId=260113
    • Getting the page’s title cmd=getTitle&sessionId=260113
    • Wind up - cmd=testComplete&sessionId=260113
  • Sample Test run using Selenium RC with PERL script…
  • More on RC…. Overview
    • RC circumvents Same origin policy by acting as a client-configured proxy
    • Automatically Launching other browsers
      • cmd=getNewBrowserSession&1=*custom c:Program
      • FilesNetscapeNetscapeNetscp.exe&2=http://www.google.com – Must manually configure
      • HTTP proxy as ‘localhost:4444’
    • Running Tests under multi-window - java -jar selenium-server.jar -multiWindow
  • Selenium Grid 1.0.1
  • Introduction Overview
    • Selenium Grid is a tool that dramatically speeds up end-to-end web testing
    • Transparently distributes your tests on multiple machines, so that tests run on parallel
    • Cuts down time required for running in-browser test suites
    How Selenium Grid works?
  • Installing Selenium Grid 1.0.1 Overview
    • Hub machine
      • Install the latest version of JRE and JDK, check using java -version
      • Install the latest version of ANT
        • Download the binary distribution
        • Add the ANT folder to PATH env. Variable
        • check using ant –version
      • Download the latest Selenium Grid from http://selenium-grid.openqa.org/download.html
      • Transparently distributes your tests on multiple machines, so that tests run on parallel
      • Go to the root of Selenium Grid directory validate the installation – ant sanity-check
    • Remote control machines should have Selenium RCs installed
  • Running Tests in Sequence on Firefox on a single machine Overview
    • Launch Hub by using ant launch-hub in Hub machine
    • Check whether that the Hub is running by looking at http://localhost:4444/console
    • Launch RC in a new terminal using ant launch-remote-control in Hub machine
    • Now check http://localhost:4444/console for a running remote control
    • Run demo in sequence using ant run-demo-in-sequence in a new terminal
  • Running Tests in Parallel on Firefox on a single machine Overview
    • Launch Hub by using ant launch-hub in Hub machine
    • Check whether that the Hub is running by looking at http://localhost:4444/console
    • Launch RC in a new terminal using ant launch-remote-control in Hub machine
    • Launch 3 more RCs in separate terminals ant -Dport=5556 launch-remote-control, ant -Dport=5557
    • launch-remote-control, ant -Dport=5558 launch-remote-control
    • Now check http://localhost:4444/console for all four running remote controls
    • Run demo in parallel using ant run-demo-in-parallel in a new terminal
  • Running Tests in Parallel on Multiple Machines Overview
  • Running Tests with RCc Providing different environment Overview
  • Thank you !!! Overview