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
77
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
84
Functional Reactive Programming with BaconJS
tomkr
0
82
Philosophy for Web Developers
tomkr
0
68
An Introduction to Leaflet
tomkr
0
100
Ember on Rails
tomkr
4
180
Other Decks in Programming
See All in Programming
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
240
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
330
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
860
1B+ /day規模のログを管理する技術
broadleaf
0
140
分散システム、なんですぐ死んでしまうん?耐障害性を高めたいあなたのためのレジリエンスパターン入門
mshibuya
7
6.3k
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
170
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
170
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
430
Foundation Models frameworkで画像分析
ryodeveloper
1
120
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
220
Claude Team Plan導入・ガイド
tk3fftk
0
210
共通化で考えるべきは、実装より公開する型だった
codeegg
0
250
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
220
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
730
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
830
Done Done
chrislema
186
16k
Site-Speed That Sticks
csswizardry
13
1.3k
Abbi's Birthday
coloredviolet
3
8.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
370
Code Reviewing Like a Champion
maltzj
528
40k
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