Académique Documents
Professionnel Documents
Culture Documents
Development
Writing software that matters
Aslak Hellesøy - Chief Scientist - BEKK
Stakeholders
Programmers
Dual audience
2
Origin and inspiration
JBehave Test Driven FIT
Dan North Development Ward
Chris Matts Kent Beck Cunningham
Example Driven Chelimsky,
User Stories
Development Hellesøy, Takita,
Mike Cohn
Brian Marick Astels, Baker
Connextra Domain Driven Acceptance-
Stories Design Test Driven
Several Eric Evans Planning
Software development is
all about delivering
business value
4
What’s being
used
8
Ubiqutous Language
10
BDD User Stories
Withdraw Cash
Role
As an Account Holder Operation
I want to withdraw cash in an ATM
So that I can get cash when the bank
is closed 1
Business value
Origin: Connextra
Challenge:
Common understanding
of “Done”
13
BDD Scenarios
Product Backlog
Write Iteration
Scenarios Planning
?
3
Write a Refactor
passing test
Developers don’t know...
• Where to start
• What to test
• What not to test
• How much to test in one go
• What to call tests
• How to fix a broken test
• That TDD is about design
Outside-In
1
2
3
4
5
Downloads Contributors
40,000 100
30,000 75
20,000 50
10,000 25
0 0
June 2007 February 2008 June 2007 February 2008
2,484.75 30
1,656.50 20
828.25 10
0 0
June 2007 February 2008 June 2007 February 2008
JRuby << RSpec
RSpec consists of
2 parts
Story Framework
Example Framework
RSpec User Stories
Story: Log in
As a Project contributor
I want to log in
So that I can see what projects I have access to
describe Bowling do
before(:each) do
@bowling = Bowling.new
end
As an account holder
I want to withdraw money
1
So that I can get cash when the bank is closed
2 describe Bank do
it "should not be creatable with negative balance" do
lambda do
3 Bank.new(-9)
end.should(raise_error("Negative balance"))
end
4 end
5
Summary
• As a <Role>, I want <Operation> So that
<Business value>
• Given <Known state>, When I <Action>,
Then <Expected outcome>
• Work Outside-in in the layer onion
• Write scenarios and tests bottom up (start
with outcome)
• Tests are sentences
References
• http://behaviour-driven.org/
• http://dannorth.net/introducing-bdd/
• http://dannorth.net/whats-in-a-story/
• http://rspec.info/
• http://jtestr.codehaus.org/
• http://jruby.codehaus.org/
• http://blog.aslakhellesoy.com/