SlideShare uma empresa Scribd logo
1 de 27
How To Grade Your
Selenium Tests
Special Thanks to
Dave Haeffner!
http://elementalselenium.com
What We’ll Cover
• Good/bad Tests, Testing Rubric
• Good/bad Page Objects, PO Rubric
• Good/Bad Locators, Locator Rubric
• Report Card
• A Concept For Automating This
Who, Me? Okay
• Marcus Merrell (@mmerrell)
• Manager, Web Platform Engineering Team at
RetailMeNot, inc
• QA Test Automation from 2001-2015
• Selenium/WebDriver since 2007
• The “bass player” in all things
Let’s talk about tests
What Makes a Bad Test?
• Fails For No Good Reason
• Changes in AUT, Need to Update Test(s)
• Slow
• Unreliable
• Hard to Understand and Maintain
What Makes a Good Test?
• Written for BDD or xUnit test framework
• Test one thing (atomic)
• Each test can be run independently (autonomous, “idempotent”)
• Anyone can understand what it is doing (easy to read)
• Similar tests are grouped together
• Centralized setup/teardown
• Uses Page Objects
Some Solid Tests
A Testing Rubric
(Each test starts with 100 points, deduct as necessary)
Item Belong in tests? Score
Selenium Commands No -3 per (max of -9)
Locators No -2 per (max of -8)
Selenium setup/teardown* No -20
Hard-coded sleeps No -5 per (max of -20)
Implicit wait calls No -10
Explicit Wait calls No -3
Conditionals No -5 (max of -20)
Calls to Page Objects Yes N/A
Assertion(s)* Yes N/A
Let’s talk about
Page Objects
http://martinfowler.com/bliki/PageObject.html
What Makes a Bad PO?
• Gigantic (i.e., hundreds or thousands of lines of
code)
• Over-reaching responsibility
• Contains overly complicated logic
• Return not enough or too much information to the
test (leaky abstraction)
• Assertions happening in the PO instead of the test
What Makes a Good PO?
• Contains State (e.g., locators)
• Contains Behavior (e.g., methods to interact with
the page)
• Returns some information about the page (e.g., new
page object, text from the page, a boolean result for
some check, etc. — never a WebElement)
• Verifies page ready state as part of initialization with
a found Element
A Page Object Rubric
(Each Page Object starts with 100, deduct points as necessary)
Item Belong in POs? Score
> 200 lines of code No -5 per 50 lines over
Assertions No* -5 per (max of -20)
Hard-coded sleeps No -5 per (max of -20)
Implicit wait calls No -10
Explicit waits Yes N/A
Verify page ready state* Yes
-8 if not verifying an
element
Locators* Yes N/A
http://se.tips/se-waiting-jim-evans
Let’s talk about locators
Locator Strategies
• Class
• CSS selectors
• ID
• Link Text
• Partial Link Text
• Tag Name
• XPath
Good locators are:
• unique
• descriptive
• unlikely to change
That rules a few of these out
Locator Strategies
• Class
• CSS selectors
• ID
• Link Text
• Partial Link Text
• Tag Name
• XPath
Good locators are:
• unique
• descriptive
• unlikely to change
That rules a few of these out
Locator Strategies
• Class
• CSS selectors
• ID
• Link Text
• Partial Link Text
• Tag Name
• XPath
Good locators are:
• unique
• descriptive
• unlikely to change
That rules a few of these out
Start with IDs and Classes
Locator Strategies
• Class
• CSS selectors
• ID
• Link Text
• Partial Link Text
• Tag Name
• XPath
Good locators are:
• unique
• descriptive
• unlikely to change
That rules a few of these out
Start with IDs and Classes
Use CSS or XPath (with care)
A Locator Rubric
(Each locator gets a grade)
Item Letter Grade E.g.,
Dynamic locators D-
User account specific
or tied to page render
Tied to page layout D
XPath: / / /
CSS: > > >, etc.
Text on the page C Link text, page copy
Reasonable traversal B
Parent to child w/in an
element node
Using semantic name B+
Input labels
(name='username')
Semantic ID A
Unique, descriptive,
unlikely to change
Non-unique locator? -2 full letter grades
So…
What’s your testing
GPA?
Topic Weight
Tests 20%
Page Objects 30%
Locators 50%
Example Report
Summary
B-
Suite Full Suite
Tests 87
Page Objects 62
Locators 90
Example Report
Drill-down
Test Suite Test Name Test PO Locators Overall
User Login Happy Path 87 90 90 89.4
User Login Invalid Email 92 78 93 88.3
User Login Insecure PW 99 68 91 85.7
User Login Mismatched PW 75 56 90 76.8
User Login Missing Req’d 82 34 95 74.1
Store Page Offer Sort 91 62 85 79.3
Store Page Code-type 83 44 89 74.3
Store Page Sale-type 87 62 87 79.5
Analytics Outclick 88 N/A N/A 88
Analytics Offer Rank 86 N/A N/A 86
Analytics Campaign 87 N/A N/A 87
Example Report
Test Level
Test Name Step Locator Score Overall
Code-type Login Xpath(‘//root/@home/@login’) D Relative to root
Code-type Search ‘macys.com’ Css(‘class: q’) B Semantic CSS
LinkText(‘submit’) C LinkText brittle
Code-type Click Macy’s Id(‘macys.com’) A Gold Standard
Code-type Filter Codes Id(‘filterCode’) A Gold Standard
Code-type Click Top Code Xpath(‘@div[‘code-link’][0]’) C Brittle
Next Steps
• Simple to implement, e.g. IntelliJ plug-in
• Event Listener
• Java/JS SDKs in testing
• Reporting needs work (conceptually)
• Service Performance
Thank You!!
Questions?

Mais conteúdo relacionado

Mais procurados

5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated Testing5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated TestingBhupesh Dahal
 
Enabling CD in Enterprises with Testing
Enabling CD in Enterprises with TestingEnabling CD in Enterprises with Testing
Enabling CD in Enterprises with TestingThoughtworks
 
Client-Side Performance Testing
Client-Side Performance TestingClient-Side Performance Testing
Client-Side Performance TestingAnand Bagmar
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalQA or the Highway
 
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxDSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxMikalai Alimenkou
 
Eradicate Flaky Tests - AppiumConf 2021
Eradicate Flaky Tests - AppiumConf 2021Eradicate Flaky Tests - AppiumConf 2021
Eradicate Flaky Tests - AppiumConf 2021Anand Bagmar
 
Enabling CD in Enterprises with Testing
Enabling CD in Enterprises with TestingEnabling CD in Enterprises with Testing
Enabling CD in Enterprises with TestingAnand Bagmar
 
To Deploy or Not-To-Deploy - decide using TTA's Trend & Failure Analysis
To Deploy or Not-To-Deploy - decide using TTA's Trend & Failure AnalysisTo Deploy or Not-To-Deploy - decide using TTA's Trend & Failure Analysis
To Deploy or Not-To-Deploy - decide using TTA's Trend & Failure AnalysisAnand Bagmar
 
Vijay & Parul - Cloud testing
Vijay & Parul - Cloud testingVijay & Parul - Cloud testing
Vijay & Parul - Cloud testingvodQA
 
Web automation with Selenium for software engineers
Web automation with Selenium for software engineersWeb automation with Selenium for software engineers
Web automation with Selenium for software engineersMikalai Alimenkou
 
Selenium Deep Dive
Selenium Deep DiveSelenium Deep Dive
Selenium Deep DiveAnand Bagmar
 
Writing Test Cases in Agile
Writing Test Cases in AgileWriting Test Cases in Agile
Writing Test Cases in AgileSaroj Singh
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentMonocularVision
 
How to deal with REST API Evolution
How to deal with REST API EvolutionHow to deal with REST API Evolution
How to deal with REST API EvolutionMiredot
 
Internal DSLs For Automated Functional Testing
Internal DSLs For Automated Functional TestingInternal DSLs For Automated Functional Testing
Internal DSLs For Automated Functional TestingJohn Sonmez
 
Producing Testable Requirements
Producing Testable RequirementsProducing Testable Requirements
Producing Testable RequirementsIntergen
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzQA or the Highway
 

Mais procurados (19)

5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated Testing5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated Testing
 
Enabling CD in Enterprises with Testing
Enabling CD in Enterprises with TestingEnabling CD in Enterprises with Testing
Enabling CD in Enterprises with Testing
 
Client-Side Performance Testing
Client-Side Performance TestingClient-Side Performance Testing
Client-Side Performance Testing
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh Dahal
 
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxDSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
 
Eradicate Flaky Tests - AppiumConf 2021
Eradicate Flaky Tests - AppiumConf 2021Eradicate Flaky Tests - AppiumConf 2021
Eradicate Flaky Tests - AppiumConf 2021
 
Enabling CD in Enterprises with Testing
Enabling CD in Enterprises with TestingEnabling CD in Enterprises with Testing
Enabling CD in Enterprises with Testing
 
To Deploy or Not-To-Deploy - decide using TTA's Trend & Failure Analysis
To Deploy or Not-To-Deploy - decide using TTA's Trend & Failure AnalysisTo Deploy or Not-To-Deploy - decide using TTA's Trend & Failure Analysis
To Deploy or Not-To-Deploy - decide using TTA's Trend & Failure Analysis
 
Vijay & Parul - Cloud testing
Vijay & Parul - Cloud testingVijay & Parul - Cloud testing
Vijay & Parul - Cloud testing
 
Web automation with Selenium for software engineers
Web automation with Selenium for software engineersWeb automation with Selenium for software engineers
Web automation with Selenium for software engineers
 
Selenium Deep Dive
Selenium Deep DiveSelenium Deep Dive
Selenium Deep Dive
 
Writing Test Cases in Agile
Writing Test Cases in AgileWriting Test Cases in Agile
Writing Test Cases in Agile
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
How to deal with REST API Evolution
How to deal with REST API EvolutionHow to deal with REST API Evolution
How to deal with REST API Evolution
 
Bdd and spec flow
Bdd and spec flowBdd and spec flow
Bdd and spec flow
 
Internal DSLs For Automated Functional Testing
Internal DSLs For Automated Functional TestingInternal DSLs For Automated Functional Testing
Internal DSLs For Automated Functional Testing
 
Producing Testable Requirements
Producing Testable RequirementsProducing Testable Requirements
Producing Testable Requirements
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig Stuntz
 

Destaque

Test Automation Architecture in Microservices
Test Automation Architecture in MicroservicesTest Automation Architecture in Microservices
Test Automation Architecture in MicroservicesAlper Mermer
 
WixAutomation - Test State Pattern - Selenium Camp 2017
WixAutomation - Test State Pattern - Selenium Camp 2017WixAutomation - Test State Pattern - Selenium Camp 2017
WixAutomation - Test State Pattern - Selenium Camp 2017Roi Ashkenazi
 
End-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical ScaleEnd-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical ScaleErdem YILDIRIM
 
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...Badoo
 
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latestColorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latestOnur Baskirt
 
Testing Metrics - Making your tests visible
Testing Metrics - Making your tests visibleTesting Metrics - Making your tests visible
Testing Metrics - Making your tests visibleAlper Mermer
 
5 top pain points of test automation
5 top pain points of test automation5 top pain points of test automation
5 top pain points of test automationMikalai Alimenkou
 
The wild wild west of Selenium Capabilities
The wild wild west of Selenium CapabilitiesThe wild wild west of Selenium Capabilities
The wild wild west of Selenium CapabilitiesAdi Ofri
 
Fabulous Tests on Spock and Groovy
Fabulous Tests on Spock and GroovyFabulous Tests on Spock and Groovy
Fabulous Tests on Spock and GroovyYaroslav Pernerovsky
 
Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]automician
 
SoapUI one key to all doors
SoapUI one key to all doorsSoapUI one key to all doors
SoapUI one key to all doorsYegor Maksymchuk
 
Test trend analysis: Towards robust reliable and timely tests
Test trend analysis: Towards robust reliable and timely testsTest trend analysis: Towards robust reliable and timely tests
Test trend analysis: Towards robust reliable and timely testsHugh McCamphill
 
How does Java 8 exert hidden power on Test Automation?
How does Java 8 exert hidden power on Test Automation?How does Java 8 exert hidden power on Test Automation?
How does Java 8 exert hidden power on Test Automation?Sergey Korol
 
Roman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium campRoman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium campРоман Иовлев
 
An easy way to automate complex UI
An easy way to automate complex UIAn easy way to automate complex UI
An easy way to automate complex UIIvan Pashko
 
Excuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in KotlinExcuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in Kotlinleonsabr
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsLudmila Nesvitiy
 
Selenium grid workshop london 2016
Selenium grid workshop london 2016Selenium grid workshop london 2016
Selenium grid workshop london 2016Marcus Merrell
 
Roman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium CampRoman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium CampРоман Иовлев
 
Руководство по приготовлению бутербродов из Selenium
Руководство по приготовлению бутербродов из SeleniumРуководство по приготовлению бутербродов из Selenium
Руководство по приготовлению бутербродов из SeleniumUladzimir Kryvenka
 

Destaque (20)

Test Automation Architecture in Microservices
Test Automation Architecture in MicroservicesTest Automation Architecture in Microservices
Test Automation Architecture in Microservices
 
WixAutomation - Test State Pattern - Selenium Camp 2017
WixAutomation - Test State Pattern - Selenium Camp 2017WixAutomation - Test State Pattern - Selenium Camp 2017
WixAutomation - Test State Pattern - Selenium Camp 2017
 
End-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical ScaleEnd-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical Scale
 
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
 
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latestColorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latest
 
Testing Metrics - Making your tests visible
Testing Metrics - Making your tests visibleTesting Metrics - Making your tests visible
Testing Metrics - Making your tests visible
 
5 top pain points of test automation
5 top pain points of test automation5 top pain points of test automation
5 top pain points of test automation
 
The wild wild west of Selenium Capabilities
The wild wild west of Selenium CapabilitiesThe wild wild west of Selenium Capabilities
The wild wild west of Selenium Capabilities
 
Fabulous Tests on Spock and Groovy
Fabulous Tests on Spock and GroovyFabulous Tests on Spock and Groovy
Fabulous Tests on Spock and Groovy
 
Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]
 
SoapUI one key to all doors
SoapUI one key to all doorsSoapUI one key to all doors
SoapUI one key to all doors
 
Test trend analysis: Towards robust reliable and timely tests
Test trend analysis: Towards robust reliable and timely testsTest trend analysis: Towards robust reliable and timely tests
Test trend analysis: Towards robust reliable and timely tests
 
How does Java 8 exert hidden power on Test Automation?
How does Java 8 exert hidden power on Test Automation?How does Java 8 exert hidden power on Test Automation?
How does Java 8 exert hidden power on Test Automation?
 
Roman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium campRoman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium camp
 
An easy way to automate complex UI
An easy way to automate complex UIAn easy way to automate complex UI
An easy way to automate complex UI
 
Excuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in KotlinExcuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in Kotlin
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
Selenium grid workshop london 2016
Selenium grid workshop london 2016Selenium grid workshop london 2016
Selenium grid workshop london 2016
 
Roman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium CampRoman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium Camp
 
Руководство по приготовлению бутербродов из Selenium
Руководство по приготовлению бутербродов из SeleniumРуководство по приготовлению бутербродов из Selenium
Руководство по приготовлению бутербродов из Selenium
 

Semelhante a Grading the Quality of Selenium Tests

Dave Haeffner's Proven Method to Grading the Quality of Selenium Tests
Dave Haeffner's Proven Method to Grading the Quality of Selenium TestsDave Haeffner's Proven Method to Grading the Quality of Selenium Tests
Dave Haeffner's Proven Method to Grading the Quality of Selenium TestsApplitools
 
How To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs Webinar
How To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs WebinarHow To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs Webinar
How To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs WebinarSauce Labs
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Escaping Test Hell - ACCU 2014
Escaping Test Hell - ACCU 2014Escaping Test Hell - ACCU 2014
Escaping Test Hell - ACCU 2014Wojciech Seliga
 
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 Applitools
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)Sauce Labs
 
Testable Requirements
Testable Requirements Testable Requirements
Testable Requirements Bharti Rupani
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptMarc Huang
 
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The FutureQA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The FutureQAFest
 
Tuhin Mitra: How I Automate My Negative Tests
Tuhin Mitra: How I Automate My Negative TestsTuhin Mitra: How I Automate My Negative Tests
Tuhin Mitra: How I Automate My Negative TestsAnna Royzman
 
Final Presentation V3
Final Presentation V3Final Presentation V3
Final Presentation V3weichen
 
Content migration for sitecore
Content migration for sitecoreContent migration for sitecore
Content migration for sitecoreSurendra Sharma
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupDave Haeffner
 
A Sampling of Tools
A Sampling of ToolsA Sampling of Tools
A Sampling of ToolsDawn Code
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)Dave Haeffner
 
Migration strategies 4
Migration strategies 4Migration strategies 4
Migration strategies 4Wenhua Wang
 

Semelhante a Grading the Quality of Selenium Tests (20)

Dave Haeffner's Proven Method to Grading the Quality of Selenium Tests
Dave Haeffner's Proven Method to Grading the Quality of Selenium TestsDave Haeffner's Proven Method to Grading the Quality of Selenium Tests
Dave Haeffner's Proven Method to Grading the Quality of Selenium Tests
 
How To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs Webinar
How To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs WebinarHow To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs Webinar
How To Grade Your Selenium Tests by Dave Haeffner - Sauce Labs Webinar
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Escaping Test Hell - ACCU 2014
Escaping Test Hell - ACCU 2014Escaping Test Hell - ACCU 2014
Escaping Test Hell - ACCU 2014
 
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
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Testable requirements
Testable requirementsTestable requirements
Testable requirements
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
Testable Requirements
Testable Requirements Testable Requirements
Testable Requirements
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
 
Selenium (2)
Selenium (2)Selenium (2)
Selenium (2)
 
Selenium (2)
Selenium (2)Selenium (2)
Selenium (2)
 
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The FutureQA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
 
Tuhin Mitra: How I Automate My Negative Tests
Tuhin Mitra: How I Automate My Negative TestsTuhin Mitra: How I Automate My Negative Tests
Tuhin Mitra: How I Automate My Negative Tests
 
Final Presentation V3
Final Presentation V3Final Presentation V3
Final Presentation V3
 
Content migration for sitecore
Content migration for sitecoreContent migration for sitecore
Content migration for sitecore
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
 
A Sampling of Tools
A Sampling of ToolsA Sampling of Tools
A Sampling of Tools
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
Migration strategies 4
Migration strategies 4Migration strategies 4
Migration strategies 4
 

Último

%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburgmasabamasaba
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 

Último (20)

%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 

Grading the Quality of Selenium Tests

  • 1. How To Grade Your Selenium Tests
  • 2. Special Thanks to Dave Haeffner! http://elementalselenium.com
  • 3. What We’ll Cover • Good/bad Tests, Testing Rubric • Good/bad Page Objects, PO Rubric • Good/Bad Locators, Locator Rubric • Report Card • A Concept For Automating This
  • 4. Who, Me? Okay • Marcus Merrell (@mmerrell) • Manager, Web Platform Engineering Team at RetailMeNot, inc • QA Test Automation from 2001-2015 • Selenium/WebDriver since 2007 • The “bass player” in all things
  • 6. What Makes a Bad Test? • Fails For No Good Reason • Changes in AUT, Need to Update Test(s) • Slow • Unreliable • Hard to Understand and Maintain
  • 7. What Makes a Good Test? • Written for BDD or xUnit test framework • Test one thing (atomic) • Each test can be run independently (autonomous, “idempotent”) • Anyone can understand what it is doing (easy to read) • Similar tests are grouped together • Centralized setup/teardown • Uses Page Objects
  • 9. A Testing Rubric (Each test starts with 100 points, deduct as necessary) Item Belong in tests? Score Selenium Commands No -3 per (max of -9) Locators No -2 per (max of -8) Selenium setup/teardown* No -20 Hard-coded sleeps No -5 per (max of -20) Implicit wait calls No -10 Explicit Wait calls No -3 Conditionals No -5 (max of -20) Calls to Page Objects Yes N/A Assertion(s)* Yes N/A
  • 12. What Makes a Bad PO? • Gigantic (i.e., hundreds or thousands of lines of code) • Over-reaching responsibility • Contains overly complicated logic • Return not enough or too much information to the test (leaky abstraction) • Assertions happening in the PO instead of the test
  • 13. What Makes a Good PO? • Contains State (e.g., locators) • Contains Behavior (e.g., methods to interact with the page) • Returns some information about the page (e.g., new page object, text from the page, a boolean result for some check, etc. — never a WebElement) • Verifies page ready state as part of initialization with a found Element
  • 14. A Page Object Rubric (Each Page Object starts with 100, deduct points as necessary) Item Belong in POs? Score > 200 lines of code No -5 per 50 lines over Assertions No* -5 per (max of -20) Hard-coded sleeps No -5 per (max of -20) Implicit wait calls No -10 Explicit waits Yes N/A Verify page ready state* Yes -8 if not verifying an element Locators* Yes N/A http://se.tips/se-waiting-jim-evans
  • 15. Let’s talk about locators
  • 16. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out
  • 17. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out
  • 18. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out Start with IDs and Classes
  • 19. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out Start with IDs and Classes Use CSS or XPath (with care)
  • 20. A Locator Rubric (Each locator gets a grade) Item Letter Grade E.g., Dynamic locators D- User account specific or tied to page render Tied to page layout D XPath: / / / CSS: > > >, etc. Text on the page C Link text, page copy Reasonable traversal B Parent to child w/in an element node Using semantic name B+ Input labels (name='username') Semantic ID A Unique, descriptive, unlikely to change Non-unique locator? -2 full letter grades
  • 21. So…
  • 22. What’s your testing GPA? Topic Weight Tests 20% Page Objects 30% Locators 50%
  • 23. Example Report Summary B- Suite Full Suite Tests 87 Page Objects 62 Locators 90
  • 24. Example Report Drill-down Test Suite Test Name Test PO Locators Overall User Login Happy Path 87 90 90 89.4 User Login Invalid Email 92 78 93 88.3 User Login Insecure PW 99 68 91 85.7 User Login Mismatched PW 75 56 90 76.8 User Login Missing Req’d 82 34 95 74.1 Store Page Offer Sort 91 62 85 79.3 Store Page Code-type 83 44 89 74.3 Store Page Sale-type 87 62 87 79.5 Analytics Outclick 88 N/A N/A 88 Analytics Offer Rank 86 N/A N/A 86 Analytics Campaign 87 N/A N/A 87
  • 25. Example Report Test Level Test Name Step Locator Score Overall Code-type Login Xpath(‘//root/@home/@login’) D Relative to root Code-type Search ‘macys.com’ Css(‘class: q’) B Semantic CSS LinkText(‘submit’) C LinkText brittle Code-type Click Macy’s Id(‘macys.com’) A Gold Standard Code-type Filter Codes Id(‘filterCode’) A Gold Standard Code-type Click Top Code Xpath(‘@div[‘code-link’][0]’) C Brittle
  • 26. Next Steps • Simple to implement, e.g. IntelliJ plug-in • Event Listener • Java/JS SDKs in testing • Reporting needs work (conceptually) • Service Performance

Notas do Editor

  1. Central setup/teardown with a clean instance for each test No inter-test dependencies (hard to quantify/observer at times) Best thing to do is run tests in a random order
  2. Assertions OK for verifying page ready state (better to throw an exception though) For verifying page ready state, be sure to use an element — using a URL or page title is such a bummer Implied method structure that maps to actions on the page Majority of methods return page information (e.g., boolean result or new page object) – text returns are a thing… Some methods can be void (e.g., filling out a form) Locators should be stored in field variables for reuse throughout a PO