SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

En vedette (15)

Robot handles
Robot handlesRobot handles
Robot handles
 
Robot Framework : Lord of the Rings By Asheesh M
Robot Framework : Lord of the Rings By Asheesh MRobot Framework : Lord of the Rings By Asheesh M
Robot Framework : Lord of the Rings By Asheesh M
 
Robot framework - Lord of the Rings
Robot framework - Lord of the RingsRobot framework - Lord of the Rings
Robot framework - Lord of the Rings
 
Acceptance Test Driven Development using Robot Framework
Acceptance Test Driven Development using Robot FrameworkAcceptance Test Driven Development using Robot Framework
Acceptance Test Driven Development using Robot Framework
 
Introduction to Robot Framework
Introduction to Robot FrameworkIntroduction to Robot Framework
Introduction to Robot Framework
 
Web testing automation
Web testing automationWeb testing automation
Web testing automation
 
Robot Framework
Robot FrameworkRobot Framework
Robot Framework
 
JavaCro'14 - Test Automation using RobotFramework Libraries – Stojan Peshov
JavaCro'14 - Test Automation using RobotFramework Libraries – Stojan PeshovJavaCro'14 - Test Automation using RobotFramework Libraries – Stojan Peshov
JavaCro'14 - Test Automation using RobotFramework Libraries – Stojan Peshov
 
Selenium, Appium, and Robots!
Selenium, Appium, and Robots!Selenium, Appium, and Robots!
Selenium, Appium, and Robots!
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and selenium
 
Barcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot FrameworkBarcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot Framework
 
Introduction to Robot Framework
Introduction to Robot FrameworkIntroduction to Robot Framework
Introduction to Robot Framework
 
Robot framework and selenium2 library
Robot framework and selenium2 libraryRobot framework and selenium2 library
Robot framework and selenium2 library
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs IntegrationRobot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
 
Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework Introduction
 

Similaire à Selenium (2)

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

Similaire à 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
 

Dernier

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
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
 

Dernier (20)

Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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
 
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
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
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
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.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
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

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