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 revisited - outside-in
Search
Matt Yoho
June 21, 2012
1
110
testing revisited - outside-in
Matt Yoho
June 21, 2012
Tweet
Share
More Decks by Matt Yoho
See All by Matt Yoho
Working with Git and GitHub
mattyoho
4
300
Qualitative Analysis of Algorithms
mattyoho
5
410
Metaprogramming Ruby
mattyoho
19
670
Exploiting The Resource Idiom
mattyoho
2
390
shared_auth.pdf
mattyoho
0
2.3k
background job patterns
mattyoho
2
490
Request-Response cycle
mattyoho
5
180
Intro to Rest
mattyoho
6
580
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
6
220
The Invisible Side of Design
smashingmag
299
50k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Designing for Performance
lara
604
68k
Site-Speed That Sticks
csswizardry
3
310
Testing 201, or: Great Expectations
jmmastey
41
7.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Transcript
Testing Revisited: Driving Implementation with Outside-in Specs Thursday, June 21,
12
Testing isn’t about verification, per se Thursday, June 21, 12
It’s a design tool Thursday, June 21, 12
An outline Thursday, June 21, 12
Executable system specification Thursday, June 21, 12
Red Green Refactor Thursday, June 21, 12
1) Write a spec Thursday, June 21, 12
1) Write a spec See it fail Thursday, June 21,
12
2) Write enough code to make it pass Thursday, June
21, 12
2) Write enough code to make it pass Make it
green Thursday, June 21, 12
3) Refactor the implementation and/or specs Thursday, June 21, 12
3) Refactor the implementation and/or specs Clean the code, reduce
duplication Thursday, June 21, 12
http://jakegoulding.com/blog/2011/10/10/learned-about-testing-last-year/ Thursday, June 21, 12
1) Write an acceptance test Thursday, June 21, 12
1a) Write a spec Thursday, June 21, 12
1b) Write enough code to make it pass Thursday, June
21, 12
1c) Refactor the implementation and/or specs Thursday, June 21, 12
2) Write enough unit tests and code to pass the
acceptance test Thursday, June 21, 12
3) Refactor Thursday, June 21, 12
4) Repeat Thursday, June 21, 12
Sometimes, we want to isolate the item under test from
another dependency Thursday, June 21, 12
A dependency is any external piece of code the item
under test relies on or collaborates with Thursday, June 21, 12
When a dependency is expensive or difficult to use, it
may be a good idea to swap it out for a test double Thursday, June 21, 12
Test doubles: stubs and mocks Thursday, June 21, 12
stub: a “dumb” stand-in for a real object that responds
to messages (methods), sometimes returning canned responses Thursday, June 21, 12
Used when we want to isolate the code under test
from uncertainty or costly execution Thursday, June 21, 12
mock: a stand-in for a real object that expects to
receive messages (methods) and provides testing verification Thursday, June 21, 12
Used when we want to test (verify) that the code
under test collaborates properly with its depedencies Thursday, June 21, 12
Random thoughts Thursday, June 21, 12
Testing is hard - especially BDD/TDD Thursday, June 21, 12
Well, it’s easy. It’s just subtle. Thursday, June 21, 12
Practice, practice, practice. Thursday, June 21, 12
People do it “wrong”. Often. Thursday, June 21, 12
They will think they’re doing it right. Or at least,
doing it less wrong than they are. Thursday, June 21, 12
Testing is a religion - especially TDD/BDD Thursday, June 21,
12
Testing is a religion - especially TDD/BDD People will evangelize.
Thursday, June 21, 12
Testing is a religion - especially TDD/BDD People will evangelize.
And they’re wrong. Thursday, June 21, 12
Read. Learn. Practice, practice, practice. Thursday, June 21, 12
Example: Add refeeds to simple_feed Include “refeeded” count Thursday, June
21, 12
Exercise: Add show/hide item to simple_feed Add a link on
items the user owns to hide them, or to show them for hidden items. Thursday, June 21, 12