SlideShare a Scribd company logo
The Spirit
of Testing
The Spirit of Testing
Testing? I’m bored already
http://stockarch.com/images/events/bored-halloween-ghost-6068
DON’T
Testing should be Appealing
http://gossip.whyfame.com/demi-moore-and-whoopi-goldberg-pay-tribute-to-ghost-co-star-patrick-swayze-613
“Testing is like sex. If it’s not
fun, then you’re doing it
wrong”	

– anonymous
http://writingisacompulsion.blogspot.co.uk/2013/10/9-months-in-making-baby-of-thought.html
Remember
being a
kid?
https://parentsavvy.com/child-health/?SubtopicId=30014,30017&DocId=1,2954
Kids run tests
every moment
http://www.psychalive.org/category/tantrums-2/ http://www.patrasevents.gr/article/100447-deite-tin-apisteuti-antidrasi-apo-morakia-pou-dokimazoun-lemoni-video
They are
the best at it
http://www.childrensdayton.org/cms/images/a0f6b517aba16ca5/index.html
They explore the unknowns
http://www.childrensdayton.org/cms/images/a0f6b517aba16ca5/index.html
embrace you don’t know either
Through tests we sense 	

the unknowns
http://www.dailymail.co.uk/news/article-2381456/How-science-spirit-world-really-makes-Ouija-board-dowsing-rods-move.html
(re)think Testing
you are testing already 

(even if you are not)
http://www.hongkiat.com/blog/developer-habits/
you might just need to formalise
http://www.wisegeek.org/what-is-procedural-programming.htm
to, eventually, forget this
(almost)
https://twitter.com/fredzen/status/439774520111419392
What is not about
Task runner	

Test Runner	

Testing Platforms	

Assertion Frameworks	

IDEs integration
http://strongenough-christina.blogspot.co.uk/2012/10/my-tool-belt.html
What it is about
http://www.sourcecon.com/news/2010/11/19/sourcing-a-passing-fad-or-a-strategic-move/
I Build So Consistently
share
Identify 	

what to automate
create a 

build script
make it
continuous
“[…] On several occasions I've heard
the reply, "Yes, we do CI." 

Of course, I think, "Great!" and then 

ask a few questions. 	



How much code coverage do you have
with your tests? How long does it take
to run your builds? What is your
average code complexity? How much
code duplication do you have?”	

– Paul Duvall
to DTU* or not to DTU*?

(* Define Tests Upfront: tdd / bdd / acceptance)
http://comicsalliance.com/ryan-north-to-be-or-not-to-be-kickstarter-sets-record/
any test is better than no
tests, but…
Confirmation bias
http://www.thezerosbeforetheone.com/confirming-my-own-confirmation-bias
“it is a byproduct of test-after-
development and manifests itself
as the tendency for engineers
to only write tests that they
know pass.”	

– Paul Bourdeaux 

http://www.sundoginteractive.com/sunblog/posts/confirmation-bias-in-unit-testing
Code Review vs Pairing
http://powerbuilder.us/ http://meetingking.com/mini-meetings-or-pair-programming/
Error Management
http://comicbooks.about.com/od/ghostrid2/ig/Ghost-Rider-Movie-Gallery/Ghost-Rider-Johnny-Blaze.htm
Feedback loop
http://www.smashingmagazine.com/2013/02/15/designing-great-feedback-loops/
Testing is a way to shape
your process, not only your
workflow
what I learned so far
@cedmax
turning blank files
to bugs since 2003
webteam @ Shazam
When I started testing
http://quoteko.com/lego-block.html http://karenchilvers.mycouncillor.org.uk/2013/09/28/planning-applications-week-ending-27th-september-2013/
There is actually much more
Unit	

Behaviour	

Acceptance	

Usability	

System	

Integration	

Performance	

UI	

Security	

Scalability	

…
How I see it now
Automatable !Automatable
Feature
Code
Unit
Acceptance Usability
Code Review
Linting Styleguide
Integration QA Testing
Testing code IS appealing 	

(or I have some mom issues, pick one)
http://gossip.whyfame.com/demi-moore-and-whoopi-goldberg-pay-tribute-to-ghost-co-star-patrick-swayze-613
“Egoism is the very essence
of a noble soul.”	

– Friedrich Nietzsche
Interlude	

How I Learned to Stop Worrying and Love the DOM
The curious case of
Javascript unit testing
Unit testing is
supposed to test a
single atomic “unit” of
functionality without
dependencies on
anything else
This is where you start
to run into serious
dependency problems
due to the interrelation
HTML and CSS
What do you test?
Usually how the user
interface responds to
user input.
standard input/output
test('htmlEncode', 1, function() {!
! ! var str = '<I love working with JS & CSS>';!
!
! ! equal(!
! ! ! MyApp.htmlEncode(str), !
! ! ! '&lt;I love working with JS &amp; CSS&gt;'!
! ! );!
});
the DOM
module('audioPlayer', {!
! ! setup: function(){!
! ! ! ! $('<a class="audio-play"></a>')!
! ! ! ! ! ! .appendTo(document.body);!
! ! },!
! ! teardown: function(){!
! ! ! ! document.body.innerHTML = ';!
! ! }!! !
);!
!
test('button state', 2, function() {!
! ! var $elm = $('.audio-play'),!
! ! ! ! player = new MyApp.AudioPlayer($elm);!
! ! !
! ! ok(!$elm.hasClass(‘audio-playing'));!
!
! ! $elm.trigger('click');!
! ! ok($elm.hasClass('audio-playing'));!! !
});
Pub/Sub

(this is easy)
test('logout', 1, function() {!
! ! MyApp.subscribe('user:logout', function(){!
! ! ! ! ok(true);!
! ! });!
!
! ! MyApp.setup();!
! ! $('.logout').trigger('click');!
});
Mocking api
test('windows matchmedia', 2, function() {! ! !
! ! var spy = sinon.spy(window, 'matchMedia');!
!
! ! MyApp.getDeviceOrientation();!
!
! ! ok(spy.calledOnce);!
! ! ok(spy.calledWith('(orientation:portrait)');!
!
! ! spy.restore();!
});
test('windows matchmedia', 3, function() {! !
! var stub = sinon.stub(window, 'matchMedia');!
!
! ! window.matchMedia.returns({!
! ! ! ! matches: false!
! ! });!
!
! ! equal(MyApp.getDeviceOrientation(), 'landscape');!
! ! ok(window.matchMedia.calledOnce);!
! ! ok(window.matchMedia!
! ! ! ! .calledWith('(orientation:portrait)');!
! ! stub.restore();!
});
AJAX
test('ajax call', 2, function() {!
! ! var ajaxStub = sinon.stub($, 'ajax');!
! ! ajaxStub.yieldsTo('success', { results: […] });!
! ! ! !
! ! equal($('#news li').length, 5);!
!
! ! $('.load-more').trigger('click');!
! ! equal($('#news li').length, 10);!
!
! ! ajaxStub.restore();!
});
Can’t mock?
GET CREATIVE!
asyncTest('redirect', 1, function() {!! !
! ! $('window').on('beforeunload', function(e){!
! ! ! ! e.preventDefault();!
! ! ! ! ok(true, 'redirect works');!
! ! ! ! start();!
! ! });!
!
! ! window.location.href = 'newLocation';!
});
asyncTest('script onload', 2, function() {! ! !
! ! var oldIB = HTMLElement.prototype.insertBefore,!
! ! ! ! scripts = [];!
! ! !
! ! HTMLElement.prototype!
! ! ! ! .insertBefore = function(script){!
! ! ! ! ! ! scripts.push(script);!
! ! ! ! };!
! ! !
! ! MyApp.loadScript('fake_url', function(){!
! ! ! ! ok(true);!
! ! });!
! !
! ! var script = scripts[0];!
! ! equal(script.src, 'fake_url');!
!
! ! script.onload();!
!
! ! HTMLElement.prototype.insertBefore = oldIB;!! !
});
Selenium Hell
Automatable !Automatable
Feature
Code
Unit
Acceptance Usability
Code Review
Linting Styleguide
Integration Manual Testing
http://beginner.worth1000.com/entries/79392/red-fire
Back to square one…
“…then you’re doing it wrong”
http://www.brianorndorf.com/2010/07/reliving-the-summer-of-1990-week-eight.html
The Spirit of Testing
How to do it right?
Forget the framework 

in the short-term
Don’t automate
something just	

because you can
Can this be automated?	

Are there technical reasons why this can’t be
automated, or practical reasons why automation
isn’t the best candidate	

!
Does this need to be automated?	

What is the actual benefit in making this an
automated test? How would it benefit the the
chain of work? How would it benefit the team?
Learn when to automate
Prioritise

(business critical vs nice to have)
A learning process
Programming is magic
“Software development is a
learning process, working
code is a side effect”	

– Alberto Brandolini
Remember
being
a kid?
https://parentsavvy.com/child-health/?SubtopicId=30014,30017&DocId=1,2954
“The greatest thing about
being a scientist is you never
have to grow up”	

– Neil deGrasseTyson
A scientific method is by
definition, repeatable. 



If an experimental result
cannot be verified by
repetition, it is not scientific.
Applying this method to
programming is…
http://en.wikipedia.org/wiki/Marie_Curie
http://en.wikipedia.org/wiki/Marie_Curie
The Spirit
of Testing
marco@fromthefront.it	

http://cedmax.com	

@cedmax
http://en.wikipedia.org/wiki/Marie_Curie
The Spirit
of Testing
marco@fromthefront.it	

http://cedmax.com	

@cedmax

More Related Content

PDF
JavaScript and HTML5 - Brave New World (revised)
PDF
jQuery: Events, Animation, Ajax
PPTX
JavaScript APIs you’ve never heard of (and some you have)
PPTX
FuncUnit
PDF
meet.js - QooXDoo
PPTX
Canjs
PDF
HTML5 APIs - Where no man has gone before! - Altran
KEY
jQuery Anti-Patterns for Performance & Compression
JavaScript and HTML5 - Brave New World (revised)
jQuery: Events, Animation, Ajax
JavaScript APIs you’ve never heard of (and some you have)
FuncUnit
meet.js - QooXDoo
Canjs
HTML5 APIs - Where no man has gone before! - Altran
jQuery Anti-Patterns for Performance & Compression

What's hot (20)

PPT
jQuery 1.7 Events
PDF
Basic Tutorial of React for Programmers
PDF
Stack Overflow Austin - jQuery for Developers
PPTX
Unobtrusive javascript with jQuery
PDF
jQuery Features to Avoid
PDF
To Err Is Human
PDF
jQuery Essentials
PDF
jQuery Basic API
PPTX
jQuery quick tuts
PDF
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
PDF
The Open Web and what it means
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
PDF
Writing JavaScript that doesn't suck
PDF
Drupal, meet Assetic
PDF
YUI on the go
PDF
Organizing Code with JavascriptMVC
PDF
04 Advanced Javascript
jQuery 1.7 Events
Basic Tutorial of React for Programmers
Stack Overflow Austin - jQuery for Developers
Unobtrusive javascript with jQuery
jQuery Features to Avoid
To Err Is Human
jQuery Essentials
jQuery Basic API
jQuery quick tuts
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
The Open Web and what it means
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
Writing JavaScript that doesn't suck
Drupal, meet Assetic
YUI on the go
Organizing Code with JavascriptMVC
04 Advanced Javascript
Ad

Viewers also liked (6)

PDF
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
PDF
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
KEY
jsDay - Javascript as a programming language
KEY
YOOX Launch & Learn - Javascript as a programming language
PDF
Back To The Front - Javascript Test Driven Development is between us (workshop)
PDF
A developers' journey into building automated tests for IT from the ground up
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
jsDay - Javascript as a programming language
YOOX Launch & Learn - Javascript as a programming language
Back To The Front - Javascript Test Driven Development is between us (workshop)
A developers' journey into building automated tests for IT from the ground up
Ad

Similar to The Spirit of Testing (20)

PPTX
Automated Testing using JavaScript
PDF
End to-end testing from rookie to pro
PPTX
Java script unit testing
PPTX
Test automation expert days
KEY
Rapid Testing, Rapid Development
PDF
Unit Testing JavaScript Applications
PPTX
Selenium WebDriver - Test automation for web applications
PPTX
Designing Self-maintaining UI Tests for Web Applications
PPTX
Web Testing
PPTX
Test Automation
PDF
The Testing Planet - July 2010
KEY
jQuery Bay Area Conference 2010
PDF
Automated Web Testing using JavaScript
PDF
Tools. Techniques. Trouble?
PDF
Automating The New York Times Crossword by Phil Wells
PPTX
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
PDF
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
PPTX
Tdd final submission
PDF
ITB 2023 10 Techniques for writing easy yet stupidly thorough unit tests_Dan ...
PPT
Js unit testing
Automated Testing using JavaScript
End to-end testing from rookie to pro
Java script unit testing
Test automation expert days
Rapid Testing, Rapid Development
Unit Testing JavaScript Applications
Selenium WebDriver - Test automation for web applications
Designing Self-maintaining UI Tests for Web Applications
Web Testing
Test Automation
The Testing Planet - July 2010
jQuery Bay Area Conference 2010
Automated Web Testing using JavaScript
Tools. Techniques. Trouble?
Automating The New York Times Crossword by Phil Wells
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Tdd final submission
ITB 2023 10 Techniques for writing easy yet stupidly thorough unit tests_Dan ...
Js unit testing

Recently uploaded (20)

PDF
System and Network Administration Chapter 2
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Transform Your Business with a Software ERP System
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
System and Network Administraation Chapter 3
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
AI in Product Development-omnex systems
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
System and Network Administration Chapter 2
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Which alternative to Crystal Reports is best for small or large businesses.pdf
Transform Your Business with a Software ERP System
Operating system designcfffgfgggggggvggggggggg
Odoo Companies in India – Driving Business Transformation.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Softaken Excel to vCard Converter Software.pdf
Odoo POS Development Services by CandidRoot Solutions
System and Network Administraation Chapter 3
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
2025 Textile ERP Trends: SAP, Odoo & Oracle
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
ManageIQ - Sprint 268 Review - Slide Deck
AI in Product Development-omnex systems
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx

The Spirit of Testing