Upload
riverglide
View
1.497
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Behaviour Driven Development (BDD) is an evolution of test-driven development that places explicit emphasis on language, communication and 'outside-in' development. Many people are familiar with the 'Given,When,Then' structure used in BDD specifications (or acceptance tests) but is that really where it ends? In this session Antony Marcano gives a short intro to BDD, explains 'outside-in' development. Using a metaphor from learning theory and HCI principles, he'll show you how to go beyond 'Given,When,Then' to a shared understanding of your customer's needs.
Citation preview
Behaviour Driven DevelopmentBeyond “Given, When, Then”
Antony Marcano
The Telephone Game
http://www.brokenpicturetelephone.com/
What is BDD?
Beyond “Given, When, Then”
BDD Origins
‘The deeper I got into TDD, the more I felt that my own journey had been less of a wax-on, wax-off process of gradual mastery than a series of blind alleys. I remember thinking “If only someone had told me that!”… I decided it must be possible to present TDD in a way that gets straight to the good stuff and avoids all the pitfalls. My response is behaviour-driven development (BDD). Over time, BDD has grown to encompass the wider picture of agile analysis and automated acceptance testing.’-Dan North
BDD Origins - Shortened
“ Behaviour Driven Development (BDD) builds upon Test-Driven Development (TDD) by formalising the good habits of the best TDD practitioners. ” – The Cucumber Book, Aslak Hellesøy, Matt Wynne
Some ‘Good Habits’
Slice VerticallyWork from the outside-in
One example at a time
Slice Vertically
2009 8
Traditionally, development is sliced horizontallySo
ftw
are
Com
pone
nts
(mod
ules
/cla
sses
)
Use
r Sto
ry A
Use
r Sto
ry B
Use
r Sto
ry C
Use
r Sto
ry D
Sprint n Sprint n+1… Sprint x
time
Soft
war
e Co
mpo
nent
s(m
odul
es/c
lass
es)
Logi
n
Crea
te a
lbum
Shar
e ph
otos
Priv
ate
albu
ms
Iteration n Iteration n+1… Iteration x
time
…but defers feedback (often, until it’s too late)
2009 9
Soft
war
e Co
mpo
nent
s(m
odul
es/c
lass
es)
Shar
e ph
otos
Crea
te a
lbum
Shar
e ph
otos
Logi
n
Crea
te a
lbum
Shar
e ph
otos
Priv
ate
albu
ms
Iteration n Iteration n+1 Iteration x
time
Vertical slicing
…results in earlier feedback
Work from the outside-in
Outside-in
One example at a time
One example at a time
Elaborate as anautomated scenario (aka acceptance test)
Implement story driving with unit tests Scenario should pass
When all Scenarios pass, story is done(almost)
For each Example illustrating the story
Have a conversation
One example at a time
Test should fail
Expressing Examples
Given, When, ThenAnd beyond
Given When Then
Given <some initial context>When <something happens>Then <some expectation>
Given When Then
Given <some initial context>[and some additional context]
When <something happens>[and something else happens]
Then <some expectation>[and some more expectations]
A Typical Illustration
Scenario: Login SuccessfullyGiven I am on the home-pageWhen I enter the username ‘antony’And I enter the password ‘p4$$w0rd’And I click ‘login’
Then I should be logged in
What’s wrong with this example?
A Better Illustration
Scenario: Login SuccessfullyWhen I login as ‘antony’ with the password ‘p4$$w0rd’Then I should be logged in
Why is it better?
Task Analysis
A little UX for our BDD
• Pitching it right…– Goals e.g. Withdraw Cash
• Tasks Identify to bank Request amount
– (inter)actionsInsert Card
Enter PinPress “Withdraw Cash”
Enter amountPress OK
} Just right
} Too low level
For example…
When I add, the number ‘2’ and the number ’3’
http://cukesalad.info
actions}
task
Some nice side-effects
Encourages description of UI interactions in one place
Makes it easier to execute scenariosvia different interfaces
Discussion
Questions?Ideas?
Feedback?
[email protected] @[email protected]
@RiverGlide/rs
http://twitter.com/RiverGlide/rs
http://cukesalad.info #cukesaladhttp://RiverGlide.com @RiverGlide