Specification by example What? How? When? Marcus Hammarberg
Sep 18, 2014
http://www.youtube.com/aptitudsthlm
Bandung
Theory of Constraints
Where is our bottleneck?
http://images.nationalgeographic.com/wpf/media-live/photos/000/212/cache/sinkholes-holes-ground-2007-guatemala-sinkhole_21282_600x450.jpg
Deliberate Discovery
Gojko Adzic
... it’s no silver bullet, but it seems
like a good start
Dan North
http://manning.com/adzic/From Specification by Example
Used with permission
http://www.wallpaperpimper.com/wallpaper/Military/F_16_Fighting_Falcon/F-16-Fighting-Falcon-20-9XTZMAN20G-1280x1024.jpg
http://www.wallpaperpimper.com/wallpaper/Military/F_16_Fighting_Falcon/F-16-Fighting-Falcon-20-9XTZMAN20G-1280x1024.jpg
Who sets scope?
http://2.bp.blogspot.com/-mJ8gPBlBRjY/TcYv9xOuWlI/AAAAAAAAKvY/0JniIDxlBjY/s1600/how-to-get-your-boss-off-your-back.jpg
How do they know what they want?
How do they know what they want?
Don’t let the customer
limit themselves
http://www.realestateradiousa.com/blog/wp-content/uploads/2008/09/straitjacket.jpg
Derive scope from business goals
http://cojent7.files.wordpress.com/2010/04/business-goals1.jpg
Build the right thing!
1. Start with wide end of it on your right and extending a foot below the narrow end 2. Cross wide end over narrow and turn back underneath 3. Bring up and turn down to loop 4. Pass wide end around frong from left to right 5. Then, up through loop ... 6. And down through knot in front. Tigthen carefully and draw up to collar.
Go concrete with exampleshttp://www.flickr.com/photos/bensutherland/3961418687/
Scenario 1: Account is in credit!Given the account is in credit!And the card is valid!And the dispenser contains cash!When the customer requests €50!Then ! ensure the account is debited €50!And ensure €40 is dispensed!And ensure the card is returned
Key examples
Key examples
http://www.bigideastobigresults.com/wp-content/uploads/2009/09/good_enough.jpg
Let’s try that, shall we?
Customers who buys three books gets free shipping
Customers who buys three books gets free shipping
Number of books Free shipping?
Customers who buys three books gets free shipping
Number of books Free shipping?1 -
Customers who buys three books gets free shipping
Number of books Free shipping?
21
--
Customers who buys three books gets free shipping
Number of books Free shipping?
23
1-X
-
Customers who buys three books gets free shipping
Number of books Free shipping?
234
1-XX
-
To get a loan you need to be older than 18
To get a loan you need to be older than 18
Age of applicant Can take loan?
To get a loan you need to be older than 18
Age of applicant Can take loan?17 -
To get a loan you need to be older than 18
Age of applicant Can take loan?
1817
X-
To get a loan you need to be older than 18
Age of applicant Can take loan?
1819
17XX
-
To get a loan you need to be older than 18
Age of applicant Can take loan?
1819null?
17XXeeeeh?
-
http://www.flickr.com/photos/toastytreat/4555895229
Text
Who writes this stuff anyway?
Refactor the specification
Examples should be precise and testable
Examples should be precise and testable
Scripts are not specifications
Examples should be precise and testable
Scripts are not specifications
Specifications should be about business functionality, not software design
Examples should be precise and testable
Scripts are not specifications
Specifications should be about business functionality, not software design
Specifications should be self-explanatory
Examples should be precise and testable
Scripts are not specifications
Specifications should be about business functionality, not software design
Specifications should be self-explanatory
Specifications should be in domain language
Sharedunderstanding
Sharedunderstanding
Testing
Sharedunderstanding
Testing
Documentation
Automation
http://jbehave.org/reference/stable/images/jbehave-logo.png
http://lh5.ggpht.com/_X3kaawac_g4/S0nxyUKaIYI/AAAAAAAAAu0/CtKaMavsxoM/cucumber.jpg?imgmax=800
http://lh6.ggpht.com/_X3kaawac_g4/SuoT1Yd67pI/AAAAAAAAArU/dhE-WLR0VKE/Unbenannt.png?imgmax=800
A Cucumber ScenarioScenario 1: Account is in credit!Given the account is in credit!And the card is valid!And the dispenser contains cash!When the customer requests €50!Then ! ensure the account is debited €50!And ensure €50 is dispensed!And ensure the card is returned
http://1.bp.blogspot.com/-3yjyeeTpRFI/Tea15VHttaI/AAAAAAAAC3w/YXoTDAv9tx8/s1600/hard_work.png
One document to rule them all ...
http://www.questpartnership.co.uk/blog/uploaded_images/restructuring-775119.jpg
“... features are an executable map of the current functionality of the system.”
Andrew Premdas (BDD Google Group)
ToC and Specification by example
ToC and Specification by example
• Better communication
ToC and Specification by example
• Better communication
• Concrete examples
ToC and Specification by example
• Better communication
• Concrete examples
• Frequent validation
ToC and Specification by example
• Better communication
• Concrete examples
• Frequent validation
• Living documentation
Learn more
Learn more
Learn more
Learn more
Learn more
Learn more