SlideShare ist ein Scribd-Unternehmen logo
1 von 64
© 2010 LogiGear Corporation. All Rights Reserved
Selenium Outline
For LCTPII
Hieu Pham – Dung Huynh – Tuan Tran
© 2010 LogiGear Corporation. All Rights Reserved
• Introduction to Selenium
• Introduction to Selenium IDE
• Introduction to Selenium RC
• How Selenium works
• How to install Selenium IDE
• Using Selenium IDE
• Create and Run a test in Selenium IDE
• Useful Tools in Selenium IDE
• Introduction to TestNG framework
• Introduction to OOP in Java
• How to setup TestNG in Eclipse IDE
• Creating a simple test in TestNG
• Running a test in TestNG
• Data-driven test in TestNG
Outline of Sections
© 2010 LogiGear Corporation. All Rights Reserved
Selenium Overview
Selenium is a suite of tools to automate
web-app testing across many platforms.
• Selenium can work on any Javascript
supported browsers.
• Selenium can be controlled by many
programming languages and testing
frameworks.
• Selenium can simulate a user navigating
through pages and then assert for specific
marks on the pages
© 2010 LogiGear Corporation. All Rights Reserved
Selenium Features
• Tests run directly in browser
• Support multiple browsers
• Intelligent field selection by using IDs, Names, XPath,
Dom, CSS,…
• Easy to convert to many formats (HTML, Java, C#,…)
• Can be used for unit-testing, regression testing, smoke-
testing, integration and acceptance testing.
• Since Selenium is an Open Source tool, there are no
Licensing costs and can be customized as per user
request
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to Selenium IDE
What is the Selenium IDE ?
(Integrated Development Environment)
• Selenium IDE is an integrated development
environment for Selenium scripts.
• It is implemented as a Firefox extension, and
allows you to record, edit, and debug tests.
• Selenium IDE includes the entire Selenium
Core, allowing you to easily and quickly record
and play back tests in the actual environment that
they will run.
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to Selenium RC
What is Selenium Remote
Control (RC)?
• Selenium RC is a client/server system
that allows you to control web browsers
locally or on other computers, using
almost any programming language and
testing framework.
• A server which automatically launches
and kills browsers, and acts as a HTTP
proxy for web requests from them.
• Client libraries for your favorite
computer language.
• Selenium Core is the original
Javascript-based testing system.
© 2010 LogiGear Corporation. All Rights Reserved
How Selenium Works
• Using Selenium IDE to record
test script, then export to
appropriate programming
languages
• Edit test script on Programming
IDE (Ex: Eclipse)
• Using Selenium RC to run test
script on Browsers (Firefox, IE,
Chrome, Safari,…)
• Selenium Grid extends
Selenium RC to distribute your
tests across multiple servers,
saving you time by running tests
in parallel
© 2010 LogiGear Corporation. All Rights Reserved
How to install the Selenium IDE
• Go to Selenium download page,
find and install the latest selenium
IDE extension for Firefox
http://seleniumhq.org/download/
• Select Install Now. The Firefox Add-
ons window pops up, first showing a
progress bar, and when the
download is complete, displays the
following windows.
© 2010 LogiGear Corporation. All Rights Reserved
How to install the Selenium IDE
• Restart Firefox. After Firefox reboots you will find the Selenium-IDE
listed under the Firefox Tools menu
© 2010 LogiGear Corporation. All Rights Reserved
How to install the Selenium IDE
• Opening the IDE
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.
• What is needed machine wise to
setup the tool ?
– Firefox 2.0 +
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
• Menu:
 The Options menu
allows the changing of
settings.
 The Help menu is the
standard Firefox Help
menu; only one item
on this menu–UI-
Element
Documentation–
pertains to Selenium-
IDE.
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
- Toolbar:
The toolbar contains
buttons for controlling
the execution of your
test cases, including a
step feature for
debugging your test
cases. The right-most
button, the one with
the red-dot, is the
record button.
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
- Toolbar(cont.) :
 Apply Rollup Rules: This advanced feature allows repetitive
sequences of Selenium commands to be grouped into a single action.
 Record: Records the user’s browser actions. Record: Records the
user’s browser actions.
 Step: Allows you to “step” through a test case by running it one
command at a time. Use for debugging test cases.
Record: Records the user’s browser actions.
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
• Test case Pane:
– Your script is displayed in the test case pane. It has
two tabs, one for displaying the command and their
parameters in a readable “table” format.
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
• The Command, Target, and Value entry fields display the currently
selected command along with its parameters
• If you start typing in the Command field, a drop-down list will be
populated based on the first characters you type; you can then
select your desired command from the drop-down.
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
• Some popular Selenium commands
Command Target Description
Open URL (Ex: http://www.google.com ) Navigate to a page
Click Control id Click on a control base on id
Type Textbox id Type onto a textbox base on id
verifyTextPresent String of text Check the existing of the text in the page
assertTitle String of text Check the title of the page
Select Id of dropdown, select value Select an item in a drop down list
Check / Uncheck Check box id Check or Uncheck an check box base on id
waitForElementPresent Element id Test case will stop and only continue when
element present in the page
chooseOkOnNextConfi
rmation/
chooseCancelOnNextC
onfirmation
Choose OK/ Cancel when a confirmation
prompts appear
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
• Log/Reference/UI-Element/Rollup Pane
 Log: When you run your test case, error messages and
information messages showing the progress are displayed in
this pane automatically, even if you do not first select the Log
tab.
© 2010 LogiGear Corporation. All Rights Reserved
Using the Selenium IDE
• Log/Reference/UI-Element/Rollup Pane
 Reference: is the default selection whenever you are entering
or modifying Selenese commands and parameters in Table
mode. In Table mode, the Reference pane will display
documentation on the current command.
© 2010 LogiGear Corporation. All Rights Reserved
Creating a Test in Selenium IDE
• How to write test in Selenium IDE
– With using recorder:
 Open Selenium IDE in FireFox
© 2010 LogiGear Corporation. All Rights Reserved
Creating a Test in Selenium IDE
• How to write test in Selenium IDE
– With using recorder(cont.)
 Choose HTML format
Notes: Notice that the red button is pressed mean it’s ready to record test case
© 2010 LogiGear Corporation. All Rights Reserved
Creating a Test in Selenium IDE
• How to write test in Selenium
IDE
– With using recorder(cont.)
Here is an example test:
TC name: Verify the user can login to
yahoo mail successfully.
Steps:
1. Open new tab in FireFox and
navigate to Yahoo Mail
page(http://mail.yahoo.com )
2. Enter username and
password(example Username:
kimlgr1@yahoo.com , Password: logigear)
3. Click Sign In
Scripts will be generated in Selenium IDE
VP: Verify the main page is loaded
successfully.
© 2010 LogiGear Corporation. All Rights Reserved
Creating a Test in Selenium IDE
• How to write test in
Selenium IDE (cont.)
Guideline for verification:
 To verify that main page is
loaded successfully, we could
check for existing of Sign out
link.
 Right click Sign out link
 Choose Show all available
commands
 Choose verifyElementPresent
link = Sign Out
© 2010 LogiGear Corporation. All Rights Reserved
Running a Test in Selenium
• How to run a test?
• How to debug a test?
• Review results
• Exercise for Selenium
© 2010 LogiGear Corporation. All Rights Reserved
Running a Test in Selenium
• How to run a test?
The IDE allows many options for running your test
case.
 Run a Test: 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.
© 2010 LogiGear Corporation. All Rights Reserved
Running a Test in Selenium
• How to run a test? (cont.)
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.
Run Any Single Command: Double-click any single
command to run it by itself. This is useful when writing a
single command.
© 2010 LogiGear Corporation. All Rights Reserved
Running a Test in Selenium
• How to debug a test?
Debugging means finding and fixing errors in your test case.
This is a normal part of test case development.
o Breakpoints and Startpoints:
o To set a breakpoint, select a command, right-click, and from the context
menu select Toggle Breakpoint. Then click the Run button to run your test
case from the beginning up to the breakpoint
o To set a startpoint, select a command, right-click, and from the context
menu select Set/Clear Start Point. Then click the Run button to execute the
test case beginning at that startpoint.
© 2010 LogiGear Corporation. All Rights Reserved
Running a Test in Selenium
• How to debug a test?
o Stepping Through a Testcase:
To execute a test case one command at a time
(“step through” it), follow these steps:
Start the test case running with the Run button
from the toolbar.
Immediately pause the executing test case with
the Pause button.
Repeatedly select the Step button.
© 2010 LogiGear Corporation. All Rights Reserved
Running a Test in Selenium
• Review Results:
– After test run
successfully, we
can view report
result in Log panel
like as picture
© 2010 LogiGear Corporation. All Rights Reserved
Running a Test in Selenium
• Exercises for Selenium:
A simple exercise:
– Open http://www.google.com in Firefox
– Open Selenium IDE, Tools > Selenium IDE
– Make sure that Selenium is in recording mode
– Type in “LogiGear”
– On the search results verify that “LogiGear” is one of the search results on the
first page
– Save the test case as “Google_ide”
– Run the saved test case back again using the IDE
– View the results in the IDE
© 2010 LogiGear Corporation. All Rights Reserved
Exercise one
Search with Google:
 The recorded
steps in the pane.
 The result is in the
IDE
© 2010 LogiGear Corporation. All Rights Reserved
Locate by ID
Locate by Name
Locate by XPath
Locate by CSS
Locate by link Text
Locate by DOM
Locate Element in Selenium IDE
© 2010 LogiGear Corporation. All Rights Reserved
• Pattern table
• How to Use in Selenium IDE
Regular Expression in Selenium
Command Target Value
click link=regexp:Film.*Television Department
verifyTitle regexp:.*Film.*Television.*
PATTERN MATCH
. any single character
[ ] character class: any single character that appears inside the brackets
* quantifier: 0 or more of the preceding character (or group)
+ quantifier: 1 or more of the preceding character (or group)
? quantifier: 0 or 1 of the preceding character (or group)
{1,5} quantifier: 1 through 5 of the preceding character (or group)
| alternation: the character/group on the left or the character/group on the right
( ) grouping: often used with alternation and/or quantifier
© 2010 LogiGear Corporation. All Rights Reserved
Useful Tools for Selenium
• Useful tools for locating elements in Firefox
– Firebug (for locating element id, name)
– FirePath (for locating Xpath, CSS of an element)
© 2010 LogiGear Corporation. All Rights Reserved
Useful Tools for Selenium
• Tools are used with Selenium:
–Eclipse
–Cubic Test
–IntelliJ IDEA
–Python
–.Net
…
© 2010 LogiGear Corporation. All Rights Reserved
Useful Tools for Selenium
• Other programming languages are
available for Selenium:
Java: use either JUnit or TestNG as the test engine.
Some development environments like Eclipse have
direct support for these via plug-ins
C# : The .NET Client Driver works with
Microsoft.NET. It can be used with any .NET testing
framework like NUnit or the Visual Studio 2005 Team
System.
© 2010 LogiGear Corporation. All Rights Reserved
Useful Tools for Selenium
• Other programming languages are
available for Selenium:
Python: Py-unit is the test framework to use for
Python
Ruby: Selenium-IDE generates reasonable
Ruby, but requires the old Selenium gem.
© 2010 LogiGear Corporation. All Rights Reserved
Exercise two
• Using IDE and necessary tools to record and locate element using
Xpath, DOM, CSS
• Login Yahoo Mail using this account logigearmail@yahoo.com / logigear1
• Verify user is login success
• Logout of Yahoo Mail
• Verify user is logout success
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to OOP(*)(*)
in Java
What is an Object?
• An object is a software bundle of related state and behavior. Software
objects are often used to model the real-world objects that you find in
everyday life
(*) :
Object Oriented Programming
• Consider a bicycle, for example:
•Notes: For more information relate to Java statements, variables…please refer to
http://download.oracle.com/javase/tutorial/java/index.html
Method
(behavior)
Field
(state, property)
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to OOP in Java
What is a Class ?
• A class is a blueprint or prototype
from which objects are created
• In object-oriented terms, we say
that your bicycle is an instance of
the class of objects known as
bicycles
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to OOP in Java
What is Inheritance?
• Inheritance provides a powerful and natural mechanism for organizing
and structuring your software
• Object-oriented programming allows classes to inherit commonly used
state and behavior from other classes
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to OOP in Java
What is Interface?
• An interface is a contract between a class and the outside world. When
a class implements an interface, it promises to provide the behavior
published by that interface
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to OOP in Java
What is Package?
• A package is a namespace for organizing classes and interfaces in a
logical manner. Placing your code into packages makes large software
projects easier to manage
Use Import to use package
© 2010 LogiGear Corporation. All Rights Reserved
Introduction to TestNG
• TestNG is a testing framework inspired from JUnit and NUnit but introducing
some new functionalities that make it more powerful and easier to use
• TestNG is designed to cover all categories of tests: unit, functional, end-to-
end, integration, etc...
• TestNG features:
– Annotations.
–Run your tests in arbitrarily big thread pools with various policies available (all methods in
their own thread, one thread per test class, etc...).
–Test that your code is multithread safe.
–Flexible test configuration.
–Support for data-driven testing (with @DataProvider).
– Support for parameters.
– Powerful execution model (no more TestSuite).
– Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
– Embeds BeanShell for further flexibility.
–Default JDK functions for runtime and logging (no dependencies).
–Dependent methods for application server testing.
© 2010 LogiGear Corporation. All Rights Reserved
Setup TestNG in Selenium
• Download and install eclipse
IDE from
http://www.eclipse.org/downloa
ds/
• Run eclipse, Go to Help/ Install
New Software…
• Install TestNG by copy this url
into Work with textbox
http://beust.com/eclipse
• Check TestNG
• Click Next and do as the
instructions
© 2010 LogiGear Corporation. All Rights Reserved
Setup TestNG in Selenium
• Go to http://seleniumhq.org/download/ and download Selenium RC
• Extract the downloaded file.
© 2010 LogiGear Corporation. All Rights Reserved
Create Project
• Open Eclipse, Go to
File/New/Project to create new
project
• In New Project windows, choose
Java/ Java Project and click Next
© 2010 LogiGear Corporation. All Rights Reserved
Create Project
• Enter project name
• Choose Java Runtime Environment and click Next
© 2010 LogiGear Corporation. All Rights Reserved
Create Project
• In the New Java Project, click Add External
JARs…
• Choose path to Selenium RC folder and add
selenium-java-client-driver.jar and selenium-
server.jar
© 2010 LogiGear Corporation. All Rights Reserved
Add TestNG Library
• To add TestNG Library, navigate to eclipse /plugins /
org.testng.eclipse_5.14.3.20101203_1327/ and choose
eclipse-testng.jar
© 2010 LogiGear Corporation. All Rights Reserved
Configuration Report output folder
• Go to Window/ Preferences
• Change Output directory :
/Reports
• Apply and click OK
© 2010 LogiGear Corporation. All Rights Reserved
Create Package
• Right click “src” folder
• choose New/ Package
• Type name of the package
© 2010 LogiGear Corporation. All Rights Reserved
Project structure
• Create all package as the following
template
• BatchFiles: contain test suite file
testng.xml
• Database: contain data file in excel
format
• Functions: Contain java class of some
common functions
• Interfaces:
• TestCases: Contain the test case
• TestCases.[name]: the sub folder of the
package, contain the test cases relating
to a module.
© 2010 LogiGear Corporation. All Rights Reserved
Run Configuration
• Go to Run/ Run Configuration…
© 2010 LogiGear Corporation. All Rights Reserved
Run Configuration
• Browse for file and run
with below choices:
• Class: Run a Java Class
that contain one or more
methods
• Method: Run a single test
method
• Groups: Run a group of
test method
• Package: Run a Package
of Class
• Suite: Run testng.xml
file(Test Suite)
© 2010 LogiGear Corporation. All Rights Reserved
Exercise 1
• Setup Eclipse and install TestNG
• Open Selenium IDE and record a simple google search test
• Convert code into TestNG
• Create a TestNG Project in Eclipse follow the framework
• Copy created code in Selenium IDE into TestNG File
• Edit and Run the test
© 2010 LogiGear Corporation. All Rights Reserved
Exercise 2
• Login Gmail using logigearmail@gmail.com / logigear1
• Check for text present
• Logout Gmail
• Login Yahoo Mail using logigearmail@yahoo.com / logigear1
• Check for text present
• Logout Yahoo Mail
© 2010 LogiGear Corporation. All Rights Reserved
Data-driven testing with
Selenium and TestNG
• Download java excel Api from the following link
http://sourceforge.net/projects/jexcelapi/files/jexcelapi/
• Extract and add file jxl.jar into TestNG Project Library
© 2010 LogiGear Corporation. All Rights Reserved
Data-driven testing with
Selenium and TestNG
• Create a TestNG project in Eclipse follow the framework.
• We will start with a simple Login Yahoo using data provider
© 2010 LogiGear Corporation. All Rights Reserved
Data-driven testing with
Selenium and TestNG
• Create a excel file for example data.xls using this format and name of the sheet is
datapool
testdata username password
kimlgr1@yahoo.com logigear
logigearmail@yahoo.com logigear1
testdata
© 2010 LogiGear Corporation. All Rights Reserved
Data-driven testing with
Selenium and TestNG
• Use this code to read file
from excel file.
• Parameters
• xlFilePath: path to the
excel file, in the example
is “data.xls”
• sheetName: name of the
sheet, in the above
example is “datapool”
• tableName: name of the
data table, in the above
example is “testdata”
© 2010 LogiGear Corporation. All Rights Reserved
Data-driven testing with
Selenium and TestNG
• Write a DataProvider name DP1 and call the getTableArray function,
pass the parameter
• Edit the LoginYahoo method to receive the table data
Name of the data provider
Table column name
Pass parameters
© 2010 LogiGear Corporation. All Rights Reserved
Exercise 3 – Data Driven Test
• Let’s take our simple first example, but this time, instead of
having a static search string, we are going to go to multiple
sites and verify that the site is what comes up
• So, in this example, we need to create a spreadsheet or data
for the IDE
• In the spreadsheet, we will create four sites, yahoo, google,
msn, and ask
• The test will go to each site and verify an attribute on the
page that identifies it as the site – for example, we might use
the window tag as verification that we have gone to Yahoo,
or we can use different verification methods to insure that we
are at the right site
• The test will then loop through each of the data elements, go
to the site and then verify through verification the site
© 2010 LogiGear Corporation. All Rights Reserved
Exercise 4
• In this exercise we are going to do a couple of things
• The exercise should be a simple test, another google search for
example, but this time we are going to add active timing and look
at javascript
• The active timing should have two examples, one sleep and one
dynamic wait
• We want to record the script and then go inside the code to add
the timing, in the first example, we use a static sleep and in the
second exercise, we add a dynamic sleep.
• I believe the method is called either click or clickAndwait method,
one waits, while the other goes on
• The select command and click commands are some of the basic
building blocks for IDE, and we need to show in this exercise how
to use these but more importantly, we want to give the tester a
view into the code that is being generated by the recorder
• http://seleniumhq.org/docs/03_selenium_ide.html#building-test-
cases
© 2010 LogiGear Corporation. All Rights Reserved
The End
Thank you for your attention!
If you have any question/concern/unclear/suggest, please
contact to us:
o Hieu Pham : hieu.pham@logigear.com
o Dung Huynh : dung.huynh@yahoo.com
o Tuan Tran : tuan.quoc.tran@logigear.com

Weitere ähnliche Inhalte

Was ist angesagt?

Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questionsKuldeep Pawar
 
From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.David Aguilera
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersAjit Jadhav
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowRachid Kherrazi
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object patternMichael Palotas
 
Test Automation Framework Development Introduction
Test Automation Framework Development IntroductionTest Automation Framework Development Introduction
Test Automation Framework Development IntroductionGanuka Yashantha
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Lars Vogel
 
Software Testing & PHPSpec
Software Testing & PHPSpecSoftware Testing & PHPSpec
Software Testing & PHPSpecDarren Craig
 
AD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages AppsAD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages Appsbeglee
 
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Steven Smith
 
Sergey Pirogov "Test coverage myth busted"
Sergey Pirogov "Test coverage myth busted"Sergey Pirogov "Test coverage myth busted"
Sergey Pirogov "Test coverage myth busted"Fwdays
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorialprad_123
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated TestingLee Englestone
 

Was ist angesagt? (20)

Using Specflow for BDD
Using Specflow for BDDUsing Specflow for BDD
Using Specflow for BDD
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
 
From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
 
Testing In Java
Testing In JavaTesting In Java
Testing In Java
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlow
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object pattern
 
The Testing Planet - July 2010
The Testing Planet - July 2010The Testing Planet - July 2010
The Testing Planet - July 2010
 
Test Automation
Test Automation Test Automation
Test Automation
 
Test Automation Framework Development Introduction
Test Automation Framework Development IntroductionTest Automation Framework Development Introduction
Test Automation Framework Development Introduction
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4
 
Software Testing & PHPSpec
Software Testing & PHPSpecSoftware Testing & PHPSpec
Software Testing & PHPSpec
 
Automated Testing
Automated TestingAutomated Testing
Automated Testing
 
AD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages AppsAD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages Apps
 
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
 
Sergey Pirogov "Test coverage myth busted"
Sergey Pirogov "Test coverage myth busted"Sergey Pirogov "Test coverage myth busted"
Sergey Pirogov "Test coverage myth busted"
 
Selenium ide made easy
Selenium ide made easySelenium ide made easy
Selenium ide made easy
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorial
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated Testing
 

Andere mochten auch

Andere mochten auch (6)

Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Selenium ide
Selenium ide Selenium ide
Selenium ide
 

Ähnlich wie Selenium training

Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVAmahirayavarapu
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotInterview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotLearning Slot
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Aravindharamanan S
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)Wael Mansour
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsQUONTRASOLUTIONS
 
Selenium introduction and some feautures
Selenium introduction and some feauturesSelenium introduction and some feautures
Selenium introduction and some feautureszahid32
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotLearning Slot
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing ToolZeba Tahseen
 
GL_Web application testing using selenium
GL_Web application testing using seleniumGL_Web application testing using selenium
GL_Web application testing using seleniumPragya Rastogi
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin MishraPravin Mishra
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium Rohit Thakur
 
Selenium Installation
Selenium  InstallationSelenium  Installation
Selenium InstallationANKUR-BA
 

Ähnlich wie Selenium training (20)

Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVA
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotInterview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
 
Selenium
SeleniumSelenium
Selenium
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)
 
Selenium Topic 2 IDE
Selenium Topic 2 IDESelenium Topic 2 IDE
Selenium Topic 2 IDE
 
Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
 
Selenium introduction and some feautures
Selenium introduction and some feauturesSelenium introduction and some feautures
Selenium introduction and some feautures
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium
SeleniumSelenium
Selenium
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
 
Selenium
SeleniumSelenium
Selenium
 
Selenium training in chennai
Selenium training in chennaiSelenium training in chennai
Selenium training in chennai
 
Selenium Training in Chennai
Selenium Training in ChennaiSelenium Training in Chennai
Selenium Training in Chennai
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
GL_Web application testing using selenium
GL_Web application testing using seleniumGL_Web application testing using selenium
GL_Web application testing using selenium
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin Mishra
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium
 
Selenium Installation
Selenium  InstallationSelenium  Installation
Selenium Installation
 

Mehr von Robin0590

Python harness fundamental
Python harness fundamentalPython harness fundamental
Python harness fundamentalRobin0590
 
Python harness exercises
Python harness exercisesPython harness exercises
Python harness exercisesRobin0590
 
Declare and write your own ta action
Declare and write your own ta actionDeclare and write your own ta action
Declare and write your own ta actionRobin0590
 
Internationalization & localization testing
Internationalization & localization testingInternationalization & localization testing
Internationalization & localization testingRobin0590
 
Installation testing
Installation testingInstallation testing
Installation testingRobin0590
 
Configuration testing
Configuration testingConfiguration testing
Configuration testingRobin0590
 
Compatibility testing
Compatibility testingCompatibility testing
Compatibility testingRobin0590
 

Mehr von Robin0590 (7)

Python harness fundamental
Python harness fundamentalPython harness fundamental
Python harness fundamental
 
Python harness exercises
Python harness exercisesPython harness exercises
Python harness exercises
 
Declare and write your own ta action
Declare and write your own ta actionDeclare and write your own ta action
Declare and write your own ta action
 
Internationalization & localization testing
Internationalization & localization testingInternationalization & localization testing
Internationalization & localization testing
 
Installation testing
Installation testingInstallation testing
Installation testing
 
Configuration testing
Configuration testingConfiguration testing
Configuration testing
 
Compatibility testing
Compatibility testingCompatibility testing
Compatibility testing
 

Kürzlich hochgeladen

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 

Kürzlich hochgeladen (20)

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 

Selenium training

  • 1. © 2010 LogiGear Corporation. All Rights Reserved Selenium Outline For LCTPII Hieu Pham – Dung Huynh – Tuan Tran
  • 2. © 2010 LogiGear Corporation. All Rights Reserved • Introduction to Selenium • Introduction to Selenium IDE • Introduction to Selenium RC • How Selenium works • How to install Selenium IDE • Using Selenium IDE • Create and Run a test in Selenium IDE • Useful Tools in Selenium IDE • Introduction to TestNG framework • Introduction to OOP in Java • How to setup TestNG in Eclipse IDE • Creating a simple test in TestNG • Running a test in TestNG • Data-driven test in TestNG Outline of Sections
  • 3. © 2010 LogiGear Corporation. All Rights Reserved Selenium Overview Selenium is a suite of tools to automate web-app testing across many platforms. • Selenium can work on any Javascript supported browsers. • Selenium can be controlled by many programming languages and testing frameworks. • Selenium can simulate a user navigating through pages and then assert for specific marks on the pages
  • 4. © 2010 LogiGear Corporation. All Rights Reserved Selenium Features • Tests run directly in browser • Support multiple browsers • Intelligent field selection by using IDs, Names, XPath, Dom, CSS,… • Easy to convert to many formats (HTML, Java, C#,…) • Can be used for unit-testing, regression testing, smoke- testing, integration and acceptance testing. • Since Selenium is an Open Source tool, there are no Licensing costs and can be customized as per user request
  • 5. © 2010 LogiGear Corporation. All Rights Reserved Introduction to Selenium IDE What is the Selenium IDE ? (Integrated Development Environment) • Selenium IDE is an integrated development environment for Selenium scripts. • It is implemented as a Firefox extension, and allows you to record, edit, and debug tests. • Selenium IDE includes the entire Selenium Core, allowing you to easily and quickly record and play back tests in the actual environment that they will run.
  • 6. © 2010 LogiGear Corporation. All Rights Reserved Introduction to Selenium RC What is Selenium Remote Control (RC)? • Selenium RC is a client/server system that allows you to control web browsers locally or on other computers, using almost any programming language and testing framework. • A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. • Client libraries for your favorite computer language. • Selenium Core is the original Javascript-based testing system.
  • 7. © 2010 LogiGear Corporation. All Rights Reserved How Selenium Works • Using Selenium IDE to record test script, then export to appropriate programming languages • Edit test script on Programming IDE (Ex: Eclipse) • Using Selenium RC to run test script on Browsers (Firefox, IE, Chrome, Safari,…) • Selenium Grid extends Selenium RC to distribute your tests across multiple servers, saving you time by running tests in parallel
  • 8. © 2010 LogiGear Corporation. All Rights Reserved How to install the Selenium IDE • Go to Selenium download page, find and install the latest selenium IDE extension for Firefox http://seleniumhq.org/download/ • Select Install Now. The Firefox Add- ons window pops up, first showing a progress bar, and when the download is complete, displays the following windows.
  • 9. © 2010 LogiGear Corporation. All Rights Reserved How to install the Selenium IDE • Restart Firefox. After Firefox reboots you will find the Selenium-IDE listed under the Firefox Tools menu
  • 10. © 2010 LogiGear Corporation. All Rights Reserved How to install the Selenium IDE • Opening the IDE 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. • What is needed machine wise to setup the tool ? – Firefox 2.0 +
  • 11. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE • Menu:  The Options menu allows the changing of settings.  The Help menu is the standard Firefox Help menu; only one item on this menu–UI- Element Documentation– pertains to Selenium- IDE.
  • 12. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE - Toolbar: The toolbar contains buttons for controlling the execution of your test cases, including a step feature for debugging your test cases. The right-most button, the one with the red-dot, is the record button.
  • 13. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE - Toolbar(cont.) :  Apply Rollup Rules: This advanced feature allows repetitive sequences of Selenium commands to be grouped into a single action.  Record: Records the user’s browser actions. Record: Records the user’s browser actions.  Step: Allows you to “step” through a test case by running it one command at a time. Use for debugging test cases. Record: Records the user’s browser actions.
  • 14. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE • Test case Pane: – Your script is displayed in the test case pane. It has two tabs, one for displaying the command and their parameters in a readable “table” format.
  • 15. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE • The Command, Target, and Value entry fields display the currently selected command along with its parameters • If you start typing in the Command field, a drop-down list will be populated based on the first characters you type; you can then select your desired command from the drop-down.
  • 16. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE • Some popular Selenium commands Command Target Description Open URL (Ex: http://www.google.com ) Navigate to a page Click Control id Click on a control base on id Type Textbox id Type onto a textbox base on id verifyTextPresent String of text Check the existing of the text in the page assertTitle String of text Check the title of the page Select Id of dropdown, select value Select an item in a drop down list Check / Uncheck Check box id Check or Uncheck an check box base on id waitForElementPresent Element id Test case will stop and only continue when element present in the page chooseOkOnNextConfi rmation/ chooseCancelOnNextC onfirmation Choose OK/ Cancel when a confirmation prompts appear
  • 17. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE • Log/Reference/UI-Element/Rollup Pane  Log: When you run your test case, error messages and information messages showing the progress are displayed in this pane automatically, even if you do not first select the Log tab.
  • 18. © 2010 LogiGear Corporation. All Rights Reserved Using the Selenium IDE • Log/Reference/UI-Element/Rollup Pane  Reference: is the default selection whenever you are entering or modifying Selenese commands and parameters in Table mode. In Table mode, the Reference pane will display documentation on the current command.
  • 19. © 2010 LogiGear Corporation. All Rights Reserved Creating a Test in Selenium IDE • How to write test in Selenium IDE – With using recorder:  Open Selenium IDE in FireFox
  • 20. © 2010 LogiGear Corporation. All Rights Reserved Creating a Test in Selenium IDE • How to write test in Selenium IDE – With using recorder(cont.)  Choose HTML format Notes: Notice that the red button is pressed mean it’s ready to record test case
  • 21. © 2010 LogiGear Corporation. All Rights Reserved Creating a Test in Selenium IDE • How to write test in Selenium IDE – With using recorder(cont.) Here is an example test: TC name: Verify the user can login to yahoo mail successfully. Steps: 1. Open new tab in FireFox and navigate to Yahoo Mail page(http://mail.yahoo.com ) 2. Enter username and password(example Username: kimlgr1@yahoo.com , Password: logigear) 3. Click Sign In Scripts will be generated in Selenium IDE VP: Verify the main page is loaded successfully.
  • 22. © 2010 LogiGear Corporation. All Rights Reserved Creating a Test in Selenium IDE • How to write test in Selenium IDE (cont.) Guideline for verification:  To verify that main page is loaded successfully, we could check for existing of Sign out link.  Right click Sign out link  Choose Show all available commands  Choose verifyElementPresent link = Sign Out
  • 23. © 2010 LogiGear Corporation. All Rights Reserved Running a Test in Selenium • How to run a test? • How to debug a test? • Review results • Exercise for Selenium
  • 24. © 2010 LogiGear Corporation. All Rights Reserved Running a Test in Selenium • How to run a test? The IDE allows many options for running your test case.  Run a Test: 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.
  • 25. © 2010 LogiGear Corporation. All Rights Reserved Running a Test in Selenium • How to run a test? (cont.) 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. Run Any Single Command: Double-click any single command to run it by itself. This is useful when writing a single command.
  • 26. © 2010 LogiGear Corporation. All Rights Reserved Running a Test in Selenium • How to debug a test? Debugging means finding and fixing errors in your test case. This is a normal part of test case development. o Breakpoints and Startpoints: o To set a breakpoint, select a command, right-click, and from the context menu select Toggle Breakpoint. Then click the Run button to run your test case from the beginning up to the breakpoint o To set a startpoint, select a command, right-click, and from the context menu select Set/Clear Start Point. Then click the Run button to execute the test case beginning at that startpoint.
  • 27. © 2010 LogiGear Corporation. All Rights Reserved Running a Test in Selenium • How to debug a test? o Stepping Through a Testcase: To execute a test case one command at a time (“step through” it), follow these steps: Start the test case running with the Run button from the toolbar. Immediately pause the executing test case with the Pause button. Repeatedly select the Step button.
  • 28. © 2010 LogiGear Corporation. All Rights Reserved Running a Test in Selenium • Review Results: – After test run successfully, we can view report result in Log panel like as picture
  • 29. © 2010 LogiGear Corporation. All Rights Reserved Running a Test in Selenium • Exercises for Selenium: A simple exercise: – Open http://www.google.com in Firefox – Open Selenium IDE, Tools > Selenium IDE – Make sure that Selenium is in recording mode – Type in “LogiGear” – On the search results verify that “LogiGear” is one of the search results on the first page – Save the test case as “Google_ide” – Run the saved test case back again using the IDE – View the results in the IDE
  • 30. © 2010 LogiGear Corporation. All Rights Reserved Exercise one Search with Google:  The recorded steps in the pane.  The result is in the IDE
  • 31. © 2010 LogiGear Corporation. All Rights Reserved Locate by ID Locate by Name Locate by XPath Locate by CSS Locate by link Text Locate by DOM Locate Element in Selenium IDE
  • 32. © 2010 LogiGear Corporation. All Rights Reserved • Pattern table • How to Use in Selenium IDE Regular Expression in Selenium Command Target Value click link=regexp:Film.*Television Department verifyTitle regexp:.*Film.*Television.* PATTERN MATCH . any single character [ ] character class: any single character that appears inside the brackets * quantifier: 0 or more of the preceding character (or group) + quantifier: 1 or more of the preceding character (or group) ? quantifier: 0 or 1 of the preceding character (or group) {1,5} quantifier: 1 through 5 of the preceding character (or group) | alternation: the character/group on the left or the character/group on the right ( ) grouping: often used with alternation and/or quantifier
  • 33. © 2010 LogiGear Corporation. All Rights Reserved Useful Tools for Selenium • Useful tools for locating elements in Firefox – Firebug (for locating element id, name) – FirePath (for locating Xpath, CSS of an element)
  • 34. © 2010 LogiGear Corporation. All Rights Reserved Useful Tools for Selenium • Tools are used with Selenium: –Eclipse –Cubic Test –IntelliJ IDEA –Python –.Net …
  • 35. © 2010 LogiGear Corporation. All Rights Reserved Useful Tools for Selenium • Other programming languages are available for Selenium: Java: use either JUnit or TestNG as the test engine. Some development environments like Eclipse have direct support for these via plug-ins C# : The .NET Client Driver works with Microsoft.NET. It can be used with any .NET testing framework like NUnit or the Visual Studio 2005 Team System.
  • 36. © 2010 LogiGear Corporation. All Rights Reserved Useful Tools for Selenium • Other programming languages are available for Selenium: Python: Py-unit is the test framework to use for Python Ruby: Selenium-IDE generates reasonable Ruby, but requires the old Selenium gem.
  • 37. © 2010 LogiGear Corporation. All Rights Reserved Exercise two • Using IDE and necessary tools to record and locate element using Xpath, DOM, CSS • Login Yahoo Mail using this account logigearmail@yahoo.com / logigear1 • Verify user is login success • Logout of Yahoo Mail • Verify user is logout success
  • 38. © 2010 LogiGear Corporation. All Rights Reserved Introduction to OOP(*)(*) in Java What is an Object? • An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life (*) : Object Oriented Programming • Consider a bicycle, for example: •Notes: For more information relate to Java statements, variables…please refer to http://download.oracle.com/javase/tutorial/java/index.html Method (behavior) Field (state, property)
  • 39. © 2010 LogiGear Corporation. All Rights Reserved Introduction to OOP in Java What is a Class ? • A class is a blueprint or prototype from which objects are created • In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles
  • 40. © 2010 LogiGear Corporation. All Rights Reserved Introduction to OOP in Java What is Inheritance? • Inheritance provides a powerful and natural mechanism for organizing and structuring your software • Object-oriented programming allows classes to inherit commonly used state and behavior from other classes
  • 41. © 2010 LogiGear Corporation. All Rights Reserved Introduction to OOP in Java What is Interface? • An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior published by that interface
  • 42. © 2010 LogiGear Corporation. All Rights Reserved Introduction to OOP in Java What is Package? • A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage Use Import to use package
  • 43. © 2010 LogiGear Corporation. All Rights Reserved Introduction to TestNG • TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use • TestNG is designed to cover all categories of tests: unit, functional, end-to- end, integration, etc... • TestNG features: – Annotations. –Run your tests in arbitrarily big thread pools with various policies available (all methods in their own thread, one thread per test class, etc...). –Test that your code is multithread safe. –Flexible test configuration. –Support for data-driven testing (with @DataProvider). – Support for parameters. – Powerful execution model (no more TestSuite). – Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...). – Embeds BeanShell for further flexibility. –Default JDK functions for runtime and logging (no dependencies). –Dependent methods for application server testing.
  • 44. © 2010 LogiGear Corporation. All Rights Reserved Setup TestNG in Selenium • Download and install eclipse IDE from http://www.eclipse.org/downloa ds/ • Run eclipse, Go to Help/ Install New Software… • Install TestNG by copy this url into Work with textbox http://beust.com/eclipse • Check TestNG • Click Next and do as the instructions
  • 45. © 2010 LogiGear Corporation. All Rights Reserved Setup TestNG in Selenium • Go to http://seleniumhq.org/download/ and download Selenium RC • Extract the downloaded file.
  • 46. © 2010 LogiGear Corporation. All Rights Reserved Create Project • Open Eclipse, Go to File/New/Project to create new project • In New Project windows, choose Java/ Java Project and click Next
  • 47. © 2010 LogiGear Corporation. All Rights Reserved Create Project • Enter project name • Choose Java Runtime Environment and click Next
  • 48. © 2010 LogiGear Corporation. All Rights Reserved Create Project • In the New Java Project, click Add External JARs… • Choose path to Selenium RC folder and add selenium-java-client-driver.jar and selenium- server.jar
  • 49. © 2010 LogiGear Corporation. All Rights Reserved Add TestNG Library • To add TestNG Library, navigate to eclipse /plugins / org.testng.eclipse_5.14.3.20101203_1327/ and choose eclipse-testng.jar
  • 50. © 2010 LogiGear Corporation. All Rights Reserved Configuration Report output folder • Go to Window/ Preferences • Change Output directory : /Reports • Apply and click OK
  • 51. © 2010 LogiGear Corporation. All Rights Reserved Create Package • Right click “src” folder • choose New/ Package • Type name of the package
  • 52. © 2010 LogiGear Corporation. All Rights Reserved Project structure • Create all package as the following template • BatchFiles: contain test suite file testng.xml • Database: contain data file in excel format • Functions: Contain java class of some common functions • Interfaces: • TestCases: Contain the test case • TestCases.[name]: the sub folder of the package, contain the test cases relating to a module.
  • 53. © 2010 LogiGear Corporation. All Rights Reserved Run Configuration • Go to Run/ Run Configuration…
  • 54. © 2010 LogiGear Corporation. All Rights Reserved Run Configuration • Browse for file and run with below choices: • Class: Run a Java Class that contain one or more methods • Method: Run a single test method • Groups: Run a group of test method • Package: Run a Package of Class • Suite: Run testng.xml file(Test Suite)
  • 55. © 2010 LogiGear Corporation. All Rights Reserved Exercise 1 • Setup Eclipse and install TestNG • Open Selenium IDE and record a simple google search test • Convert code into TestNG • Create a TestNG Project in Eclipse follow the framework • Copy created code in Selenium IDE into TestNG File • Edit and Run the test
  • 56. © 2010 LogiGear Corporation. All Rights Reserved Exercise 2 • Login Gmail using logigearmail@gmail.com / logigear1 • Check for text present • Logout Gmail • Login Yahoo Mail using logigearmail@yahoo.com / logigear1 • Check for text present • Logout Yahoo Mail
  • 57. © 2010 LogiGear Corporation. All Rights Reserved Data-driven testing with Selenium and TestNG • Download java excel Api from the following link http://sourceforge.net/projects/jexcelapi/files/jexcelapi/ • Extract and add file jxl.jar into TestNG Project Library
  • 58. © 2010 LogiGear Corporation. All Rights Reserved Data-driven testing with Selenium and TestNG • Create a TestNG project in Eclipse follow the framework. • We will start with a simple Login Yahoo using data provider
  • 59. © 2010 LogiGear Corporation. All Rights Reserved Data-driven testing with Selenium and TestNG • Create a excel file for example data.xls using this format and name of the sheet is datapool testdata username password kimlgr1@yahoo.com logigear logigearmail@yahoo.com logigear1 testdata
  • 60. © 2010 LogiGear Corporation. All Rights Reserved Data-driven testing with Selenium and TestNG • Use this code to read file from excel file. • Parameters • xlFilePath: path to the excel file, in the example is “data.xls” • sheetName: name of the sheet, in the above example is “datapool” • tableName: name of the data table, in the above example is “testdata”
  • 61. © 2010 LogiGear Corporation. All Rights Reserved Data-driven testing with Selenium and TestNG • Write a DataProvider name DP1 and call the getTableArray function, pass the parameter • Edit the LoginYahoo method to receive the table data Name of the data provider Table column name Pass parameters
  • 62. © 2010 LogiGear Corporation. All Rights Reserved Exercise 3 – Data Driven Test • Let’s take our simple first example, but this time, instead of having a static search string, we are going to go to multiple sites and verify that the site is what comes up • So, in this example, we need to create a spreadsheet or data for the IDE • In the spreadsheet, we will create four sites, yahoo, google, msn, and ask • The test will go to each site and verify an attribute on the page that identifies it as the site – for example, we might use the window tag as verification that we have gone to Yahoo, or we can use different verification methods to insure that we are at the right site • The test will then loop through each of the data elements, go to the site and then verify through verification the site
  • 63. © 2010 LogiGear Corporation. All Rights Reserved Exercise 4 • In this exercise we are going to do a couple of things • The exercise should be a simple test, another google search for example, but this time we are going to add active timing and look at javascript • The active timing should have two examples, one sleep and one dynamic wait • We want to record the script and then go inside the code to add the timing, in the first example, we use a static sleep and in the second exercise, we add a dynamic sleep. • I believe the method is called either click or clickAndwait method, one waits, while the other goes on • The select command and click commands are some of the basic building blocks for IDE, and we need to show in this exercise how to use these but more importantly, we want to give the tester a view into the code that is being generated by the recorder • http://seleniumhq.org/docs/03_selenium_ide.html#building-test- cases
  • 64. © 2010 LogiGear Corporation. All Rights Reserved The End Thank you for your attention! If you have any question/concern/unclear/suggest, please contact to us: o Hieu Pham : hieu.pham@logigear.com o Dung Huynh : dung.huynh@yahoo.com o Tuan Tran : tuan.quoc.tran@logigear.com

Hinweis der Redaktion

  1. Browser support: Firefox 2, Firefox 3, IE 7, IE 8 , Safari 2, Safari 3, Opera 8, Opera 9 Programming language support: C#, Java, Perl, PHP, Python, Ruby Testing framework support: Bromine, JUnit, NUnit, RSpec (Ruby), Test::Unit (Ruby), TestNG (Java), unittest (Python), Robot Framework SeleniumLibrary From SeleniumHQ( December 2010) http://seleniumhq.org/
  2. Features: Easy record and playback Intelligent field selection will use IDs, names, or XPath as needed Autocomplete for all common Selenium commands Walk through tests Debug and set breakpoints Save tests as HTML, Ruby scripts, or any other format Support for Selenium user-extensions.js file Option to automatically assert the title of every page Easy customization through plugins
  3. Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This ability to use Selenium-RC with a high-level programming language to develop test cases also allows the automated testing to be integrated with a project’s automated build environment.
  4. Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests. You can even use it generate code to run the tests with Selenium Remote Control. Limitations o Browser (Firefox Only) o Language Support (Selenese Only) Selenium RC : Selenium RC can be used for automating web applications for different web browsers on different platforms using your favorite language like JAVA, C#, Perl, Python, Ruby etc. To write your scripts, you can use Selenium RC with or without Selenium IDE because selenium IDE would help you writing scripts. Limitations o Slow o Limited number of concurrent tests Selenium-Grid Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites that must be run in multiple environments. With Selenium-Grid, multiple instances of Selenium-RC are running on various operating system and browser configurations; Each of these when launching register with a hub. When tests are sent to the hub they are then redirected to an available Selenium-RC, which will launch the browser and run the test. This allows for running tests in parallel, with the entire test suite theoretically taking only as long to run as the longest individual test.
  5. How to setup and install the Selenium IDE Explain – 3 Slides Show picture and explain how to install the IDE tool What is needed machine wise to setup the tool
  6. For more information, please visit the below link http://seleniumhq.org/docs/04_selenese_commands.html
  7. Explain – 7 – 10 slides This section should contain an example of a test case and how it’s written in Selenium IDE (both using the recorder and scripting)
  8. Explain – 6 – 8 slides This section should contain slides that talk about how to run a test, review results and setup the test A simple exercise should also be included in this section so that the testers can try for themselves
  9. Start from the Middle: 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 : 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.
  10. Show code in selenium for this Show the recorded steps in the record pane Show what the tester should see and this slide will help the instructor show the students what the answer is Explain what was done – 1 – 2 slides
  11. 2 Example HTML code for locating element: Visit http://www.w3schools.com/htmldom/default.asp for more information about DOM Visit http://www.w3schools.com/css/default.asp for more information about CSS Visit http://www.w3schools.com/xpath/default.asp for more information about XPath
  12. Explain – 3 Slides Just an overview of tools that are used with Selenium Explain that other programming languages are available for Selenium, but keep this section simple. Eclipse is a multi-language software development platform comprising an IDE and a plug-in system to extend it. It is written primarily in Java and is used to develop applications in this language and, by means of the various plug-ins, in other languages as well as C/C++, Cobol, Python, Perl, PHP and more. IntelliJ IDEA is a commercial Java IDE by the company JetBrains. Intellij provides a set of integrated refactoring tools that allow programmers to quickly redesign their code. IntelliJ IDEA provides close integration with popular open source development tools such as CVS, Subversion, Apache Ant and JUnit. * http://seleniumhq.org/docs/appendix_installing_java_driver_client.html#configuring-selenium-rc-intellij-reference . CubicTest is a graphical Eclipse plug-in for writing Selenium and Watir tests. It makes tests faster and easier to write, and provides abstractions to make tests more robust and reusable.
  13. Explain – 3 Slides Just an overview of tools that are used with Selenium Explain that other programming languages are available for Selenium, but keep this section simple. Eclipse is a multi-language software development platform comprising an IDE and a plug-in system to extend it. It is written primarily in Java and is used to develop applications in this language and, by means of the various plug-ins, in other languages as well as C/C++, Cobol, Python, Perl, PHP and more. IntelliJ IDEA is a commercial Java IDE by the company JetBrains. Intellij provides a set of integrated refactoring tools that allow programmers to quickly redesign their code. IntelliJ IDEA provides close integration with popular open source development tools such as CVS, Subversion, Apache Ant and JUnit. * http://seleniumhq.org/docs/appendix_installing_java_driver_client.html#configuring-selenium-rc-intellij-reference . CubicTest is a graphical Eclipse plug-in for writing Selenium and Watir tests. It makes tests faster and easier to write, and provides abstractions to make tests more robust and reusable.
  14. Purpose of this exercise: know how to use wait in selenium, using regular expression, locate element in different ways,…
  15. In this section, review the OOP concept. Require learner must know Java and OOP.
  16. TestNG using Selenium RC to automate test case on web. For more information about TestNG, please visit: http://testng.org/
  17. For more information, please visit the below link http://seleniumhq.org/docs/04_selenese_commands.html