 JavaScript framework that runs in your
web-browser
 Works anywhere JavaScript is supported
 Hooks for many other langu...
 Supports Cross Browser Testing. The Selenium
tests can be run on multiple browsers.
 Allows scripting in several langua...
 You can use Selenium-Core and
customize everything
 But it is easier to just get a Firefox plug-in
“Selenium-IDE” that ...
 Selenium IDE
 Selenium Remote Control
 Selenium Grid
 Selenium IDE is an integrated development environment for
Selenium tests.
 It is implemented as a Firefox extension, an...
 Using Firefox, first, download the IDE from the
SeleniumHQ downloads page When downloading from
Firefox, you’ll be prese...
Window A Window B
To run the Selenium-IDE, simply select it from the Firefox Tools menu. It opens as
follows with an empty...
The root of
web
application you
want to test
The list of
actions in the
actual test
case to
execute
The log of the
events ...
Execution
Commands
Try the test in
the Web based
TestRunner
Reference of the
currently selected
command
Record test
action...
Selenium Options allow you to
Set The Text Encoding Format
Set the Default Page Time Out
Set The Base URL recording opt...
 Create test case to log into the gallery
 Create test case to log out of the gallery
Start Pixory
Connect to the Server
Go to the Login Screen
Hit the Record Button
Type in Username and Password IDE should update
Hit submit
Hit record
again to
stop
Add assertTextPresent and
type the text to search for
Hit play to make sure your
test is successful
 A Test Suite in
Selenium is just
an HTML file
that contains a
table of links to
tests
<html>
<head>
<meta content="text/...
 Selenium Core is a collection of JavaScript
and HTML with iFrames
 Due to security concerns Core must be
deployed withi...
 We basically want to execute the test suite
using the Selenium IDE plug-in
TestRunner.html
chrome://selenium-
ide/conten...
Application
being tested
Test Cases
Steps of
the test
case
Execution
Control
Run All Tests
Run Selected
Test
Pause/Pla
y
Execution
Step
through
Execution
Control Speed
of Execution
Highlight
Elements...
 Execute Tests created inside the Firefox
TestRunner
 Open Firefox that has the IDE installed
 Open the base URL of the application to
record.
 Keep the application in a co...
 Make sure the application is in the common
base state.
 Click on the run button. Here you can also
control the speed of...
 In the Selenium IDE you
can create any number
of test cases and save
them as test suite.
 To Run the test Suite
click o...
 Test Runner allows you to run the test case in a browser
loaded with the Selenium-Core TestRunner.
 Test runner is invo...
Softsmith Infotech
Click this button to run all the tests
 Run a Test Case
 Click the Run button to run the currently displayed test case.
 Run a Test Suite
 Click the Run All ...
 Start from the Middle
 You can tell the IDE to begin running from a
specific command in the middle of the test case. Th...
 Selenese allows multiple ways of checking for
UI elements.
 Verifications and assertions are used to check if
an eleme...
verifyTextPresent
This command is used to
check if a particular text is
present in a page or not.
To add this command ,
...
verifyTitle
 This command is used to
check if the page title is
correct or not.
 To add this command ,
While recording t...
verifyElementPresent
 This command is used to
verify if a page element is
present in the page or not.
 To add this comma...
verifyValue
 This method is used to check
if edit box has particular
value or if the check box is
on. Basically this meth...
 Assertions are same as Verifications. The
only difference is, if the assertions fail the
script will abort. But the scri...
 assertTextPresent
This will assert if the text is present in the page.
 assertText
This will assert if a particular ele...
waitForPageToLoad
This command will make the script to wait till the page
loads.
Syntax is waitForPageToLoad(timeout); T...
 waitForAlert
This command will wait for the alert message to appear
 waitForTable
This command will wait for the Web ta...
 Store command are used to fetch the values
from the application and store it in a variable.
These variables can be used ...
 Echo command is
used to print the
value in to the
selenium IDS log.
 When printing a
variable use ${var}
 There are so...
 Can run the test only on Firefox
 No Programming login (like loops, conditional
statements) can be applied
 Selenium I...
Selenium
Selenium
Selenium
Upcoming SlideShare
Loading in...5
×

Selenium

963

Published on

Published in: Technology, Design
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
963
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Selenium

  1. 1.  JavaScript framework that runs in your web-browser  Works anywhere JavaScript is supported  Hooks for many other languages  Java, Ruby, Python  Can simulate a user navigating through pages and then assert for specific marks on the pages  All you need to really know is HTML to start using it right away
  2. 2.  Supports Cross Browser Testing. The Selenium tests can be run on multiple browsers.  Allows scripting in several languages like Java, C#, PHP and Python.  Assertion statements provide an efficient way of comparing expected and actual results.  Inbuilt reporting mechanism.
  3. 3.  You can use Selenium-Core and customize everything  But it is easier to just get a Firefox plug-in “Selenium-IDE” that helps you “record” test cases  You can record how an app is being used and then play back those recordings followed by asserts  Get everything at: www.openqa.org/selenium/
  4. 4.  Selenium IDE  Selenium Remote Control  Selenium Grid
  5. 5.  Selenium IDE is an integrated development environment for Selenium tests.  It is implemented as a Firefox extension, and allows you to record, edit, and replay the test in Firefox  Selenium IDE allows you to save tests as HTML, Java, Ruby scripts, or any other format  It allows you to automatically add assertions to all the pages.  Allows you to add selenese commands as and when required
  6. 6.  Using Firefox, first, download the IDE from the SeleniumHQ downloads page When downloading from Firefox, you’ll be presented with the Window A. (See Next Slide)  Select Install Now. The Firefox Add-ons window pops up, first showing a progress bar, and when the download is complete, displays the Window B. (See Next Slide)  Restart Firefox. After Firefox reboots you will find the Selenium-IDE listed under the Firefox Tools menu.
  7. 7. Window A Window B To run the Selenium-IDE, simply select it from the Firefox Tools menu. It opens as follows with an empty script-editing window and a menu for loading, or creating new test cases. (See Next Slide)
  8. 8. The root of web application you want to test The list of actions in the actual test case to execute The log of the events that were executed, including any errors or warning that may have occurred
  9. 9. Execution Commands Try the test in the Web based TestRunner Reference of the currently selected command Record test actions Specify commands, including asserts
  10. 10. Selenium Options allow you to Set The Text Encoding Format Set the Default Page Time Out Set The Base URL recording option Adding Selenium Core and IDE Extension Add Automatic Page Title Assertions There are also other options under development
  11. 11.  Create test case to log into the gallery  Create test case to log out of the gallery
  12. 12. Start Pixory Connect to the Server Go to the Login Screen Hit the Record Button
  13. 13. Type in Username and Password IDE should update Hit submit Hit record again to stop
  14. 14. Add assertTextPresent and type the text to search for Hit play to make sure your test is successful
  15. 15.  A Test Suite in Selenium is just an HTML file that contains a table of links to tests <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Demo Test Suite</title> </head> <body> <table id="suiteTable"> <tbody> <tr><td> <b>Demo Test Suite</b> </td></tr> <tr><td> <a href="./testLogin.html">TestLogin</a> </td></tr> <tr><td> <a href="./testLogout.html">Test Logout</a> </td></tr> </tbody> </table> </body> </html>
  16. 16.  Selenium Core is a collection of JavaScript and HTML with iFrames  Due to security concerns Core must be deployed within the same server as the application being hosted  The simplest way to run Pixory is to just run the Java application and let it use its own server  Problems using Core with Pixory  Selenium IDE is a plug-in for Firefox and thus can go around these restrictions
  17. 17.  We basically want to execute the test suite using the Selenium IDE plug-in TestRunner.html chrome://selenium- ide/content/selenium/TestRunner.html?baseURL=<BASE>&tes t=file:///<TEST SUITE FILE>&auto=true chrome://selenium- ide/content/selenium/TestRunner.html?baseURL=http://loc alhost:8081&test=file:///Users/ms333/projects/classes/r unning/v_and_v/hw3/selenium/test/TestSuite.html&auto=tr ue
  18. 18. Application being tested Test Cases Steps of the test case Execution Control
  19. 19. Run All Tests Run Selected Test Pause/Pla y Execution Step through Execution Control Speed of Execution Highlight Elements in the Execution View the DOM of the current Page being tested Summary of the Test View the log of the current execution
  20. 20.  Execute Tests created inside the Firefox TestRunner
  21. 21.  Open Firefox that has the IDE installed  Open the base URL of the application to record.  Keep the application in a common base state.  Go To Tools  Selenium IDE and the IDE will be opened  Now perform the operations on the application as you are testing the application.  Once you are done with the recording click on the stop recording button and save the test case through the file menu. By default it will be saved as a selenese script (HTML format)
  22. 22.  Make sure the application is in the common base state.  Click on the run button. Here you can also control the speed of the execution using the toolbar  Once the test is run you can view the test log in the bottom of the IDE window
  23. 23.  In the Selenium IDE you can create any number of test cases and save them as test suite.  To Run the test Suite click on the “Play entire test suite” button as shown below. Test Suite with Test1 & test2
  24. 24.  Test Runner allows you to run the test case in a browser loaded with the Selenium-Core TestRunner.  Test runner is invoked by clicking the below Shown button in the IDE On Clicking the Test Runner Button you will the window as seen in the next slide
  25. 25. Softsmith Infotech Click this button to run all the tests
  26. 26.  Run a Test Case  Click the Run button to run the currently displayed test case.  Run a Test Suite  Click the Run All button to run all the test cases in the currently loaded test suite.  Stop and Start  The Pause button can be used to stop the test case while it is running. The icon of this button then changes to indicate the Resume button. To continue click Resume.  Stop in the Middle  You can set a breakpoint in the test case to cause it to stop on a particular command. This is useful for debugging your test case. To set a breakpoint, select a command, right-click, and from the context menu select Toggle Breakpoint.
  27. 27.  Start from the Middle  You can tell the IDE to begin running from a specific command in the middle of the test case. This also is used for debugging. To set a start point, select a command, right-click, and from the context menu select Set/Clear Start Point.  Run Any Single Command  Double-click any single command to run it by itself. This is useful when writing a single command. It lets you immediately test a command you are constructing, when you are not sure if it is correct. You can double-click it to see if it runs correctly. This is also available from the context menu.
  28. 28.  Selenese allows multiple ways of checking for UI elements.  Verifications and assertions are used to check if an element is present somewhere on the page? specific text is somewhere on the page? specific text is at a specific location on the page?  Verifications and assertions are not one and the same.  If an assertion fails, the script will be aborted but if a verification fails the script will continue.
  29. 29. verifyTextPresent This command is used to check if a particular text is present in a page or not. To add this command , While recording the test steps right click on the text item that you want verify. Once right clicked you can find an option “Show all commands”. On Clicking it you will find an option “verifyTextPresent”, select it
  30. 30. verifyTitle  This command is used to check if the page title is correct or not.  To add this command , While recording the test steps right click any where on the page that you want verify. Once right clicked you can find an option “Show all commands”. On Clicking it you will find an option “verifyTitle”, select it
  31. 31. verifyElementPresent  This command is used to verify if a page element is present in the page or not.  To add this command , While recording the test steps right click any element on the page that you want verify. Once right clicked you can find an option “Show all commands”. On Clicking it you will find an option “verifyElementPresent”, select it
  32. 32. verifyValue  This method is used to check if edit box has particular value or if the check box is on. Basically this method returns the value of present in the object.  To add this command , While recording the test steps right click any element on the page that you want verify the value of. Once right clicked you can find an option “Show all commands”. On Clicking it you will find an option “verifyValue”, select it.
  33. 33.  Assertions are same as Verifications. The only difference is, if the assertions fail the script will abort. But the script will continue run in case a verification point fails.  The steps for inserting the assertions is same as that of verification point.  While recording Right Click  Show all commands  select an assertion.
  34. 34.  assertTextPresent This will assert if the text is present in the page.  assertText This will assert if a particular element is having the particular text.  assertTitle This will assert if the page is having a proper title.  assertValue This will assert if a Text box or check box has a particular value  assertElementPresent This will assert if a particular UI Element is present in the page.
  35. 35. waitForPageToLoad This command will make the script to wait till the page loads. Syntax is waitForPageToLoad(timeout); Time out is the maximum time the script will wait for the page to load.
  36. 36.  waitForAlert This command will wait for the alert message to appear  waitForTable This command will wait for the Web table to completely load in the page  waitForTitle This command will for the page Title to appear on the browser.  Other waitFor commands Selenium has several other wait command like waitForText, waitForPopup and so on. These commands are generically called Synchronization commands
  37. 37.  Store command are used to fetch the values from the application and store it in a variable. These variables can be used latter for validation purpose.  The Store command can be used to retrieve the page title, text from the page and other attributes from the application.
  38. 38.  Echo command is used to print the value in to the selenium IDS log.  When printing a variable use ${var}  There are some limitations for this methods this has to be used with caution
  39. 39.  Can run the test only on Firefox  No Programming login (like loops, conditional statements) can be applied  Selenium IDE can execute scripts created in Selenese only.  It is difficult to use Selenium IDE for checking complex test cases involving dynamic contents
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×