Upload
kai-feng-zhang
View
3.983
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
2008-10-31 1
Intro of Selenium
2008-10-31 2
Objective
Introduction to aspects of Selenium Target audience: anyone who has interests
in web-app automation
2008-10-31 3
Dilemmas
UI changes Platforms Browsers Development efforts Maintainance efforts
2008-10-31 4
What is Selenium?
Web-based App testing tool, running directly in browser.
Implemented entirely with browser techs DHTML JavaScript Frames
Works by inspecting DOM
2008-10-31 5
What can do?
Browsers-compatible testing – one script, many browsers
Acceptance testing Regression testing
2008-10-31 6
Behind the scenes
Deploy BrowserBot alongside AUT Use JS and IFrame to embed BrowserBot Engine is tweaked to support wide range of
browsers on different OS
2008-10-31 7
Quick Demo
Access google.com Input keyword “selenium” Verify a link
2008-10-31 8
Script looks
Html table<table cellpadding="1" cellspacing="1" border="1"> <tr> <td>open</td><td>/</td><td></td> </tr> <tr> <td>type</td><td>q</td><td>selenium</td> </tr> <tr> <td>clickAndWait</td><td>btnG</td><td></td> </tr> <tr> <td>verifyTextPresent</td><td>selenium.openqa.org</td><td></td> </tr></table>
2008-10-31 9
Script model
Command Target Value
open /
type q selenium
clickAndWait btnG
verifyTextPresent selenium.openqa.org
2008-10-31 10
Action
open type click select clickAndWait
2008-10-31 11
VP
verifyXXX assertXXX For ajax use:
waitForXXX waitForCondition
2008-10-31 12
Locators
Identify elements via locators: id=id link=name dom=document.select[2] xpath=//input[@name=‘btn’] css=a[href=‘#id2’]
2008-10-31 13
String matching
glob:pattern * ?
regexp:pattern exact:string
2008-10-31 14
Playback
Run Walk Step
2008-10-31 15
Test Suite
Html table<table> <tr> <td>Test Suite</td> </tr> <tr> <td><a target="testFrame" href=“google.html">test G
oogle</a></td> </tr></table>
2008-10-31 16
Components
Core IDE RC Grid
2008-10-31 17
Selenium Core
Basis of Selenium IDE and RC Runs test suites on the same server to
avoid the Same Origin problem Don’t have same flexibility as RC, but tests
and code under test is in the same spot
2008-10-31 18
Selenium IDE
for quick recording of tests, but it somewhat lacks for power
2008-10-31 19
Selenium RC
Different langs binding Gives the ability to drive Selenium from a re
al programming language (Java, Perl, Python, Ruby, and more)
2008-10-31 20
Selenium Grid
extends Selenium RC to distribute your tests across multiple servers, saving you time by running tests in parallel.
2008-10-31 21
Browsers support
Browser IDE RC Core
FF 3 Y Y Y
FF 2 Y Y Y
IE 8b1 N/A ? ?
IE 7 N/A Y Y
Safari 3 N/A Y Y
Safari 2 N/A Y Y
Opera 9 N/A Y Y
Opera 8 N/A Y Y
Others N/A Partial
2008-10-31 22
OS Support
OS IDE RC Core
Windows works on FF 2+ Y Y
OS X works on FF 2+ Y Y
Linux works on FF 2+ Y Y
Solaris works on FF 2+ Y Y
Others works on FF 2+ Y Y
2008-10-31 23
Tips
Data-driven Dynamic pages(php, jsp) Record your script in S-IDE, then use it as a
base for a S-RC script Use Firebug to give you the XPath
2008-10-31 24
Extension
There are a lot of commands - you can even add your own custom commands into the user-extensions.js
2008-10-31 25
Problems encountered
Bug Tweak Not support native dialog
2008-10-31 26
Selenium vs. RFT
Development Deployment Platform/browsers support Maintainance Scope
Use right tool case by case
2008-10-31 27
Where to get?
http://selenium.openqa.org/