Taking lessons from the classic writings on Software Testing, we'll walk through what are industry tried and true approaches for developing a robust and effective test suite.
Many of the Testing philosophies and strategies today have their origins as far back as the 60's, and really got their legs during the advent of "Extreme Programming" and other early "Agile" methodologies from the 1990s.
In this talk we'll take many of these tried and true test strategies and show how one would apply them in a real way to an Ember project.
17. Boehm’s Law
0
$
$$
$$$
Requirments Design Development Test Prod
https://docs.google.com/viewer?url=https%3A%2F%2Fwww.cs.umd.edu%2Fprojects%2FSoftEng%2FESEG%2Fpapers%2F82.78.pdf
26. Ember Testing
Ember Unit Tests - Call functions directly
(10-100ms)
Ember Rendering Tests - Call components via the
template compiler (200-600 ms)
Ember Application Tests - Interact with the entire
Ember application through the browser
(700-3000ms with stubbed HTTP)
33. “The original description of TDD was in an
ancient book about programming.
It said you take the input tape, manually
type in the output tape you expect,
then program until the actual output tape
matches the expected output. ”
-Kent Beck: OG Extreme Programmer, TDD Rediscoverer
57. Classic TDD
Test
Your object tree forms as part of
your refactor step
Test
API
https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530
58. Example in Ember: A Page Component
Last
Email
Submit
First
Input: Object with First, Last,
Email, Profile Pic
Input: Save action
Output: Rendered DOM
Output: Action invoked
Upload
70. TDD with Mock Objects
Mocks assert the behavior
of your object’s
collaborators
Enable a form of “Need
Driven Development”
See sinon.js and ember-
sinon
https://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627
https://docs.google.com/viewer?url=http%3A%2F%2Fjmock.org%2Foopsla2004.pdf
79. Example in Ember: Chat Service
Hi!
New phone,
who dis?
todd.jordan
locks
1:00pm
1:05pm
Fetches chat history
Receives incoming messages in
realtime
Sends outgoing messages
95. - Nat Pryce, co-author: JMock, GOOS
“Mock objects are just a tool. They are one of many
tools that you need to use when doing TDD. Like any
tool, they are designed to help solve a set of
problems in a specific context.”
“So, instead of treating mock objects, or any other
technique or tool, as an all-or-nothing "golden
hammer", it's more helpful to understand where that
tool fits into the broader picture of TDD practice.”
https://groups.yahoo.com/neo/groups/testdrivendevelopment/conversations/messages/29686
97. Do I Have To?
https://giphy.com/gifs/star-trek-riker-tng-tYelSVzQPtLdm
98. Do I Have To?
https://giphy.com/gifs/star-trek-riker-tng-tYelSVzQPtLdm
99. The Flawed Theory Behind Unit Testing
Classical TDD
Mockist TDD
Clean Room
Design By Contract
Michael Feathers
https://michaelfeathers.typepad.com/michael_feathers_blog/2008/06/the-flawed-theo.html
100. The Flawed Theory Behind Unit Testing
Classical TDD
Mockist TDD
Clean Room
Design By Contract
Michael Feathers
https://michaelfeathers.typepad.com/michael_feathers_blog/2008/06/the-flawed-theo.html
All
101. –Michael Feathers
“Quality is a function of thought and
reflection - precise thought and reflection.
That’s the magic. Techniques which
reinforce that discipline invariably increase
quality.”
102. Keep an eye on your feedback loops
Test in a methodical way that drives design
Thought and discipline are faster than quickly
spitting out code