SlideShare a Scribd company logo
What the HTML? - The Holy Grail
What the HTML? - The Holy Grail
What the HTML? - The Holy Grail
What the HTML? - The Holy Grail
Documents & Defines the expected
input and output of your code
Makes it Easier to Refactor.
Helps you write Better, re-usable code.
Enables Automated testing.
Unit Testing requires you change
the way you write your code.
(But this is good);
JavaScript is interpreted at runtime.
Across a variety of different browsers.
Mutable , Loosely-typed ,, Global scope.
SUDDEN DEATH Mode
Tests should::
● Run in a real browser environment
● Run in any & all browsers
● Integrate with our CI setup
● Output code coverage metrics
● Easy to write
● Be reliable, execute fast
What the HTML? - The Holy Grail
http://karma-runner.github.io/.
http://pivotal.github.io/jasmine/.
1. Karma runs a server
2. Real-world browsers connect
3. Karma serves your tests
4. Browsers execute tests
5. Karma collates the output
> karma init karma.config.js
> karma start
● Tests written in JavaScript
● BDD syntax
● Anything you can do with JavaScript,
you can test with JavaScript
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
expect(true).not.toBe(false);
});
});
● describe(name, function)
● it(name, function)
● beforeEach(function) / afterEach(function)
● expect(condition).toBe(value);
● expect(condition).not.toBe(value);
● .toEqual() / .toBeTruthy() / .toBeFalsy()
● waitsFor(function) / runs(function)
Writing tests in Jasmine
it('checks that the Quicknav control navigates to a page', function() {
loadFixtures('simple-fixture.html');
var activeTextInstance = new ActiveText(...);
waitsFor(function() { return activeTextInstance.ready; }, 500);
runs(function() {
var element = $('.quicknav input');
element.focus();
element.val("5");
var e = jQuery.Event("keydown");
e.which = ActiveText.Keymap.ENTER;
$(element).trigger(e);
e = jQuery.Event("keyup");
e.which = ActiveText.Keymap.ENTER;
$(element).trigger(e);
expect(element.val()).toBe("Pages 4–5 of 26");
expect(activeTextInstance.model.getCurrentIndex()).toBe(3);
expect(activeTextInstance.model.getCurrentPageNumber()).toBe(4);
});
});
Console Output;
CI Integration;
LCOV Output;
What the HTML? - The Holy Grail

More Related Content

What's hot (20)

ODP
JRuby - Everything in a single process
ocher
 
ODP
Akka Persistence
Knoldus Inc.
 
PDF
Introduction to K6
Knoldus Inc.
 
PPTX
Nodejs
Akhil Gopan
 
PDF
Module, AMD, RequireJS
偉格 高
 
ODP
Gatling - Stress test tool
Knoldus Inc.
 
PPTX
Gatling Tool in Action at Devoxx 2012
slandelle
 
PDF
Getting started with node JS
Hamdi Hmidi
 
PPTX
Writing Serverless Application in Java with comparison of 3 approaches: AWS S...
Andrew Zakordonets
 
PPTX
Cook Infrastructure with chef -- Justeat.IN
Rajesh Hegde
 
PPTX
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JSFestUA
 
PDF
Node.js: Whats the Big Deal? Presented and JS Meetup Chicago
Aziz Ali
 
PPSX
Behaviour driven development present
Raul Panjiyar
 
PDF
Webconf nodejs-production-architecture
Ben Lin
 
PDF
Node.js with Express
Gergely Németh
 
PDF
Modern frontend workflow
Revath S Kumar
 
PDF
Daniel Steigerwald - Este.js - konec velkého Schizma
Develcz
 
ODP
Nodejs Intro - Part2 Introduction to Web Applications
Budh Ram Gurung
 
KEY
Server side scripting smack down - Node.js vs PHP
Marc Gear
 
PPTX
Grunt to automate JS build
Tejaswita Takawale
 
JRuby - Everything in a single process
ocher
 
Akka Persistence
Knoldus Inc.
 
Introduction to K6
Knoldus Inc.
 
Nodejs
Akhil Gopan
 
Module, AMD, RequireJS
偉格 高
 
Gatling - Stress test tool
Knoldus Inc.
 
Gatling Tool in Action at Devoxx 2012
slandelle
 
Getting started with node JS
Hamdi Hmidi
 
Writing Serverless Application in Java with comparison of 3 approaches: AWS S...
Andrew Zakordonets
 
Cook Infrastructure with chef -- Justeat.IN
Rajesh Hegde
 
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JSFestUA
 
Node.js: Whats the Big Deal? Presented and JS Meetup Chicago
Aziz Ali
 
Behaviour driven development present
Raul Panjiyar
 
Webconf nodejs-production-architecture
Ben Lin
 
Node.js with Express
Gergely Németh
 
Modern frontend workflow
Revath S Kumar
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Develcz
 
Nodejs Intro - Part2 Introduction to Web Applications
Budh Ram Gurung
 
Server side scripting smack down - Node.js vs PHP
Marc Gear
 
Grunt to automate JS build
Tejaswita Takawale
 

Similar to What the HTML? - The Holy Grail (20)

PDF
3 WAYS TO TEST YOUR COLDFUSION API -
Ortus Solutions, Corp
 
PDF
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
PPTX
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
Ortus Solutions, Corp
 
PDF
Gatling Performance Workshop
Sai Krishna
 
PDF
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
PDF
Getting started with karate dsl
Knoldus Inc.
 
PDF
Master Cucumber cheat sheet for testing .pdf
ArunVastrad4
 
PDF
Quick tour to front end unit testing using jasmine
Gil Fink
 
PDF
Scala, docker and testing, oh my! mario camou
J On The Beach
 
PDF
Code quality par Simone Civetta
CocoaHeads France
 
PDF
Java Notes.pdfTells computer what to do. • These instructions are called code. •
ashutoshkumar12345ku
 
PDF
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
Databricks
 
PDF
Unit testing of spark applications
Knoldus Inc.
 
PPTX
Swagger codegen tool to generate REST services
dhanup123
 
PDF
Java Programming 100 Programming Challenges
Javier Crisostomo
 
PDF
Testacular
James Ford
 
PDF
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
DicodingEvent
 
PDF
Grails 101
David Jacobs
 
PDF
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Otávio Santana
 
PDF
Java ScriptingJava Scripting: One VM, Many Languages
elliando dias
 
3 WAYS TO TEST YOUR COLDFUSION API -
Ortus Solutions, Corp
 
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
Ortus Solutions, Corp
 
Gatling Performance Workshop
Sai Krishna
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Getting started with karate dsl
Knoldus Inc.
 
Master Cucumber cheat sheet for testing .pdf
ArunVastrad4
 
Quick tour to front end unit testing using jasmine
Gil Fink
 
Scala, docker and testing, oh my! mario camou
J On The Beach
 
Code quality par Simone Civetta
CocoaHeads France
 
Java Notes.pdfTells computer what to do. • These instructions are called code. •
ashutoshkumar12345ku
 
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
Databricks
 
Unit testing of spark applications
Knoldus Inc.
 
Swagger codegen tool to generate REST services
dhanup123
 
Java Programming 100 Programming Challenges
Javier Crisostomo
 
Testacular
James Ford
 
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
DicodingEvent
 
Grails 101
David Jacobs
 
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Otávio Santana
 
Java ScriptingJava Scripting: One VM, Many Languages
elliando dias
 
Ad

More from James Ford (12)

PDF
Virtualisation - Vagrant and Docker
James Ford
 
PDF
The Magic of Charts
James Ford
 
PDF
Telling Tales and Solving Crimes with New Relic
James Ford
 
PDF
ES6, WTF?
James Ford
 
PDF
Web fonts FTW
James Ford
 
PDF
Git 101: Force-sensitive to Jedi padawan
James Ford
 
PDF
Responsive images in 10 minutes
James Ford
 
PDF
'Hack to the future' - Hackathons at MMT Digital
James Ford
 
PDF
Fork me!
James Ford
 
PDF
Grunt training deck
James Ford
 
PDF
Agile Partners
James Ford
 
PPTX
The Flash Facebook Cookbook - FlashMidlands
James Ford
 
Virtualisation - Vagrant and Docker
James Ford
 
The Magic of Charts
James Ford
 
Telling Tales and Solving Crimes with New Relic
James Ford
 
ES6, WTF?
James Ford
 
Web fonts FTW
James Ford
 
Git 101: Force-sensitive to Jedi padawan
James Ford
 
Responsive images in 10 minutes
James Ford
 
'Hack to the future' - Hackathons at MMT Digital
James Ford
 
Fork me!
James Ford
 
Grunt training deck
James Ford
 
Agile Partners
James Ford
 
The Flash Facebook Cookbook - FlashMidlands
James Ford
 
Ad

Recently uploaded (20)

PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
July Patch Tuesday
Ivanti
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 

What the HTML? - The Holy Grail

  • 5. Documents & Defines the expected input and output of your code Makes it Easier to Refactor. Helps you write Better, re-usable code. Enables Automated testing.
  • 6. Unit Testing requires you change the way you write your code. (But this is good);
  • 7. JavaScript is interpreted at runtime. Across a variety of different browsers. Mutable , Loosely-typed ,, Global scope. SUDDEN DEATH Mode
  • 8. Tests should:: ● Run in a real browser environment ● Run in any & all browsers ● Integrate with our CI setup ● Output code coverage metrics ● Easy to write ● Be reliable, execute fast
  • 12. 1. Karma runs a server 2. Real-world browsers connect 3. Karma serves your tests 4. Browsers execute tests 5. Karma collates the output
  • 13. > karma init karma.config.js > karma start
  • 14. ● Tests written in JavaScript ● BDD syntax ● Anything you can do with JavaScript, you can test with JavaScript
  • 15. describe("A suite", function() { it("contains spec with an expectation", function() { expect(true).toBe(true); expect(true).not.toBe(false); }); });
  • 16. ● describe(name, function) ● it(name, function) ● beforeEach(function) / afterEach(function) ● expect(condition).toBe(value); ● expect(condition).not.toBe(value); ● .toEqual() / .toBeTruthy() / .toBeFalsy() ● waitsFor(function) / runs(function) Writing tests in Jasmine
  • 17. it('checks that the Quicknav control navigates to a page', function() { loadFixtures('simple-fixture.html'); var activeTextInstance = new ActiveText(...); waitsFor(function() { return activeTextInstance.ready; }, 500); runs(function() { var element = $('.quicknav input'); element.focus(); element.val("5"); var e = jQuery.Event("keydown"); e.which = ActiveText.Keymap.ENTER; $(element).trigger(e); e = jQuery.Event("keyup"); e.which = ActiveText.Keymap.ENTER; $(element).trigger(e); expect(element.val()).toBe("Pages 4–5 of 26"); expect(activeTextInstance.model.getCurrentIndex()).toBe(3); expect(activeTextInstance.model.getCurrentPageNumber()).toBe(4); }); });