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
Robert Jackson
March 10, 2016
Programming
1
85
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
58
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
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
240
愛される翻訳の秘訣
kishikawakatsumi
3
370
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
110
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
540
Python札幌 LT資料
t3tra
7
1.1k
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.6k
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
340
実はマルチモーダルだった。ブラウザの組み込みAI🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
3
1.4k
PC-6001でPSG曲を鳴らすまでを全部NetBSD上の Makefile に押し込んでみた / osc2025hiroshima
tsutsui
0
210
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
180
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
650
GISエンジニアから見たLINKSデータ
nokonoko1203
0
190
Featured
See All Featured
Paper Plane (Part 1)
katiecoart
PRO
0
3k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
1
350
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Deep Space Network (abreviated)
tonyrice
0
33
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Heart Work Chapter 1 - Part 1
lfama
PRO
4
35k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Producing Creativity
orderedlist
PRO
348
40k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
880
Docker and Python
trallard
47
3.7k
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