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 - The Next Frontier
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Robert Jackson
March 10, 2016
Programming
1
86
Testing - The Next Frontier
Talk given at the Boston Ember meetup on 2016-03-10.
Robert Jackson
March 10, 2016
Tweet
Share
More Decks by Robert Jackson
See All by Robert Jackson
😂 of TypeScript
rwjblue
0
350
Testing: The Modern Way
rwjblue
0
59
Glimmer ✨ as a Gateway to Ember 🐹
rwjblue
0
68
Testing: The Future... Today?
rwjblue
0
68
Rails Developer's Intro to Ember
rwjblue
1
190
A tale of two pods
rwjblue
3
860
Ember 2.0 - RFC Recap
rwjblue
6
690
Ember CLI Addons
rwjblue
7
820
RAILS + EMBER.JS + EMBER-CLI = ❤
rwjblue
10
1.8k
Other Decks in Programming
See All in Programming
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
870
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
460
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
660
GISエンジニアから見たLINKSデータ
nokonoko1203
0
190
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
340
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
400
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
150
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
5.7k
Basic Architectures
denyspoltorak
0
520
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
510
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
130
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
120
Featured
See All Featured
Ethics towards AI in product and experience design
skipperchong
2
180
ラッコキーワード サービス紹介資料
rakko
1
2.1M
30 Presentation Tips
portentint
PRO
1
190
Optimising Largest Contentful Paint
csswizardry
37
3.6k
WCS-LA-2024
lcolladotor
0
420
Designing for humans not robots
tammielis
254
26k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
84
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How Software Deployment tools have changed in the past 20 years
geshan
0
31k
Claude Code のすすめ
schroneko
67
210k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
85
Transcript
Testing: The Next Frontier?
None
Who the heck is this guy? • Ember Core Team
• Twitch • General Open Source Addict twitter: rwjblue github: rwjblue
Thank You!!
What are we talking about?
State of Testing Today • Acceptance • Integration • Unit
Acceptance moduleForAcceptance('Acceptance | login'); test('visiting /login', function(assert) { visit('/login'); andThen(function()
{ assert.equal(currentURL(), '/login'); }); });
Integration moduleForComponent('pretty-color', { integration: true }); test('button click', function(assert) {
this.render(hbs`{{magic-title}}`); this.$('button').click(); assert.equal(this.$().text(), 'This is Magic'); });
Unit moduleFor('route:application'); test('perform the right query', function(assert) { let route
= this.subject(); let result = route._queryString(); assert.equal(result, '?awesome=sauce'); });
Great, :shipit:
The End
Seriously?
• Built for a globals world. • “magic” `andThen` •
No ability to stub/mock services. Acceptance Test Issues
None
• Completely ignorant about async • Manual triggering of user
interaction • Much less “tailored” API Unit/Integration Test Issues
None
Now what?
emberjs/rfcs#119
• Use `async` / `await` • Consistent interface • Extendability
• Backwards Compatibility Grand Testing Unification
None
None
None
Acceptance moduleForAcceptance('Can see things'); test('clicking redirects', async function(assert) { await
visit('/things'); let list = find('.thing-item'); assert.equal(list.length, 5); await click('.thing-item[data-id=1]'); assert.equal(this.currentRouteName, 'other- thing'); });
Integration moduleForIntegration('post-display'); test('expand when clicked', async function(assert) { await render(hbs`{{post-display}}`);
await click('.post-item'); assert.equal( this.find('.post-created-at').textContent, '2016-01-05' ); });
• Overriding a service • Registering custom test helpers •
Registering custom waiters • Accessing service instances General Testing Concerns
• Hooks for work before/after tests. • Accessing general test
information General Testing Concerns
Overriding a Service import Mock from 'somewhere/else'; moduleForAcceptance('something', { beforeEach()
{ this.owner.register('service:stripe', Mock); } });
Registering Custom Helpers import selectCategory from '../helpers/select-category'; import loginAsAdmin from
'../helpers/login-as-admin'; moduleForAcceptance('Can see things', { beforeEach() { this.registerHelpers({ loginAsAdmin, selectCategory }); } });
Custom Helpers // tests/helpers/login-as-admin'; import { testHelper } from 'ember-qunit';
export default testHelper(async function() { await this.click('.login-now'); await this.fillIn('.username', 'rwjblue'); await this.fillIn('.password', 'moar beerz plz'); await this.click('.submit'); });
Custom Helpers import selectCategory from '../helpers/select-category'; import loginAsAdmin from '../helpers/login-as-admin';
moduleForAcceptance('Can see things', { beforeEach() { this.registerHelpers({ loginAsAdmin, selectCategory }); } });
Custom Waiters import { testWaiter } from 'ember-test-helpers'; import {
hasPendingTransactions } from 'app- name/services/transactions'; export default testWaiter(function() { return hasPendingTransactions(); });
Custom Waiters import transactionWaiter from '../waiters/pending-transactions'; test('stuff happens', async function(assert)
{ // Normally done in setup, but slides.... this.registerWaiter(transactionWaiter); await click('.foo'); // all pending transactions are completed here... });
Accessing Services test('foo', function(assert) { this.store = this.owner.lookup('service:store'); this.store.push(....); });
General Hooks // */tests/configuration.js import { TestConfig } from 'ember-test-helpers';
export default class extends TestConfig { beforeSuite() {} beforeEach(testType, testContext) {} afterEach(testType, testContext) {} }
General Hooks // liquid-fire's addon-test-support/configuration.js import { TestConfig } from
'ember-test-helpers'; import runningTransitionWaiter from './waiters/running-transition'; import randoHelper from './helpers/rando'; export default class extends TestConfig { beforeEach() { this.registerWaiter(runningTransitionWaiter); this.registerHelper('randoHelper', randoHelper); } }
General Hooks // mirage's addon-test-support/configuration.js import { TestConfig } from
'ember-test-helpers'; import setup from 'ember-cli-mirage/setup-server'; export default class extends TestConfiguration { beforeEach() { this.server = setup(this.owner); } }
Test Information import { testHelper } from 'ember-qunit'; export default
testHelper(function() { if (this.testInfo.type === 'acceptance') { // acceptance test stuff here } else { // integration/unit test stuff here } });
The End