SlideShare a Scribd company logo
JS Testing VIA Selenium
   The good, the bad, the obvious.




 @admc
Do you have a beer?


If you look at your hand, and it doesn’t have a beer...
Thanks Yammer for hosting!
This is going to be ninja fast and to the point.
Why? Again...

Web Applications - getting bigger
  More complex
  More browsers and devices
Client side apps are built in JS
  Nothing new, still hard to test.
It’s better now than it was

 Selenium 1
   selenium.getEval("this.browserbot.getCurrentWindow().docum
   ent.getElementById(‘mything’).click()"); - WTF

 Selenium 2 / WebDriver
   x.execute("window.location.href", function(o)
   { console.log(o) }) - WINNER
The Testable Bits

 You should have backend unit tests
 You should have web services tests
 You should have JavaScript Unit tests
 You should have JavaScript Functional tests
 You should have client side SE Tests
Testing Pyramid FTW.




       Start at the bottom.
JavaScript Testing


 Verifying DOM - verify attributes
 Firing Events - verify callback results
 Network Calls - verify mock callback results
 JavaScript Code - verify state
Using Execute
JavaScript State
  selenium.execute(“window.myApp.mystate == true”)

Network
  selenium.execute_async + foo unit or Mock.js, JSMock, etc

Events
  selenium.execute_async - Google it :) Some extra setup here

DOM
  assert selenium.execute(“$(‘#mydiv’).width == ‘50px’”)
Client Side Unit Tests

 Launch browser/environment
 Load up FooUnit, QUnit, Jasmine, or your “home brew”
 Selenium.execute to retrieve results


 Don’t worry, we are going to beat this horse to death!
My Selenium 2 Vision

Launch Browsers - FAST
Navigate to pages
Execute JavaScript
Assert results
Drink a beer.
SE 2 is Important


 The vision of a shared browser automation API
 Continuing to be more performant
 A community and dedication from Google
 Ongoing browser and version support - new releases
Tool Chains
The power of SE 2
Client side JavaScript Unit Test Frameworks
Raw JavaScript access to the DOM
CI Systems


All things combined, we are captain tester!
Q&A


http://admc.io
https://github.com/admc/
@admc

More Related Content

What's hot (20)

PDF
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Codemotion
 
PPTX
Get Started With Selenium 3 and Selenium 3 Grid
Daniel Herken
 
PPT
Selenium
Adam Goucher
 
PPTX
Automated Testing using JavaScript
Simon Guest
 
PPTX
Automation using Javascript
khanhdang1214
 
PPTX
Automated Smoke Tests with Protractor
🌱 Dale Spoonemore
 
PPTX
Protractor Tutorial Quality in Agile 2015
Andrew Eisenberg
 
PPTX
Better End-to-End Testing with Page Objects Model using Protractor
Kasun Kodagoda
 
PPTX
Browser Automated Testing Frameworks - Nightwatch.js
Luís Bastião Silva
 
PDF
Front-End Testing: Demystified
Seth McLaughlin
 
PDF
Selenium
mdiliyazm
 
PPTX
Protractor
kapilsethi9
 
PPTX
Protractor training
Sergiy Stotskiy
 
PPTX
Controlling the browser through python and selenium
Patrick Viafore
 
PDF
Web automation using selenium.ppt
Ana Sarbescu
 
PPTX
Protractor survival guide
László Andrási
 
PDF
Automation Testing
RomSoft SRL
 
PDF
Nightwatch at Tilt
Dave King
 
PPTX
Using protractor to build automated ui tests
🌱 Dale Spoonemore
 
PDF
AngularJS and Protractor
Filipe Falcão
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Codemotion
 
Get Started With Selenium 3 and Selenium 3 Grid
Daniel Herken
 
Selenium
Adam Goucher
 
Automated Testing using JavaScript
Simon Guest
 
Automation using Javascript
khanhdang1214
 
Automated Smoke Tests with Protractor
🌱 Dale Spoonemore
 
Protractor Tutorial Quality in Agile 2015
Andrew Eisenberg
 
Better End-to-End Testing with Page Objects Model using Protractor
Kasun Kodagoda
 
Browser Automated Testing Frameworks - Nightwatch.js
Luís Bastião Silva
 
Front-End Testing: Demystified
Seth McLaughlin
 
Selenium
mdiliyazm
 
Protractor
kapilsethi9
 
Protractor training
Sergiy Stotskiy
 
Controlling the browser through python and selenium
Patrick Viafore
 
Web automation using selenium.ppt
Ana Sarbescu
 
Protractor survival guide
László Andrási
 
Automation Testing
RomSoft SRL
 
Nightwatch at Tilt
Dave King
 
Using protractor to build automated ui tests
🌱 Dale Spoonemore
 
AngularJS and Protractor
Filipe Falcão
 

Viewers also liked (20)

PDF
Testing at Yammer with FooUnit, Jellyfish, and Sauce Labs
Sauce Labs
 
PDF
Selenium Page Objects101
Adam Goucher
 
PPT
Reliable tests with selenium web driver
PawelPabich
 
PDF
Selenium for Designers
Fabio Fabbrucci
 
PPTX
Large scale automation with jenkins
Kohsuke Kawaguchi
 
PPTX
Web automation in BDD
Sandy Yu
 
KEY
Builder webinar
Adam Christian
 
KEY
SFJS 6-19-2012
Adam Christian
 
KEY
Automated Battle Scars Se Conf 2011
Adam Christian
 
KEY
BDD in Symfony2
Konstantin Kudryashov
 
KEY
In-house web automation?
Adam Christian
 
PDF
HH.JS - State of the Automation
Adam Christian
 
PDF
Berlin.JS Meetup
Adam Christian
 
PPTX
(Seleniumcamp) Selenium RC for QA Engineer
Yan Alexeenko
 
PDF
A Whirlwind Tour of Test::Class
Curtis Poe
 
PDF
Study Languages
Adam Christian
 
PDF
Funcargs & other fun with pytest
Brianna Laugher
 
PDF
Sharing the pain using Protractor
Anand Bagmar
 
PDF
JUnit Kung Fu: Getting More Out of Your Unit Tests
John Ferguson Smart Limited
 
KEY
Continuous Integration, the minimum viable product
Julian Simpson
 
Testing at Yammer with FooUnit, Jellyfish, and Sauce Labs
Sauce Labs
 
Selenium Page Objects101
Adam Goucher
 
Reliable tests with selenium web driver
PawelPabich
 
Selenium for Designers
Fabio Fabbrucci
 
Large scale automation with jenkins
Kohsuke Kawaguchi
 
Web automation in BDD
Sandy Yu
 
Builder webinar
Adam Christian
 
SFJS 6-19-2012
Adam Christian
 
Automated Battle Scars Se Conf 2011
Adam Christian
 
BDD in Symfony2
Konstantin Kudryashov
 
In-house web automation?
Adam Christian
 
HH.JS - State of the Automation
Adam Christian
 
Berlin.JS Meetup
Adam Christian
 
(Seleniumcamp) Selenium RC for QA Engineer
Yan Alexeenko
 
A Whirlwind Tour of Test::Class
Curtis Poe
 
Study Languages
Adam Christian
 
Funcargs & other fun with pytest
Brianna Laugher
 
Sharing the pain using Protractor
Anand Bagmar
 
JUnit Kung Fu: Getting More Out of Your Unit Tests
John Ferguson Smart Limited
 
Continuous Integration, the minimum viable product
Julian Simpson
 
Ad

Similar to JavaScript Testing VIA Selenium (20)

PPTX
Automated ui-testing
Slobodan Lohja
 
PPTX
Test Automation
Unmesh Ballal
 
PPTX
Selenium
nil65
 
PPTX
Web testing with Selenium
XBOSoft
 
PPTX
Selenium Testing
Shreshtt Bhatt
 
PDF
Intelligent Testing Tool: Selenium Web Driver
IRJET Journal
 
PDF
How To Use Selenium Successfully (Java Edition)
Sauce Labs
 
PPT
Selenium Introduction
Mayur Khairnar
 
PPTX
Selenium Automation
Anuradha Malalasena
 
PPT
Selenium
BugRaptors
 
ZIP
Browser-Based testing using Selenium
ret0
 
PPTX
Selenium ppt
Aneesh Rangarajan
 
PPT
Selenium
Daksh Sharma
 
PPTX
Java script unit testing
Mats Bryntse
 
PDF
How to use selenium successfully
TEST Huddle
 
PPT
Selenium Concepts
Swati Bansal
 
PDF
How To Use Selenium Successfully
Dave Haeffner
 
PDF
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
PDF
Web driver selenium simplified
Vikas Singh
 
PPT
Selenium classes in mumbai
Vibrant Technologies & Computers
 
Automated ui-testing
Slobodan Lohja
 
Test Automation
Unmesh Ballal
 
Selenium
nil65
 
Web testing with Selenium
XBOSoft
 
Selenium Testing
Shreshtt Bhatt
 
Intelligent Testing Tool: Selenium Web Driver
IRJET Journal
 
How To Use Selenium Successfully (Java Edition)
Sauce Labs
 
Selenium Introduction
Mayur Khairnar
 
Selenium Automation
Anuradha Malalasena
 
Selenium
BugRaptors
 
Browser-Based testing using Selenium
ret0
 
Selenium ppt
Aneesh Rangarajan
 
Selenium
Daksh Sharma
 
Java script unit testing
Mats Bryntse
 
How to use selenium successfully
TEST Huddle
 
Selenium Concepts
Swati Bansal
 
How To Use Selenium Successfully
Dave Haeffner
 
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
Web driver selenium simplified
Vikas Singh
 
Selenium classes in mumbai
Vibrant Technologies & Computers
 
Ad

Recently uploaded (20)

PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 

JavaScript Testing VIA Selenium

  • 1. JS Testing VIA Selenium The good, the bad, the obvious. @admc
  • 2. Do you have a beer? If you look at your hand, and it doesn’t have a beer... Thanks Yammer for hosting! This is going to be ninja fast and to the point.
  • 3. Why? Again... Web Applications - getting bigger More complex More browsers and devices Client side apps are built in JS Nothing new, still hard to test.
  • 4. It’s better now than it was Selenium 1 selenium.getEval("this.browserbot.getCurrentWindow().docum ent.getElementById(‘mything’).click()"); - WTF Selenium 2 / WebDriver x.execute("window.location.href", function(o) { console.log(o) }) - WINNER
  • 5. The Testable Bits You should have backend unit tests You should have web services tests You should have JavaScript Unit tests You should have JavaScript Functional tests You should have client side SE Tests
  • 6. Testing Pyramid FTW. Start at the bottom.
  • 7. JavaScript Testing Verifying DOM - verify attributes Firing Events - verify callback results Network Calls - verify mock callback results JavaScript Code - verify state
  • 8. Using Execute JavaScript State selenium.execute(“window.myApp.mystate == true”) Network selenium.execute_async + foo unit or Mock.js, JSMock, etc Events selenium.execute_async - Google it :) Some extra setup here DOM assert selenium.execute(“$(‘#mydiv’).width == ‘50px’”)
  • 9. Client Side Unit Tests Launch browser/environment Load up FooUnit, QUnit, Jasmine, or your “home brew” Selenium.execute to retrieve results Don’t worry, we are going to beat this horse to death!
  • 10. My Selenium 2 Vision Launch Browsers - FAST Navigate to pages Execute JavaScript Assert results Drink a beer.
  • 11. SE 2 is Important The vision of a shared browser automation API Continuing to be more performant A community and dedication from Google Ongoing browser and version support - new releases
  • 12. Tool Chains The power of SE 2 Client side JavaScript Unit Test Frameworks Raw JavaScript access to the DOM CI Systems All things combined, we are captain tester!

Editor's Notes