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
testing-ember-apps.pdf
Search
Tom Kruijsen
March 12, 2014
Programming
78
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
testing-ember-apps.pdf
Tom Kruijsen
March 12, 2014
More Decks by Tom Kruijsen
See All by Tom Kruijsen
Functional Reactive Programming in Bacon.js
tomkr
2
120
To Framework or not to Framework
tomkr
0
86
Functional Reactive Programming with BaconJS
tomkr
0
83
Philosophy for Web Developers
tomkr
0
69
An Introduction to Leaflet
tomkr
0
100
Ember on Rails
tomkr
4
190
Other Decks in Programming
See All in Programming
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
350
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
480
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
260
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
630
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
240
数百円から始めるRuby電子工作
tarosay
0
140
VibeCodingからAgenticWorkflowへ
starfish719
0
330
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
380
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
120
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
130
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
18k
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
150
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
490
Art, The Web, and Tiny UX
lynnandtonic
304
22k
For a Future-Friendly Web
brad_frost
183
10k
First, design no harm
axbom
PRO
2
1.2k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
760
Side Projects
sachag
455
43k
Git: the NoSQL Database
bkeepers
PRO
432
67k
The browser strikes back
jonoalderson
0
1.5k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
340
Transcript
Testing Ember Apps Tom Kruijsen Ember.js - 2014-03-12
Brightin
None
Warning: blatant self- promotion
Appuccino
Some questions
Integration tests with QUnit
Unit tests?
Why QUnit?
None
Konacha
Rails gem
Mocha & Chai
None
#= require 'sinon'! #= require 'application'! ! mocha.ui('bdd')! mocha.globals(['Ember', 'DS',
'Catstagram', 'MD5'])! mocha.timeout(5)! chai.Assertion.includeStack = true! ! ENV = {! TESTING: true! }! ! window.server = sinon.fakeServer.create()! ! window.testHelper =! lookup: (object, object_name) ->! name = object_name || "main"! Catstagram.__container__.lookup(object + ":" + name)! ! Catstagram.Router.reopen! location: 'none'! ! Konacha.reset = Ember.K! ! Catstagram.setupForTesting()! Catstagram.injectTestHelpers()! ! beforeEach ->! Ember.run ->! Catstagram.reset()! ! Ember.Test.adapter = Ember.Test.Adapter.create()
#= require spec_helper! ! describe "Cat", ->! it "is a
DS.Model", ->! expect(Catstagram.Cat).to.exist! expect(DS.Model.detect(Catstagram.Cat)).to.exist! ! it "has a name", =>! Ember.run( ->! cat = testHelper.lookup('store').createRecord 'cat', name: 'Mimi'! expect(cat.get 'name').to.equal 'Mimi'! )
#= require 'spec_helper'! ! describe 'Cats page', ->! beforeEach ->!
cat = Ember.Object.create! id: 1! name: 'Mimi'! ! stubStore = sinon.stub(testHelper.lookup('store'), 'find')! stubStore.withArgs('cat').returns([cat])! ! ! visit '/'! ! it 'shows the names of the cats', ->! expect($('li').text()).to.equal('Mimi')! ! it 'links to a cat page', ->! mock = sinon.mock(testHelper.lookup('route', 'cats_cat'))! mock.expects('setupController').once()! $('a').click()! mock.verify()
Mocha is nicer than QUnit
Use Sinon and mock a lot
How do you test your apps?
Testing Ember Apps Tom Kruijsen Ember.js - 2014-03-12