Download presentation
Presentation is loading. Please wait.
Published byBrittany Spencer Modified over 9 years ago
1
Introduction Selenium IDE is a Firefox extension that allows you to record, edit, and debug tests for HTML Easy record and playback Intelligent field selection Autocomplete for all common commands Walkthrough tests Debug and set breakpoints
2
Known Bugs Doesn’t save Base URL Fix: Enter base URL as the target in the initial open command Locks up a lot. Ex.) No base URL Fix: Close and reopen Doesn’t wait for pages to load Fix: Use pause command and wait for a while before attempting next step All addresses must be complete (including http://) otherwise it locks up
3
HTML Selenium saves all information in an HTML table format Command – Tells Selenium what to do using actions or assertions Ex.) type Target – Tells Selenium which HTML element a command refers to Ex.) textbox Value – Used for any command that might need a value of some kind Ex.) Hello
4
Command Actions Open Opens the target URL Click* Clicks on the target element Type* Enters the value specified by the value into the specified target element Select* Selects a drop-down value specified by the value in the specified target element
5
Command Actions SelectWindow Selects a popup window using the id specified by the target. If NULL, it returns to the main window GoBack Simulates user clicking back in the browser Close Simulates user clicking the close button of a popup window Pause Pauses the execution of a script for an amount of time in milliseconds specified in the target
6
Command Actions fireEvent Simulate an event to trigger the onevent handler where the target specifies the element and the value specifies the event waitForValue Waits for an input, specified by the target, to have a certain value, specified by the value (Warning: If event doesn’t occur, apply previous fix to stop running script) Store Stores the value specified by the target into the variable specified by the value
7
Command Actions StoreValue Stores the value of an input field, specified by the target, into a variable specified by the value storeText Stores the text of an element, specified by the target, into a variable specified by the value storeAttribute Stores the value of an element attribute into a variable
8
Command Actions chooseCancelOnNextConfirmation Instructs Selenium to select cancel on the next javascript dialog raised answerOnNextPrompt Instructs Selenium to return the specified target in response to the next prompt.
9
Wait Used when going to a new page
10
Assert Vs Verify Assert – Big deal Verify – if fail, continue
11
Advanced Selenium Selenium IDE is great for recording a few simple tests for small projects, but… Widen Enterprises Business based entirely on a collection of integrated web-based applications Over 2.5 million lines of code Over 30 tailored client-specific distributions
12
Advanced Selenium Selenium TestRunner Open source framework Write test classes that extend SeleniumBase Each class is a “suite” Write “setup” and “teardown” routines Override a function “order” to tell Selenium what functions are tests and what order they should be run in Write test functions!
13
Advanced Selenium More on TestRunner Compile tests using Ant task Go to application’s “/selenium” page http://.../selenium http://.../selenium Choose a test suite from the list
15
Advanced Selenium Advantages of TestRunner Can use constants for element values Can use supporting subroutines to simplify test running More intuitive than coding the HTML table! Disadvantages Requires some configuration of the web server In the end, all you’re getting is the HTML table Still no conditionals, while loops, etc.
16
Advanced Selenium Driven Mode Uses Ruby Highly-dynamic, interpreted programming language No static HTML Ruby code itself drives the test Conditionals! Can use “IF”, “WHILE”, and other logic in driving the test Results Generates “report” HTML files showing the status of all tests that were run
17
Advanced Selenium Problems with Driven Mode Only works with FireFox Configuration can be difficult Automatic, but not quite regression No easy way to kick off test suites overnight
18
Conclusion Web-based testing is hard! Web-applications are still fairly new Structure of HTML is far more free-flowing and dynamic than a regular app Limited software available Selenium is Free Well-supported Can tailor to your needs – offers versions that are quick and easy, highly-maintainable, or dynamic. If its good enough for a 2.5 mLOC project, it’s probably good enough for you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.