Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Jasmine, BDD for JavaScript
Search
Chris Bushell
May 18, 2011
140
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Jasmine, BDD for JavaScript
Prepared for the Melbourne Patterns Group
Chris Bushell
May 18, 2011
More Decks by Chris Bushell
See All by Chris Bushell
Test Automation for Packaged Systems: Yes You Can!
cbushell
0
97
Introduction to Pair Programming
cbushell
1
150
An Introduction to BDD
cbushell
5
200
An Introduction to HTTP
cbushell
2
170
Agile Test Automation
cbushell
2
210
Working Effectively With Legacy Code
cbushell
4
270
Branches Are For Trees. How to Develop Software Without Them
cbushell
1
130
State Pattern From GoF
cbushell
1
86
Continuous Integration, fast builds and Flot
cbushell
2
92
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
660
Navigating Team Friction
lara
192
16k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
エンジニアに許された特別な時間の終わり
watany
109
250k
ラッコキーワード サービス紹介資料
rakko
5
5.6M
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
47k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
500
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Why Our Code Smells
bkeepers
PRO
340
58k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
540
Code Review Best Practice
trishagee
74
20k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Transcript
BDD for JavaScript
A li1le history….
1995, Netscape, Mocha, LiveScript, JavaScript (aka ECMAScript)
None
1999, MicrosoD, XMLHTTPRequest
2004, GMail
2005, Jesse James Garret, Ajax: A New Approach to
Web ApplicaWons
None
2011, GitHub
Development has outpaced tesWng maturity
Why the tendency only to integraWon test our JavaScript?
An idea! Test driven JavaScript
Meet Jasmine…. and JsUnit and JsTestDriver
and Screw.Unit and JSMockito etc.
Why Jasmine? RSpec like syntax Super fast
Easy to integrate Runs anywhere JavaScript runs Supports tesWng of asynchronous code
So, show me….
Some extensions h1ps://github.com/mhevery/jasmine-‐node h1p://rudyla1ae.github.com/jasmine-‐species h1ps://github.com/pivotal/jasmine-‐ajax
Jasmine jQuery • Custom matchers • toHaveHtml(string)
• toBeHidden() • toBeSelected() • spyOnEvent($(‘#some element’), ‘click’) • An API for loading HTML fixtures • loadFixtures(‘myFixturesFile.html’);
Working with the DOM • DRY • Use
your applicaWon to generate the fixture data from actual views • Load the fixture using XHR • Example: h1ps://github.com/pivotaljb/js-‐ fixture-‐example
Watch out for…. • Syntax errors cause specs to
fail silently • Different browsers, different traces