Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
TDD With Ember.js
Search
Kerrick Long
March 06, 2014
Programming
0
1.1k
TDD With Ember.js
Kerrick Long
March 06, 2014
Tweet
Share
More Decks by Kerrick Long
See All by Kerrick Long
15 Things You Shouldn't Do In Ember Anymore
kerrick
0
1.1k
The ECMAScript formerly known as 6
kerrick
0
1.3k
CSS Study Group 1
kerrick
0
1.3k
CSS Study Group 2
kerrick
1
1.1k
Services & Component Collaboration
kerrick
0
780
Donate STL #Build4STL Hackathon Keynote
kerrick
0
380
Donate STL
kerrick
0
820
JavaScript Promises - Thinking Sync in an Async World
kerrick
20
8k
Other Decks in Programming
See All in Programming
Private APIの呼び出し方
kishikawakatsumi
3
890
知られているようで知られていない JavaScriptの仕様 4選
syumai
0
630
複数チーム並行開発下でのコード移行アプローチ ~手動 Codemod から「生成AI 活用」への進化
andpad
0
180
OSS開発者の憂鬱
yusukebe
12
5.3k
なぜ強調表示できず ** が表示されるのか — Perlで始まったMarkdownの歴史と日本語文書における課題
kwahiro
12
7k
Eloquentを使ってどこまでコードの治安を保てるのか?を新人が考察してみた
itokoh0405
0
3.2k
Tangible Code
chobishiba
3
680
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
4.6k
Chart.jsで長い項目を表示するときのハマりどころ
yumechi
0
130
What's New in Web AI?
christianliebel
PRO
0
130
CloudflareのSandbox SDKを試してみた
syumai
0
170
Phronetic Team with AI - Agile Japan 2025 closing
hiranabe
2
650
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The World Runs on Bad Software
bkeepers
PRO
72
12k
YesSQL, Process and Tooling at Scale
rocio
174
15k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
What's in a price? How to price your products and services
michaelherold
246
12k
Producing Creativity
orderedlist
PRO
348
40k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Thoughts on Productivity
jonyablonski
73
4.9k
Transcript
Test Driven Development
Kerrick Long Things I make and do Where to find
me online twitter.com/KerrickLong github.com/Kerrick Lead Front-end Developer at Second Street KerrickLong.com www. meetup.com/STLEmber
Why TDD?
Outside-In
Integration Tests Unit Tests then
Red Green Refactor
Green Refactor
Test-Driven Design
How?
Integration Test
Integration Test
Integration Test Unit Test
Integration Test Unit Test
Integration Test Unit Test Unit Test Unit Test
Integration Test Unit Test Unit Test Unit Test
Integration Test Unit Test Unit Test Unit Test Unit Test
Integration Test Unit Test Unit Test Unit Test Unit Test
Integration Test Unit Test Unit Test Unit Test Unit Test
Integration Test Unit Test Unit Test Unit Test Unit Test
Integration Test Unit Test Unit Test Unit Test Unit Test
Tooling
Karma Test Runner
None
None
None
None
QUnit.js
Assertions
QUnit.assert.ok( makeBoolean() ) Assertions
QUnit.assert.equal( makeTen(), '10' ) Assertions
QUnit.assert.strictEqual( makeTen(), 10 ) Assertions
QUnit.assert.deepEqual( makeObject(), { foo: ‘bar’, baz: 10 } ) Assertions
QUnit.assert.propEqual( makeObject(), { foo: ‘bar’, baz: 10 } ) Assertions
QUnit.assert.throws( function() { throwError() }, ‘Example Thrown Error’ ) Assertions
Ember Test Helpers
App.rootElement = ‘#qunit-fixture’ App.setupForTesting() App.injectTestHelpers(QUnit)
QUnit.visit(‘/posts’)
QUnit.find(‘.add’, ‘.list’)
QUnit.fillIn( ‘.name’, ‘Kerrick’ )
QUnit.click(‘.submit’)
QUnit.keyEvent( ‘.wysiwyg’, ‘keypress’, 30 )
QUnit.visit(‘/posts/new’) .fillIn(‘.name’, ‘Hello’) .click(‘.submit’) .then(function() { QUnit.assert.ok(true) })
QUnit.visit(‘/posts/new’) QUnit.fillIn(‘.name’, ‘Hi’) QUnit.click(‘.submit’) QUnit.andThen(function() { QUnit.assert.ok(true) })
QUnit.visit(‘/posts/new’) QUnit.fillIn(‘.name’, ‘Hi’) QUnit.click(‘.submit’) QUnit.andThen(function() { QUnit.assert.ok(true) })
Integration Tests
Controller Unit Tests
Component Unit Tests
Mixin Unit Tests
Component Unit Tests