×
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
Testing Revisited: Driving Implementation with Outside-in Specs Thursday, June 21, 12
Slide 2
Slide 2 text
Testing isn’t about verification, per se Thursday, June 21, 12
Slide 3
Slide 3 text
It’s a design tool Thursday, June 21, 12
Slide 4
Slide 4 text
An outline Thursday, June 21, 12
Slide 5
Slide 5 text
Executable system specification Thursday, June 21, 12
Slide 6
Slide 6 text
Red Green Refactor Thursday, June 21, 12
Slide 7
Slide 7 text
1) Write a spec Thursday, June 21, 12
Slide 8
Slide 8 text
1) Write a spec See it fail Thursday, June 21, 12
Slide 9
Slide 9 text
2) Write enough code to make it pass Thursday, June 21, 12
Slide 10
Slide 10 text
2) Write enough code to make it pass Make it green Thursday, June 21, 12
Slide 11
Slide 11 text
3) Refactor the implementation and/or specs Thursday, June 21, 12
Slide 12
Slide 12 text
3) Refactor the implementation and/or specs Clean the code, reduce duplication Thursday, June 21, 12
Slide 13
Slide 13 text
http://jakegoulding.com/blog/2011/10/10/learned-about-testing-last-year/ Thursday, June 21, 12
Slide 14
Slide 14 text
1) Write an acceptance test Thursday, June 21, 12
Slide 15
Slide 15 text
1a) Write a spec Thursday, June 21, 12
Slide 16
Slide 16 text
1b) Write enough code to make it pass Thursday, June 21, 12
Slide 17
Slide 17 text
1c) Refactor the implementation and/or specs Thursday, June 21, 12
Slide 18
Slide 18 text
2) Write enough unit tests and code to pass the acceptance test Thursday, June 21, 12
Slide 19
Slide 19 text
3) Refactor Thursday, June 21, 12
Slide 20
Slide 20 text
4) Repeat Thursday, June 21, 12
Slide 21
Slide 21 text
Sometimes, we want to isolate the item under test from another dependency Thursday, June 21, 12
Slide 22
Slide 22 text
A dependency is any external piece of code the item under test relies on or collaborates with Thursday, June 21, 12
Slide 23
Slide 23 text
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
Slide 24
Slide 24 text
Test doubles: stubs and mocks Thursday, June 21, 12
Slide 25
Slide 25 text
stub: a “dumb” stand-in for a real object that responds to messages (methods), sometimes returning canned responses Thursday, June 21, 12
Slide 26
Slide 26 text
Used when we want to isolate the code under test from uncertainty or costly execution Thursday, June 21, 12
Slide 27
Slide 27 text
mock: a stand-in for a real object that expects to receive messages (methods) and provides testing verification Thursday, June 21, 12
Slide 28
Slide 28 text
Used when we want to test (verify) that the code under test collaborates properly with its depedencies Thursday, June 21, 12
Slide 29
Slide 29 text
Random thoughts Thursday, June 21, 12
Slide 30
Slide 30 text
Testing is hard - especially BDD/TDD Thursday, June 21, 12
Slide 31
Slide 31 text
Well, it’s easy. It’s just subtle. Thursday, June 21, 12
Slide 32
Slide 32 text
Practice, practice, practice. Thursday, June 21, 12
Slide 33
Slide 33 text
People do it “wrong”. Often. Thursday, June 21, 12
Slide 34
Slide 34 text
They will think they’re doing it right. Or at least, doing it less wrong than they are. Thursday, June 21, 12
Slide 35
Slide 35 text
Testing is a religion - especially TDD/BDD Thursday, June 21, 12
Slide 36
Slide 36 text
Testing is a religion - especially TDD/BDD People will evangelize. Thursday, June 21, 12
Slide 37
Slide 37 text
Testing is a religion - especially TDD/BDD People will evangelize. And they’re wrong. Thursday, June 21, 12
Slide 38
Slide 38 text
Read. Learn. Practice, practice, practice. Thursday, June 21, 12
Slide 39
Slide 39 text
Example: Add refeeds to simple_feed Include “refeeded” count Thursday, June 21, 12
Slide 40
Slide 40 text
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