SlideShare a Scribd company logo
1 of 43
Download to read offline
Web Applications
TESTING
https://www.greendot.com
Sponsored
by
Does my code work?
Is my app too slow?
Do users enjoy my product?
Are my users safe from attack?
Does my code work?
time
cost
cost of finding and fixing bugs increases over time
TESTING IS GOOD,
MMMKAY?
js test driver
unit testing
integration tests
end to end testing
functional tests
mocha
phantomjs
casperjs
TDD
testacular
karma
venus
sinon
stubs
mocks
spies
fixtures
test harness
CI
expect
jasmine
intern
selenium headless browser
hudson travis
web driver
js test driver
unit testing
integration tests
end to end testing
functional tests
mocha
phantomjs
casperjs
TDD
testacular
karma
venus
sinon
stubs
mocks
spies
fixtures
test harness
CI
expect
jasmine
intern
selenium headless browser
hudson travis
web driver
???
PHILOSOPHIES
TDD, CI
CONSTRUCTS
test harness, mocks, fixtures,
stubs, spies, headless browser,
web driver
LIBRARIES
mocha, jasmine, qunit
chai, expect, sinon
METHODOLOGIES
unit testing, functional tests, end
to end testing, integration tests
TOOLS
phantomjs, casperjs, nightwatch, venus, js test
driver, karma, protractor, testacular, intern,
hudson, jenkins, travis, selenium
PHILOSOPHIES
Test Driven Development (TDD)
write tests write code
run tests
DEVELOPER
Test Driven Development (TDD)
write tests write code
run tests
DEVELOPER
Test Driven Development (TDD)
write tests write code
run tests
DEVELOPER
Test Driven Development (TDD)
write tests write code
run tests
DEVELOPER
Test Driven Development (TDD)
write tests write code
run tests
DEVELOPER
Continuous Integration (CI)
commits code determines tests to run
executes tests
report test results
DEVELOPER CI SYSTEM
Continuous Integration (CI)
commits code determines tests to run
executes tests
report test results
DEVELOPER CI SYSTEM
Continuous Integration (CI)
commits code determines tests to run
executes tests
report test results
DEVELOPER CI SYSTEM
Continuous Integration (CI)
commits code determines tests to run
executes tests
report test results
DEVELOPER CI SYSTEM
Continuous Integration (CI)
commits code determines tests to run
executes tests
report test results
DEVELOPER CI SYSTEM
METHODOLOGIES
Unit Testing
start coding feature complete ship it!
Unit Testing
start coding feature complete ship it!
function validateInput(input) {
var result;

validations.some(function (validation) {
result = validation.check(input);
return !result.valid;
});

return result;
}
CODE
Unit Testing
start coding feature complete ship it!
function validateInput(input) {
var result;

validations.some(function (validation) {
result = validation.check(input);
return !result.valid;
});

return result;
}
result = validateInput('seth@true.com');
expect(result.valid).to.be(true);
CODE
TEST
Unit Testing
start coding feature complete ship it!
TestingEnd to End TestingFunctionalIntegrationScenario
TestingEnd to End
start coding feature complete ship it!
TestingEnd to End
start coding feature complete ship it!
define user scenarios
automate scenarios
test the tests
run in multiple browsers
JS PYTHON RUBY …
Run locally
Run in CI
Pick key features / user actions
TestingEnd to End
start coding feature complete ship it!
define user scenarios
automate scenarios
test the tests
run in multiple browsers
JS PYTHON RUBY …
Run locally
Run in CI
Pick key features / user actions
TestingEnd to End
start coding feature complete ship it!
define user scenarios
automate scenarios
test the tests
run in multiple browsers
JS PYTHON RUBY …
Run locally
Run in CI
Pick key features / user actions
•
• Login!
• Create Account!
• Complete Purchase!
• Send Message
TestingEnd to End
start coding feature complete ship it!
define user scenarios
automate scenarios
test the tests
run in multiple browsers
JS PYTHON RUBY …
Run locally
Run in CI
Pick key features / user actions
TestingEnd to End
start coding feature complete ship it!
define user scenarios
automate scenarios
test the tests
run in multiple browsers
JS PYTHON RUBY …
Run locally
Run in CI
Pick key features / user actions
TestingEnd to End
start coding feature complete ship it!
define user scenarios
automate scenarios
test the tests
run in multiple browsers
JS PYTHON RUBY …
Run locally
Run in CI
Pick key features / user actions
CONSTRUCTS
TEST HARNESS!
A special web page which includes only the
scripts and other resources necessary to run a
specific unit test.
!
MOCK / SPY / STUB!
Simulates components and functions which are
not available in the isolated unit testing
environment.
!
FIXTURE!
Fake data used to simulate user input or other
information needed for code to execute.
!
HEADLESS BROWSER!
Browser with no UI, useful for testing. Popular
example is PhantomJS.
http://phantomjs.org/
!
WEB DRIVER!
API browsers can implement to support
automation with tool such as Selenium.
http://www.w3.org/TR/webdriver/
Unit Testing
End to End Testing
LIBRARIES
MOCHA / JASMINE / QUNIT!
Provide APIs for writing and organizing unit
tests.
!
CHAI / EXPECT!
Provide APIs for writing test assertions. Some
libraries come with assertions built-in (Jasmine,
QUnit), and some let you to select your own
(Mocha).
!
SINON!
Helper library which provides mocks, stubs,
spies and other testing constructs.
!
Unit Testing
End to End Testing
TOOLS
PHANTOMJS / SLIMERJS!
PhantomJS is a headless Webkit based
browser. SlimerJS is a “mostly” headless
browser based on Firefox.
!
CASPERJS!
Higher-level abstraction over PhantomJS API,
to make it easier to write end to end tests.
!
VENUS / KARMA / INTERN!
Test runners (or, the “glue”) that ties all the
other tools together. Testacular was the original
name for Karma.
!
HUDSON / JENKINS / TRAVIS!
Continuous Integration tools. Travis is available
as a hosted service, with easy integration for
Github repositories. It is also free for open
source projects.
Unit Testing
End to End Testing
SELENIUM!
Collection of tools / APIs which enable
programmatic control of a web browser.
!
NIGHTWATCH!
Provides abstraction on top of Selenium API to
make writing end to end tests easier.
!
!
Unit Testing
End to End Testing
YOU’RE GONNA HAVE A BAD TIME
IF YOU DON’T HAVE A DEMO…
Demo
https://github.com/sethmcl/testing_web_applications
Seth McLaughlin
www.sethmcl.com
References
Introduction to writing testable JavaScript!
http://www.smashingmagazine.com/2012/06/27/introduction-to-javascript-unit-testing-2/
http://www.youtube.com/watch?v=-IYqgx8JxlU&index=13&list=PLZDyxA22zzGxzzIC21pyyfaAjbtCVG-tn
!
Venus.js Test Runner!
http://www.venusjs.org/
http://www.youtube.com/watch?v=fvHk7KWa25o
!
Karma Test Runner!
http://www.youtube.com/watch?v=YG5DEzaQBIc
http://karma-runner.github.io/0.12/index.html
!
Nightwatch (built on Selenium WebDriver)!
http://nightwatchjs.org/
!
Selenium Architecture (deep dive)!
http://aosabook.org/en/selenium.html
!
!
!
!

More Related Content

What's hot

GDSC23 SAC - Info Session GDSC.pptx
GDSC23 SAC - Info Session GDSC.pptxGDSC23 SAC - Info Session GDSC.pptx
GDSC23 SAC - Info Session GDSC.pptx
SAC
 

What's hot (20)

Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash Course
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To Jenkins
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
How to go about testing in React?
How to go about testing in React? How to go about testing in React?
How to go about testing in React?
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
 
An Intro into webpack
An Intro into webpackAn Intro into webpack
An Intro into webpack
 
.Net Core 1.0 vs .NET Framework
.Net Core 1.0 vs .NET Framework.Net Core 1.0 vs .NET Framework
.Net Core 1.0 vs .NET Framework
 
GDSC23 SAC - Info Session GDSC.pptx
GDSC23 SAC - Info Session GDSC.pptxGDSC23 SAC - Info Session GDSC.pptx
GDSC23 SAC - Info Session GDSC.pptx
 
RxJS - The Basics & The Future
RxJS - The Basics & The FutureRxJS - The Basics & The Future
RxJS - The Basics & The Future
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Fetch API Talk
Fetch API TalkFetch API Talk
Fetch API Talk
 
Google V8 engine
Google V8 engineGoogle V8 engine
Google V8 engine
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Introduction to react native
Introduction to react nativeIntroduction to react native
Introduction to react native
 
introduction to Vue.js 3
introduction to Vue.js 3 introduction to Vue.js 3
introduction to Vue.js 3
 
Email authentication using firebase auth + flutter
Email authentication using firebase auth + flutterEmail authentication using firebase auth + flutter
Email authentication using firebase auth + flutter
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
iOS Application Security
iOS Application SecurityiOS Application Security
iOS Application Security
 
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
 

Viewers also liked

Viewers also liked (20)

Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David Torroija
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year later
 
20160905 - BrisJS - nightwatch testing
20160905 - BrisJS - nightwatch testing20160905 - BrisJS - nightwatch testing
20160905 - BrisJS - nightwatch testing
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
Continuous Testing and New Tools for Automation - Presentation from StarWest ...
Continuous Testing and New Tools for Automation - Presentation from StarWest ...Continuous Testing and New Tools for Automation - Presentation from StarWest ...
Continuous Testing and New Tools for Automation - Presentation from StarWest ...
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
Severity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятноеSeverity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятное
 
Leave end-to-end testing to Capybara
Leave end-to-end testing to CapybaraLeave end-to-end testing to Capybara
Leave end-to-end testing to Capybara
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)
 
Ci tools Introduce
Ci tools IntroduceCi tools Introduce
Ci tools Introduce
 
Agile tools
Agile toolsAgile tools
Agile tools
 
I Love APIs 2015: End to End Testing: Bug Squashing for Developers
I Love APIs 2015: End to End Testing: Bug Squashing for DevelopersI Love APIs 2015: End to End Testing: Bug Squashing for Developers
I Love APIs 2015: End to End Testing: Bug Squashing for Developers
 
Selenium and Sauce Labs
Selenium and Sauce LabsSelenium and Sauce Labs
Selenium and Sauce Labs
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
Where Does Developer Testing End And Tester Testing Begin?
Where Does Developer Testing End And Tester Testing Begin?Where Does Developer Testing End And Tester Testing Begin?
Where Does Developer Testing End And Tester Testing Begin?
 

Similar to Front-End Testing: Demystified

The Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native AppsThe Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native Apps
Sauce Labs
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
Sauce Labs
 

Similar to Front-End Testing: Demystified (20)

The Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native AppsThe Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native Apps
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Automated Testing With Watir
Automated Testing With WatirAutomated Testing With Watir
Automated Testing With Watir
 
Functional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with FrankensteinFunctional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with Frankenstein
 
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
 
Java Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and MobileJava Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and Mobile
 
Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stability
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
 
AWS Summit Auckland - Application Delivery Patterns for Developers
AWS Summit Auckland - Application Delivery Patterns for DevelopersAWS Summit Auckland - Application Delivery Patterns for Developers
AWS Summit Auckland - Application Delivery Patterns for Developers
 
End to-end testing from rookie to pro
End to-end testing  from rookie to proEnd to-end testing  from rookie to pro
End to-end testing from rookie to pro
 
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
 
Appium overview (Selenium Israel #2, Feb. 2014)
Appium overview (Selenium Israel #2, Feb. 2014)Appium overview (Selenium Israel #2, Feb. 2014)
Appium overview (Selenium Israel #2, Feb. 2014)
 
Setting UIAutomation free with Appium
Setting UIAutomation free with AppiumSetting UIAutomation free with Appium
Setting UIAutomation free with Appium
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
Web Test Automation Framework - IndicThreads Conference
Web Test Automation Framework  - IndicThreads ConferenceWeb Test Automation Framework  - IndicThreads Conference
Web Test Automation Framework - IndicThreads Conference
 
The Present and Future of Mobile Test Automation with Appium
The Present and Future of Mobile Test Automation with AppiumThe Present and Future of Mobile Test Automation with Appium
The Present and Future of Mobile Test Automation with Appium
 
Uber Mobility Meetup: Mobile Testing
Uber Mobility Meetup:  Mobile TestingUber Mobility Meetup:  Mobile Testing
Uber Mobility Meetup: Mobile Testing
 
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
 
Growing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI FrameworksGrowing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI Frameworks
 

More from Seth McLaughlin

More from Seth McLaughlin (9)

Building testable chrome extensions
Building testable chrome extensionsBuilding testable chrome extensions
Building testable chrome extensions
 
Chapter 2: What's your type?
Chapter 2: What's your type?Chapter 2: What's your type?
Chapter 2: What's your type?
 
Chapter 1: Communicating with Your Computer
Chapter 1: Communicating with Your ComputerChapter 1: Communicating with Your Computer
Chapter 1: Communicating with Your Computer
 
Are we there yet?
Are we there yet?Are we there yet?
Are we there yet?
 
JavaScript State of Mind
JavaScript State of MindJavaScript State of Mind
JavaScript State of Mind
 
Get Moving! (with HTML5 canvas)
Get Moving! (with HTML5 canvas)Get Moving! (with HTML5 canvas)
Get Moving! (with HTML5 canvas)
 
Hello, Canvas.
Hello, Canvas.Hello, Canvas.
Hello, Canvas.
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 
Introduction to Venus.js
Introduction to Venus.jsIntroduction to Venus.js
Introduction to Venus.js
 

Recently uploaded

%+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
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Recently uploaded (20)

Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
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
 
%+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...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%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
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%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
 

Front-End Testing: Demystified

  • 3. Does my code work? Is my app too slow? Do users enjoy my product? Are my users safe from attack? Does my code work?
  • 4. time cost cost of finding and fixing bugs increases over time
  • 6. js test driver unit testing integration tests end to end testing functional tests mocha phantomjs casperjs TDD testacular karma venus sinon stubs mocks spies fixtures test harness CI expect jasmine intern selenium headless browser hudson travis web driver
  • 7. js test driver unit testing integration tests end to end testing functional tests mocha phantomjs casperjs TDD testacular karma venus sinon stubs mocks spies fixtures test harness CI expect jasmine intern selenium headless browser hudson travis web driver ???
  • 8. PHILOSOPHIES TDD, CI CONSTRUCTS test harness, mocks, fixtures, stubs, spies, headless browser, web driver LIBRARIES mocha, jasmine, qunit chai, expect, sinon METHODOLOGIES unit testing, functional tests, end to end testing, integration tests TOOLS phantomjs, casperjs, nightwatch, venus, js test driver, karma, protractor, testacular, intern, hudson, jenkins, travis, selenium
  • 10. Test Driven Development (TDD) write tests write code run tests DEVELOPER
  • 11. Test Driven Development (TDD) write tests write code run tests DEVELOPER
  • 12. Test Driven Development (TDD) write tests write code run tests DEVELOPER
  • 13. Test Driven Development (TDD) write tests write code run tests DEVELOPER
  • 14. Test Driven Development (TDD) write tests write code run tests DEVELOPER
  • 15. Continuous Integration (CI) commits code determines tests to run executes tests report test results DEVELOPER CI SYSTEM
  • 16. Continuous Integration (CI) commits code determines tests to run executes tests report test results DEVELOPER CI SYSTEM
  • 17. Continuous Integration (CI) commits code determines tests to run executes tests report test results DEVELOPER CI SYSTEM
  • 18. Continuous Integration (CI) commits code determines tests to run executes tests report test results DEVELOPER CI SYSTEM
  • 19. Continuous Integration (CI) commits code determines tests to run executes tests report test results DEVELOPER CI SYSTEM
  • 21. Unit Testing start coding feature complete ship it!
  • 22. Unit Testing start coding feature complete ship it! function validateInput(input) { var result; validations.some(function (validation) { result = validation.check(input); return !result.valid; }); return result; } CODE
  • 23. Unit Testing start coding feature complete ship it! function validateInput(input) { var result; validations.some(function (validation) { result = validation.check(input); return !result.valid; }); return result; } result = validateInput('seth@true.com'); expect(result.valid).to.be(true); CODE TEST
  • 24. Unit Testing start coding feature complete ship it!
  • 25. TestingEnd to End TestingFunctionalIntegrationScenario
  • 26. TestingEnd to End start coding feature complete ship it!
  • 27. TestingEnd to End start coding feature complete ship it! define user scenarios automate scenarios test the tests run in multiple browsers JS PYTHON RUBY … Run locally Run in CI Pick key features / user actions
  • 28. TestingEnd to End start coding feature complete ship it! define user scenarios automate scenarios test the tests run in multiple browsers JS PYTHON RUBY … Run locally Run in CI Pick key features / user actions
  • 29. TestingEnd to End start coding feature complete ship it! define user scenarios automate scenarios test the tests run in multiple browsers JS PYTHON RUBY … Run locally Run in CI Pick key features / user actions • • Login! • Create Account! • Complete Purchase! • Send Message
  • 30. TestingEnd to End start coding feature complete ship it! define user scenarios automate scenarios test the tests run in multiple browsers JS PYTHON RUBY … Run locally Run in CI Pick key features / user actions
  • 31. TestingEnd to End start coding feature complete ship it! define user scenarios automate scenarios test the tests run in multiple browsers JS PYTHON RUBY … Run locally Run in CI Pick key features / user actions
  • 32. TestingEnd to End start coding feature complete ship it! define user scenarios automate scenarios test the tests run in multiple browsers JS PYTHON RUBY … Run locally Run in CI Pick key features / user actions
  • 34. TEST HARNESS! A special web page which includes only the scripts and other resources necessary to run a specific unit test. ! MOCK / SPY / STUB! Simulates components and functions which are not available in the isolated unit testing environment. ! FIXTURE! Fake data used to simulate user input or other information needed for code to execute. ! HEADLESS BROWSER! Browser with no UI, useful for testing. Popular example is PhantomJS. http://phantomjs.org/ ! WEB DRIVER! API browsers can implement to support automation with tool such as Selenium. http://www.w3.org/TR/webdriver/ Unit Testing End to End Testing
  • 36. MOCHA / JASMINE / QUNIT! Provide APIs for writing and organizing unit tests. ! CHAI / EXPECT! Provide APIs for writing test assertions. Some libraries come with assertions built-in (Jasmine, QUnit), and some let you to select your own (Mocha). ! SINON! Helper library which provides mocks, stubs, spies and other testing constructs. ! Unit Testing End to End Testing
  • 37. TOOLS
  • 38. PHANTOMJS / SLIMERJS! PhantomJS is a headless Webkit based browser. SlimerJS is a “mostly” headless browser based on Firefox. ! CASPERJS! Higher-level abstraction over PhantomJS API, to make it easier to write end to end tests. ! VENUS / KARMA / INTERN! Test runners (or, the “glue”) that ties all the other tools together. Testacular was the original name for Karma. ! HUDSON / JENKINS / TRAVIS! Continuous Integration tools. Travis is available as a hosted service, with easy integration for Github repositories. It is also free for open source projects. Unit Testing End to End Testing
  • 39. SELENIUM! Collection of tools / APIs which enable programmatic control of a web browser. ! NIGHTWATCH! Provides abstraction on top of Selenium API to make writing end to end tests easier. ! ! Unit Testing End to End Testing
  • 40. YOU’RE GONNA HAVE A BAD TIME IF YOU DON’T HAVE A DEMO…
  • 43. References Introduction to writing testable JavaScript! http://www.smashingmagazine.com/2012/06/27/introduction-to-javascript-unit-testing-2/ http://www.youtube.com/watch?v=-IYqgx8JxlU&index=13&list=PLZDyxA22zzGxzzIC21pyyfaAjbtCVG-tn ! Venus.js Test Runner! http://www.venusjs.org/ http://www.youtube.com/watch?v=fvHk7KWa25o ! Karma Test Runner! http://www.youtube.com/watch?v=YG5DEzaQBIc http://karma-runner.github.io/0.12/index.html ! Nightwatch (built on Selenium WebDriver)! http://nightwatchjs.org/ ! Selenium Architecture (deep dive)! http://aosabook.org/en/selenium.html ! ! ! !