×
Copy
Open
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
ACT II - ACCEPTANCE TESTING In which our hero ventures into uncharted territory
Slide 2
Slide 2 text
TO MOCK OR NOT TO MOCK? To mock!! Drugs are BAAD! Using the real server is slow & an added dependency is even more BAAAAD
Slide 3
Slide 3 text
IC-AJAX Very simple interface! Supports returning server errors! Ships with the ember-app-kit (EAK) and the future-proof ember-cli
Slide 4
Slide 4 text
ALTERNATIVES ember-testing-httpRespond! Ships with EAK! sinon.js! great for mocking out timers
Slide 5
Slide 5 text
FIXTURES Rosie! Rolling your own! DS.FixtureAdapter
Slide 6
Slide 6 text
ROSIE https://github.com/bkeepers/rosie
Slide 7
Slide 7 text
DS.FIXTUREADAPTER Can’t test server error responses! Depends on ember-data! Mostly useful for development
Slide 8
Slide 8 text
TEST HELPERS
Slide 9
Slide 9 text
ASYNC HELPERS FROM EMBER-TESTING visit! click! fillIn! keyEvent! triggerEvent! andThen
Slide 10
Slide 10 text
BUT WAIT! All these (async) helpers return wait(), a promise that waits for all async operations to finish
Slide 11
Slide 11 text
SYNC HELPERS FROM EMBER-TESTING find(cssSelector)! currentPath! currentRouteName! currentURL
Slide 12
Slide 12 text
EXAMPLE I testing for content
Slide 13
Slide 13 text
CODE EXAMPLE FOR A TEST testing location
Slide 14
Slide 14 text
EXAMPLES sync and async
Slide 15
Slide 15 text
RUN’EM! via qunit in the browser! via testem from the command line! EAK has both these already set up
Slide 16
Slide 16 text
EXAMPLE qunit in the browser
Slide 17
Slide 17 text
EXAMPLE testem from the cmdline