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

KEY
Getting started with Selenium 2
PDF
Automated Web Testing using JavaScript
KEY
Jellyfish, JSCONF 2011
PPTX
Protractor for angularJS
PPTX
Protractor overview
PPTX
Selenium for Jobseekers
PDF
Introduction to Protractor
PDF
Join the darkside: Selenium testing with Nightwatch.js
Getting started with Selenium 2
Automated Web Testing using JavaScript
Jellyfish, JSCONF 2011
Protractor for angularJS
Protractor overview
Selenium for Jobseekers
Introduction to Protractor
Join the darkside: Selenium testing with Nightwatch.js

What's hot (20)

PDF
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
PPTX
Get Started With Selenium 3 and Selenium 3 Grid
PPT
Selenium
PPTX
Automated Testing using JavaScript
PPTX
Automation using Javascript
PPTX
Automated Smoke Tests with Protractor
PPTX
Protractor Tutorial Quality in Agile 2015
PPTX
Better End-to-End Testing with Page Objects Model using Protractor
PPTX
Browser Automated Testing Frameworks - Nightwatch.js
PDF
Front-End Testing: Demystified
PDF
Selenium
PPTX
Protractor
PPTX
Protractor training
PPTX
Controlling the browser through python and selenium
PDF
Web automation using selenium.ppt
PPTX
Protractor survival guide
PDF
Automation Testing
PDF
Nightwatch at Tilt
PPTX
Using protractor to build automated ui tests
PDF
AngularJS and Protractor
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Get Started With Selenium 3 and Selenium 3 Grid
Selenium
Automated Testing using JavaScript
Automation using Javascript
Automated Smoke Tests with Protractor
Protractor Tutorial Quality in Agile 2015
Better End-to-End Testing with Page Objects Model using Protractor
Browser Automated Testing Frameworks - Nightwatch.js
Front-End Testing: Demystified
Selenium
Protractor
Protractor training
Controlling the browser through python and selenium
Web automation using selenium.ppt
Protractor survival guide
Automation Testing
Nightwatch at Tilt
Using protractor to build automated ui tests
AngularJS and Protractor
Ad

Viewers also liked (20)

PDF
Testing at Yammer with FooUnit, Jellyfish, and Sauce Labs
PDF
Selenium Page Objects101
PPT
Reliable tests with selenium web driver
PDF
Selenium for Designers
PPTX
Large scale automation with jenkins
PPTX
Web automation in BDD
KEY
Builder webinar
KEY
SFJS 6-19-2012
KEY
Automated Battle Scars Se Conf 2011
KEY
BDD in Symfony2
KEY
In-house web automation?
PDF
HH.JS - State of the Automation
PDF
Berlin.JS Meetup
PPTX
(Seleniumcamp) Selenium RC for QA Engineer
PDF
A Whirlwind Tour of Test::Class
PDF
Study Languages
PDF
Funcargs & other fun with pytest
PDF
Sharing the pain using Protractor
PDF
JUnit Kung Fu: Getting More Out of Your Unit Tests
KEY
Continuous Integration, the minimum viable product
Testing at Yammer with FooUnit, Jellyfish, and Sauce Labs
Selenium Page Objects101
Reliable tests with selenium web driver
Selenium for Designers
Large scale automation with jenkins
Web automation in BDD
Builder webinar
SFJS 6-19-2012
Automated Battle Scars Se Conf 2011
BDD in Symfony2
In-house web automation?
HH.JS - State of the Automation
Berlin.JS Meetup
(Seleniumcamp) Selenium RC for QA Engineer
A Whirlwind Tour of Test::Class
Study Languages
Funcargs & other fun with pytest
Sharing the pain using Protractor
JUnit Kung Fu: Getting More Out of Your Unit Tests
Continuous Integration, the minimum viable product
Ad

Similar to JavaScript Testing VIA Selenium (20)

PPTX
Automated ui-testing
PPTX
Test Automation
PPTX
Selenium
PDF
An Overview of Selenium Grid and Its Benefits
PPTX
Web testing with Selenium
PPTX
Selenium Testing
PDF
Intelligent Testing Tool: Selenium Web Driver
PDF
How To Use Selenium Successfully (Java Edition)
PPT
Selenium Introduction
PPTX
Selenium Automation
PPT
Selenium
ZIP
Browser-Based testing using Selenium
PPTX
Selenium ppt
PPT
Selenium
PPTX
Java script unit testing
PDF
How to use selenium successfully
PPT
Selenium Concepts
PDF
How To Use Selenium Successfully
PDF
How To Use Selenium Successfully (Java Edition)
PDF
Web driver selenium simplified
Automated ui-testing
Test Automation
Selenium
An Overview of Selenium Grid and Its Benefits
Web testing with Selenium
Selenium Testing
Intelligent Testing Tool: Selenium Web Driver
How To Use Selenium Successfully (Java Edition)
Selenium Introduction
Selenium Automation
Selenium
Browser-Based testing using Selenium
Selenium ppt
Selenium
Java script unit testing
How to use selenium successfully
Selenium Concepts
How To Use Selenium Successfully
How To Use Selenium Successfully (Java Edition)
Web driver selenium simplified

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
NewMind AI Monthly Chronicles - July 2025
Empathic Computing: Creating Shared Understanding
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
A Presentation on Artificial Intelligence
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Big Data Technologies - Introduction.pptx
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars

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