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
 
PDF
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
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
 
Automated ui-testing
Slobodan Lohja
 
Test Automation
Unmesh Ballal
 
Selenium
nil65
 
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
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
 
Ad

Recently uploaded (20)

PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 

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