SlideShare uma empresa Scribd logo
1 de 17
Case Selenium
www.Seleniumonlinetraining.info
1. Acceptance testing
1. What you should test?
2.Robot Framework
3. Selenium
1. Syntax
2.Xpath
3. Command types
4.Common commands
5. Terms
4.Features
5. Demo
6.Tips’n’tricks
7. Selenium RS
www.Seleniumonlinetraining.info
• vs. unit testing
• Acceptance testing = UI testing
• Suunto requires us to write tests
o Good
• Suunto requires
o use of Selenium
o use of Robot Framework
www.Seleniumonlinetraining.info
 Test expected content
 Test links
 Test functions
 Test dynamic elements
 …
 http://seleniumhq.org/docs/06_test_design_
considerations.html#what-to-test
www.Seleniumonlinetraining.info
• Environment to run Selenium tests
• Automated
• I know nothing of Robot Framework, but it must be cool
www.Seleniumonlinetraining.info
• Selenium is a suite of automated tool for testing web
application front end – UI test framework
• Selenium emulates browser user
• Selenium commands are like "write text "Panu" to input
which id is "name""
• Selenium's language supports simple scripting (operators,
defining variables)
• Selenium supports multiple methods to locate elements
• Element ID
• Element name attribute
• Xpath
• DOM
• CSS
www.Seleniumonlinetraining.info
• XML query language
• Features
o Selecting nodes
 by path
 by predicates
 with wildcards
o Axes
o Operators
o Examples:
• //div[@id='cartable']/table/tbody/tr/td[1]
• //input[@value='Jatka']
• RTFM: http://www.w3schools.com/XPath/xpath_syntax.asp
www.Seleniumonlinetraining.info
Syntax
command target value
eg.
verifyTextPresent id=phone 0700123123
www.Seleniumonlinetraining.info
• Actions are commands that generally manipulate the state of
the application. They do things like “click this link” and “select
that option”. If an Action fails, or has an error, the execution of
the current test is stopped.
• Accessors examine the state of the application and store the
results in variables, e.g. “storeTitle”. They are also used to
automatically generate Assertions.
• Assertions are like Accessors, but they verify that the state of
the application conforms to what is expected. Examples include
“make sure the page title is X” and “verify that this checkbox is
checked”.
www.Seleniumonlinetraining.info
Test are divided to
• Test suites
• Test cases
Test suites are built from test cases.
Both test cases AND test suites should be parameterised.
www.Seleniumonlinetraining.info
open
opens a page using a URL.
click/clickAndWait
performs a click operation, and optionally waits for a new page to load.
verifyTitle/assertTitle
verifies an expected page title.
verifyTextPresent
verifies expected text is somewhere on the page.
verifyElementPresent
verifies an expected UI element, as defined by its HTML tag, is present on the page.
verifyText
verifies expected text and it’s corresponding HTML tag are present on the page.
verifyTable
verifies a table’s expected contents.
waitForPageToLoad
pauses execution until an expected new page loads. Called automatically when clickAndWait is used.
waitForElementPresent
pauses execution until an expected UI element, as defined by its HTML tag, is present on the page.
www.Seleniumonlinetraining.info
 Firefox extension
 Very easy to get to know Selenium and to
play with it
 Also supports recording and running test
cases / suites
 http://seleniumhq.org/download/
 Features
 Recording tests, running tests, test cases, test
suites, breakpoints, pausing execution, export as
code
www.Seleniumonlinetraining.info
 B – set breakpoint
 X – execute command
 S – set starting point
 Good for debugging!
www.Seleniumonlinetraining.info
 Test Samuli’s application
 Transitions
 Adding cars, parameters
▪ Test constraints
 List cars
▪ Added cars are actually listened
www.Seleniumonlinetraining.info
• DON’t trust Selenium IDE or it’s default Xpath!
• You might have to change HTML code a bit to make it
easier to test automatically, eg. Add id/name attributes
• That’s completely OK!
• “AndWait” commands wait until whole page has been
loaded
• Very useful, but they don’t work with Ajax
• Difference between assert and verify
• If asset fails => test stops
• If verify fails => test continues
• echo command is good for debugging
www.Seleniumonlinetraining.info
 Selenium IDE has a poor support for programming, it does NOT
support
 condition statements
 iteration
 logging and reporting of test results
 error handling, particularly unexpected errors
 database testing
 test case grouping
 re-execution of failed tests
 test case dependency
 screenshot capture of test failures
 Selenium RS supports adding programming logic to tests
 .NET supported => though
 I have no experience
www.Seleniumonlinetraining.info
 http://seleniumhq.org/docs/index.html
 http://code.google.com/p/robotframework/
www.Seleniumonlinetraining.info

Mais conteúdo relacionado

Mais procurados

Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Applitools
 
JavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumJavaScript Testing VIA Selenium
JavaScript Testing VIA Selenium
Adam Christian
 

Mais procurados (20)

Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
 
Apex Testing Deep Dive
Apex Testing Deep DiveApex Testing Deep Dive
Apex Testing Deep Dive
 
Selenium testing IDE 101
Selenium testing IDE 101Selenium testing IDE 101
Selenium testing IDE 101
 
Selenium interview questions
Selenium interview questionsSelenium interview questions
Selenium interview questions
 
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka
Selenium Interview Questions and Answers For Freshers And Experienced | EdurekaSelenium Interview Questions and Answers For Freshers And Experienced | Edureka
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka
 
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
 
APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page Objects
 
Client side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karmaClient side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karma
 
Angular Unit Testing from the Trenches
Angular Unit Testing from the TrenchesAngular Unit Testing from the Trenches
Angular Unit Testing from the Trenches
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
JavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumJavaScript Testing VIA Selenium
JavaScript Testing VIA Selenium
 
Galen Framework - Responsive Design Automation
Galen Framework - Responsive Design AutomationGalen Framework - Responsive Design Automation
Galen Framework - Responsive Design Automation
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
Angular Unit Testing NDC Minn 2018
Angular Unit Testing NDC Minn 2018Angular Unit Testing NDC Minn 2018
Angular Unit Testing NDC Minn 2018
 
Cucumber with appium
Cucumber with appiumCucumber with appium
Cucumber with appium
 
Integration and Acceptance Testing
Integration and Acceptance TestingIntegration and Acceptance Testing
Integration and Acceptance Testing
 
Automated layout testing using Galen Framework
Automated layout testing using Galen FrameworkAutomated layout testing using Galen Framework
Automated layout testing using Galen Framework
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
Angular Unit Test
Angular Unit TestAngular Unit Test
Angular Unit Test
 

Semelhante a Selenium (2)

Selenium.ppt
Selenium.pptSelenium.ppt
Selenium.ppt
onlinemindq
 

Semelhante a Selenium (2) (20)

Learn Test Automation using Selenium - Lesson 1
Learn Test Automation using Selenium - Lesson 1Learn Test Automation using Selenium - Lesson 1
Learn Test Automation using Selenium - Lesson 1
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
 
Selenium (1) (1)
Selenium (1) (1)Selenium (1) (1)
Selenium (1) (1)
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Topic 2 IDE
Selenium Topic 2 IDESelenium Topic 2 IDE
Selenium Topic 2 IDE
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium tutorial
Selenium tutorialSelenium tutorial
Selenium tutorial
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
selenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scaleselenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scale
 
Selenium.ppt
Selenium.pptSelenium.ppt
Selenium.ppt
 
Selenium Open Source Tool
Selenium Open Source ToolSelenium Open Source Tool
Selenium Open Source Tool
 
Selenium at Salesforce Scale
Selenium at Salesforce ScaleSelenium at Salesforce Scale
Selenium at Salesforce Scale
 
Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

Selenium (2)

  • 2. 1. Acceptance testing 1. What you should test? 2.Robot Framework 3. Selenium 1. Syntax 2.Xpath 3. Command types 4.Common commands 5. Terms 4.Features 5. Demo 6.Tips’n’tricks 7. Selenium RS www.Seleniumonlinetraining.info
  • 3. • vs. unit testing • Acceptance testing = UI testing • Suunto requires us to write tests o Good • Suunto requires o use of Selenium o use of Robot Framework www.Seleniumonlinetraining.info
  • 4.  Test expected content  Test links  Test functions  Test dynamic elements  …  http://seleniumhq.org/docs/06_test_design_ considerations.html#what-to-test www.Seleniumonlinetraining.info
  • 5. • Environment to run Selenium tests • Automated • I know nothing of Robot Framework, but it must be cool www.Seleniumonlinetraining.info
  • 6. • Selenium is a suite of automated tool for testing web application front end – UI test framework • Selenium emulates browser user • Selenium commands are like "write text "Panu" to input which id is "name"" • Selenium's language supports simple scripting (operators, defining variables) • Selenium supports multiple methods to locate elements • Element ID • Element name attribute • Xpath • DOM • CSS www.Seleniumonlinetraining.info
  • 7. • XML query language • Features o Selecting nodes  by path  by predicates  with wildcards o Axes o Operators o Examples: • //div[@id='cartable']/table/tbody/tr/td[1] • //input[@value='Jatka'] • RTFM: http://www.w3schools.com/XPath/xpath_syntax.asp www.Seleniumonlinetraining.info
  • 8. Syntax command target value eg. verifyTextPresent id=phone 0700123123 www.Seleniumonlinetraining.info
  • 9. • Actions are commands that generally manipulate the state of the application. They do things like “click this link” and “select that option”. If an Action fails, or has an error, the execution of the current test is stopped. • Accessors examine the state of the application and store the results in variables, e.g. “storeTitle”. They are also used to automatically generate Assertions. • Assertions are like Accessors, but they verify that the state of the application conforms to what is expected. Examples include “make sure the page title is X” and “verify that this checkbox is checked”. www.Seleniumonlinetraining.info
  • 10. Test are divided to • Test suites • Test cases Test suites are built from test cases. Both test cases AND test suites should be parameterised. www.Seleniumonlinetraining.info
  • 11. open opens a page using a URL. click/clickAndWait performs a click operation, and optionally waits for a new page to load. verifyTitle/assertTitle verifies an expected page title. verifyTextPresent verifies expected text is somewhere on the page. verifyElementPresent verifies an expected UI element, as defined by its HTML tag, is present on the page. verifyText verifies expected text and it’s corresponding HTML tag are present on the page. verifyTable verifies a table’s expected contents. waitForPageToLoad pauses execution until an expected new page loads. Called automatically when clickAndWait is used. waitForElementPresent pauses execution until an expected UI element, as defined by its HTML tag, is present on the page. www.Seleniumonlinetraining.info
  • 12.  Firefox extension  Very easy to get to know Selenium and to play with it  Also supports recording and running test cases / suites  http://seleniumhq.org/download/  Features  Recording tests, running tests, test cases, test suites, breakpoints, pausing execution, export as code www.Seleniumonlinetraining.info
  • 13.  B – set breakpoint  X – execute command  S – set starting point  Good for debugging! www.Seleniumonlinetraining.info
  • 14.  Test Samuli’s application  Transitions  Adding cars, parameters ▪ Test constraints  List cars ▪ Added cars are actually listened www.Seleniumonlinetraining.info
  • 15. • DON’t trust Selenium IDE or it’s default Xpath! • You might have to change HTML code a bit to make it easier to test automatically, eg. Add id/name attributes • That’s completely OK! • “AndWait” commands wait until whole page has been loaded • Very useful, but they don’t work with Ajax • Difference between assert and verify • If asset fails => test stops • If verify fails => test continues • echo command is good for debugging www.Seleniumonlinetraining.info
  • 16.  Selenium IDE has a poor support for programming, it does NOT support  condition statements  iteration  logging and reporting of test results  error handling, particularly unexpected errors  database testing  test case grouping  re-execution of failed tests  test case dependency  screenshot capture of test failures  Selenium RS supports adding programming logic to tests  .NET supported => though  I have no experience www.Seleniumonlinetraining.info