selenium intro part1 ide overview
Post on 17-Jun-2015
230 Views
Preview:
DESCRIPTION
TRANSCRIPT
IDE OverviewIDE Overview
Selenium Selenium HP Web Test Tool TrainingHP Web Test Tool Training
Mindq systemsMindq systems
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
22
Selenium Overview Selenium Overview
Selenium IDE Selenium IDE IntroductionIntroduction
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
What is Test Automation?What is Test Automation?
A process of writing a computer program A process of writing a computer program to do testing that would otherwise need to to do testing that would otherwise need to be done manuallybe done manually
Use of software to control the execution of Use of software to control the execution of teststests
Two types of test automation:Two types of test automation: Code-driven testingCode-driven testing Graphical user interface testingGraphical user interface testing
33www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Advantages of AutomationAdvantages of Automation Reliable: Tests perform precisely the same Tests perform precisely the same
operations each time they are run, thereby operations each time they are run, thereby eliminating human error. eliminating human error.
Repeatable: You can test how the software reacts You can test how the software reacts under repeated execution of the same operations. under repeated execution of the same operations.
Reusable: You can reuse tests on different You can reuse tests on different versions of an application, even if the user versions of an application, even if the user interface changes. interface changes.
Speed: Run tests significantly faster than human Run tests significantly faster than human users. users.
Cost Reduction: As the number of resources for As the number of resources for regression test are reduced. regression test are reduced.
Better Quality Software: Rapid feedback to Rapid feedback to developers during the development process as a developers during the development process as a result of frequent regression testing.result of frequent regression testing.
44www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Disadvantages of Disadvantages of AutomationAutomation
Proficiency is required to write the automation Proficiency is required to write the automation test script. test script.
Debugging the test script is major issue. If any Debugging the test script is major issue. If any error is present in the test script, sometimes it error is present in the test script, sometimes it may lead to dadly consequences. may lead to dadly consequences.
Test maintenance is costly in case of playback Test maintenance is costly in case of playback methods. Even though a minor changes occurs in methods. Even though a minor changes occurs in the GUI, the test script has to be rewritten. the GUI, the test script has to be rewritten.
Maintenance of test data files is difficult, if the Maintenance of test data files is difficult, if the test script tests more screens or web-pages. test script tests more screens or web-pages.
Short iteration or very tight deadline, there is not enough time to build test automation.
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
What is Selenium?What is Selenium?
A set of tools that supports rapid development of A set of tools that supports rapid development of
test automation for web-based applications.test automation for web-based applications.
Can be recorded and written as HTMLCan be recorded and written as HTML
Support for a number of programming languages: Support for a number of programming languages:
Java, C#, Perl, PHP, Python, RubyJava, C#, Perl, PHP, Python, Ruby
Cross browsers support: IE, Firefox, Opera, Safari Cross browsers support: IE, Firefox, Opera, Safari
and Google Chromeand Google Chrome
Cross platform support: Windows, Linux, and Cross platform support: Windows, Linux, and
Macintosh.Macintosh.
66www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Invented in 2004 by Jason R. Huggins and team.Invented in 2004 by Jason R. Huggins and team.
Originally named JavaScript Functional Tester Originally named JavaScript Functional Tester
[JSFT][JSFT]
100% Javascript and HTML100% Javascript and HTML
Designed to make test writing easyDesigned to make test writing easy
Open source browser based integration test Open source browser based integration test
framework built originally by ThoughtWorksframework built originally by ThoughtWorks
Selenium is open source software, released under Selenium is open source software, released under
the Apache 2.0 license and can be downloaded the Apache 2.0 license and can be downloaded
and used without charge. and used without charge.
Selenium BackgroundSelenium Background
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Selenium TriviaSelenium Trivia
88
Selenium is a chemical element with the atomic number 34, represented by the chemical symbol Se.
Selenium is used for treating Mercury poisoningProducts: QTP, WinRunner, LoadRunner and
TestDirector
Selenium
Mercury
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Selenium ComponentsSelenium Components
Selenium IDESelenium IDE
Selenium RC Selenium RC
Selenium Selenium GridGrid
Selenium2 Selenium2 aka aka WebdriverWebdriver
99
< < Selenium < < Selenium CoreCore
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Selenium IDESelenium IDE Selenium IDE (SIDE) is a complete Integrated Selenium IDE (SIDE) is a complete Integrated
Development Environment (IDE) for building Development Environment (IDE) for building Selenium test case.Selenium test case.
Firefox add-on that makes it easy to record, edit, Firefox add-on that makes it easy to record, edit, and debug tests. and debug tests.
Provides an easy-to-use interface for developing Provides an easy-to-use interface for developing and running individual test cases or entire test and running individual test cases or entire test suites.suites.
Can be used to generate code to run the tests Can be used to generate code to run the tests with Selenium Remote Control (RC). with Selenium Remote Control (RC).
1010www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Selenium IDE FeaturesSelenium IDE Features Record, playback, edit
Intelligent component identification will use object IDs, names, or XPath as needed
Auto complete for all common Selenium commands
Walk through test cases and test suites.
Debug and set breakpoints
Save tests as HTML, or export as other supported programming languages
Support for Selenium user extensions1111www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
1212
Installing Selenium IDEInstalling Selenium IDE
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Installing Selenium IDEInstalling Selenium IDE
1313
Two step process:
Step 1. Check if Firefox is installed
1a. If Firefox is not installed on your machine
then Install Firefox
(There is NO IE Version of Selenium)(There is NO IE Version of Selenium)
Step 2. Check if Selenium IDE is installed)
2a. If Selenium IDE is not installed on your
machine then Install Selenium IDE Plug In
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 1: Is Firefox Installed?Step 1: Is Firefox Installed?
Check whether your machine already has a Check whether your machine already has a version of Firefox installed.version of Firefox installed.
Go to Start Go to Start Programs Programs Mozilla Firefox Mozilla Firefox
1414www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 1: Check Firefox VersionStep 1: Check Firefox Version
Click on the Mozilla FirefoxClick on the Mozilla Firefox
Go to Help Go to Help About as shown below: About as shown below:
Check the version nameCheck the version name
What is your version?What is your version?
1515
Must be Firefox version 3.x.x.xx
not 4.x.x.xx
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 1a: Firefox InstallationStep 1a: Firefox Installation
Open your IE browser (or any other browser)Open your IE browser (or any other browser) Navigate to Firefox 3.6 download link.Navigate to Firefox 3.6 download link.http://www.oldapps.com/firefox.php?old_firefox=109?http://www.oldapps.com/firefox.php?old_firefox=109?
downloaddownload
WARNING!!!!!WARNING!!!!! Mozilla website will not have Mozilla website will not have Firefox 3.6 download link.Firefox 3.6 download link.
The most current browser version will be The most current browser version will be presented.presented.
(FF 4.0)(FF 4.0)
1616www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 1a: Firefox InstallationStep 1a: Firefox Installation
1717www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 1a: Firefox InstallationStep 1a: Firefox Installation Follow the steps and run the program (*1)Follow the steps and run the program (*1)
(Saving into local machine then running is (Saving into local machine then running is recommended)recommended)
If prompted with Security warning, press “Run” If prompted with Security warning, press “Run” button (*2 & *3)button (*2 & *3)
1818
*1
*2
*3
Save into your local machine. (C:\Downloads)
Run (double click Firefox Setup 3.x.x) from the location where you downloaded
Ignore Security warning and press “Run” button
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 1a: Firefox InstallationStep 1a: Firefox Installation Press Next (*1)Press Next (*1) Check the “I Accept” then Press Next (*2)Check the “I Accept” then Press Next (*2) Select Standard, Remove check from “Use Firefox Select Standard, Remove check from “Use Firefox
as my default browser” (*3)as my default browser” (*3) Press Install button (*4)Press Install button (*4) Press Finish button (*5)Press Finish button (*5)
1919
*1*2 *3
*4
*5
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 2: Is Selenium IDE Installed?Step 2: Is Selenium IDE Installed? Open the Firefox browser window (*1)Open the Firefox browser window (*1) Go to Tools Go to Tools Check whether Selenium IDE Check whether Selenium IDE
already exist there (*2)already exist there (*2) If you see “Selenium IDE” then you already If you see “Selenium IDE” then you already
having Selenium IDE plug-in installed in Firefox having Selenium IDE plug-in installed in Firefox browser.browser.
If not installed then follow the instruction on the If not installed then follow the instruction on the next slidenext slide
2020
*1 *2
Check whether Selenium IDE is already installed
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 2a: Installing Selenium IDEStep 2a: Installing Selenium IDE Open the Firefox browser windowOpen the Firefox browser window In the navigation tool bar type the below URL:In the navigation tool bar type the below URL:
http://seleniumhq.org/download/ Click the Download link next to Selenium IDE Click the Download link next to Selenium IDE
project name.project name.
2121
Don’t do this in IE
Click Download
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 2a: Installing Selenium IDEStep 2a: Installing Selenium IDE
2222
Or you can find Selenium IDE downloads in Previous Releases directory:
1. Previous Releases
2. Selenium IDE
3. Version 1.0.10
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 2a: Installing Selenium IDEStep 2a: Installing Selenium IDE When the Software Installation Window opens When the Software Installation Window opens
select “selenium-ide” (*1)select “selenium-ide” (*1) Click Install Now buttonClick Install Now button ““Selenium IDE” add-on is installed (*2)Selenium IDE” add-on is installed (*2) Click on “Restart Firefox” buttonClick on “Restart Firefox” button
2323
*1 *2
Restart Firefox for Selenium Plug-in to
take effect
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Step 2a: Installing Selenium IDEStep 2a: Installing Selenium IDE
In the Firefox browser go to Tools and verify In the Firefox browser go to Tools and verify whether “Selenium IDE” is displayed.whether “Selenium IDE” is displayed.
Congratulation!
Selenium IDE installation is completed.Selenium IDE installation is completed.
2424
Selenium IDE is successfully installed
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
2525
Recording and Running Recording and Running
Selenium TestsSelenium Tests
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Test Case #1: LoginTest Case #1: Login
Test-Case Objective:
Ensure Valid User Login
Expected Result:Expected Result:
1.OrangeHRM index page is loaded
2.Correct username is displayed as part of the greeting.
“Welcome Admin” 2626
Steps :1. In the login textbox
type “admin”. 2. In the password
textbox type “password”.
3. Click “Submit” button
4. Verify that a correct user name is displayed
5. Log outwww.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Test Script #1: LoginTest Script #1: LoginTest Script Steps:Test Script Steps:
Open OrangeHRM application in FirefoxOpen OrangeHRM application in Firefox
http://hrm.portnov.comortnov.com Login using :Login using :
Login Name: adminLogin Name: admin
Password: passwordPassword: password Click Login buttonClick Login button Highlight “Welcome Admin” text Highlight “Welcome Admin” text Right-click and select VerifyTextPresent Right-click and select VerifyTextPresent Click logout linkClick logout link
2727www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Recording An Automated Recording An Automated TestTest
1.1. Open OrangeHRM application in FirefoxOpen OrangeHRM application in Firefox
http://hrm.portnov.com (*1)(*1)
2.2. Open Selenium IDE in Firefox Open Selenium IDE in Firefox
Go to Tools Go to Tools Selenium IDE (*2) Selenium IDE (*2)
2828
*2*1
The Record button is ON by
default
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Login TestLogin Test Make sure Record button is ON!Make sure Record button is ON! Go to the Browser windowGo to the Browser window Login using (*2):Login using (*2):
Login Name: adminLogin Name: admin
Password: passwordPassword: password Click Login buttonClick Login button
2929
*1
*2
The Record button is ON by default
Login Name: adminPassword: passwordThen click Login button
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Login TestLogin Test Highlight “Welcome Admin” text (*1)Highlight “Welcome Admin” text (*1) Right-click and select Right-click and select VerifyTextPresentVerifyTextPresent (*2)(*2) Click logout linkClick logout link
3030
*1
*2
Highlight “Welcome demo”
Select VerifyTextPresent
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Stop RecordingStop RecordingGo to Selenium IDEGo to Selenium IDE
Click the red button to STOP recordingClick the red button to STOP recording
All your actions are recorded and displayed All your actions are recorded and displayed sequentially under Command Table Tabsequentially under Command Table Tab
3131
Click here to Stop recording
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
What did we accomplish?What did we accomplish?
Manual Test-Case
Test-Case ObjectiveTest-Case Objective Ensure Valid User LoginEnsure Valid User Login
Steps Steps In the login textbox type In the login textbox type
admin. admin. In the password textbox In the password textbox
type password. type password. Click Submit buttonClick Submit button Verify that a correct user Verify that a correct user
name is displayedname is displayed LogoutLogoutExpected ResultExpected Result1)1)OrangeHRM index page is OrangeHRM index page is
loadedloaded2)2)Correct username is Correct username is
displayed as part of the displayed as part of the greeting.greeting.““Welcome Admin”Welcome Admin”
Automated Test-Case3232
We created our first automated test scriptWe created our first automated test script
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Running Selenium Automated Running Selenium Automated TestTest
Make sure the Firefox browser is still openMake sure the Firefox browser is still open
Go to Selenium IDE and click Go to Selenium IDE and click ““Play current test case”” button button
3333
*1 *2
Click to play the Test Case
Make the test case playback in slow
mode
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Interpreting ColorsInterpreting Colors
If you see all the command line rows turn If you see all the command line rows turn GreenGreen color, then the test has passed. color, then the test has passed.
Light Green means the code executed without Light Green means the code executed without problems.problems.
Dark GreenDark Green means the test result of the means the test result of the command evaluated to command evaluated to truetrue..
If any part of the test failed it will be shown with If any part of the test failed it will be shown with RedRed color.color.
3434www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
DebuggingDebugging
Examine the result of the script.Examine the result of the script.
3535
Time is needed to validate the login Time is needed to validate the login information…information…
The test must The test must WAITWAIT for the next web page to for the next web page to load before proceeding.load before proceeding.
What went wrong?
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Debugging TipsDebugging Tips
Open Selenium IDE through Tools menu, Open Selenium IDE through Tools menu, otherwise the IDE may freeze and act otherwise the IDE may freeze and act unpredictably.unpredictably.
Make sure you substitute click command Make sure you substitute click command with clickAndWait command wherever with clickAndWait command wherever needed.needed.
3636www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
EditingEditingEditing Editing to add wait timeto add wait time to the scriptto the script
1.1. Click the 3rd to last row where Click the 3rd to last row where ClickAClickA command is locatedcommand is located
2.2. Modify the command fieldModify the command field Replace “click” with Replace “click” with “clickAndWait”“clickAndWait”
commandcommand
3.3. Re-play the test…Re-play the test…
3737
Click this row
Select clickAndWait command
www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
Helpful Notes:Helpful Notes:
One Firefox browser window must be open.One Firefox browser window must be open.
Multiple browser windows will confuse Selenium.Multiple browser windows will confuse Selenium.
Play back every automated test to ensure Play back every automated test to ensure
expected behavior.expected behavior.
Keep playback in Keep playback in slowslow mode when debugging.mode when debugging.
Placing Browser window and Selenium IDE Placing Browser window and Selenium IDE
windows side by side is a convenient way of windows side by side is a convenient way of
tracking test execution step by step.tracking test execution step by step.
3838www.Seleniumonlinetraining.infowww.Seleniumonlinetraining.info
top related