Download - Pitt agile201505
![Page 1: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/1.jpg)
Don’t start with login!
BDD for collaboration and testing
Nate Peterson@njpetersonpa
![Page 2: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/2.jpg)
- BDD overview - Scenarios - Practices that helped - Anti-patterns - Applying BDD
![Page 3: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/3.jpg)
![Page 4: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/4.jpg)
![Page 5: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/5.jpg)
“BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.”
--Dan North
![Page 6: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/6.jpg)
“BDD’s focus is on the discovery of stuff we didn’t know about, particularly around the contexts in which scenarios or examples take place. …”
--Liz Keogh
![Page 7: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/7.jpg)
“Behaviour-driven-development is about implementing an application by describing its behaviour from the perspective of its stakeholders”
--Dan North
![Page 8: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/8.jpg)
“BDD practitioners explore, discover, define, and drive out desired behavior of software using conversations, concrete examples, and automated tests” --Matt Wynne
![Page 9: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/9.jpg)
Having conversations with domain experts
and using examples
to gain a shared understanding of the desired behavior
and discover unknowns
![Page 10: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/10.jpg)
Having conversations with domain experts
and using examples
to gain a shared understanding of the desired behavior
and discover unknowns
![Page 11: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/11.jpg)
Having conversations with domain experts
and using examples
to gain a shared understanding of the desired behavior
and discover unknowns
![Page 12: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/12.jpg)
Having conversations with domain experts
and using examples
to gain a shared understanding of the desired behavior
and discover unknowns
![Page 13: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/13.jpg)
Having conversations with domain experts
and using examples
to gain a shared understanding of the desired behavior
and discover unknowns
![Page 14: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/14.jpg)
Building the right thingvs.
building the thing right
![Page 15: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/15.jpg)
BDD != toolsand
automation
It’s not all about the tools
![Page 16: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/16.jpg)
The best tools won’t solve your customer’s problems if you
don’t know or understandthem
![Page 17: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/17.jpg)
If you’re not having conversations
then you’re not doing BDD-- Liz Keogh
![Page 18: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/18.jpg)
Having conversations
is more important than capturing conversations
is more important than automating conversations
-- Liz Keogh
![Page 19: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/19.jpg)
Scenarios
![Page 20: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/20.jpg)
Scenarios are a way for describing behavior
![Page 21: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/21.jpg)
Given a contextWhen an event happens
Then an outcome should occur
![Page 22: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/22.jpg)
Given Nate purchased a shirt and the shirt cost $20
When he returns the shirtThen he should get $20 refunded
![Page 23: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/23.jpg)
“…Simply by getting the business users, the analysts, the testers and the developers to
adopt this vocabulary of “given/when/then”, they discover that a
world of ambiguity falls away.”
-- Dan North
![Page 24: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/24.jpg)
Given a contextWhen an event happens
Then an outcome should occur
![Page 25: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/25.jpg)
Given a contextWhen an event happens
Then an outcome should occur
![Page 26: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/26.jpg)
Given a contextWhen an event happens
Then an outcome should occur
![Page 27: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/27.jpg)
Given Nate purchased a shirt and the shirt cost $20
When he returns the shirtThen he should get $20 refunded
![Page 28: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/28.jpg)
Is there a context which this event will create a different outcome?
![Page 29: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/29.jpg)
Given Nate purchased a shirt for $20and he does not have the receipt
When he returns the shirtThen he should be able to exchange the shirt for another shirt of the same kind
![Page 30: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/30.jpg)
Is this the only outcome that matters?
![Page 31: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/31.jpg)
Given Nate purchased a shirt for $20and the shirt has a hole in it
and he does not have the receiptWhen he returns the shirt
Then he should be able to exchange the shirt for another shirt of the same kind
and the shirt should be processed as damaged
and the store inventory should be decremented
![Page 32: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/32.jpg)
ScenarioDos and Don’ts
![Page 33: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/33.jpg)
Make the scenarios user interface
specific
Don’t
![Page 34: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/34.jpg)
Given Nate has $20 in his savings accountWhen he navigates to the transfer screenand enters $20 into the transfer amount
text boxand clicks the transfer button
then the account balance should be $40
Don’t
![Page 35: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/35.jpg)
Make the scenarios implementation
specific
Don’t
![Page 36: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/36.jpg)
Use the language of the business
Do
![Page 37: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/37.jpg)
Address multiple domains in a single scenario
Don’t
![Page 38: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/38.jpg)
Given Nate purchased a shirt and the shirt cost $20
When he returns the shirtThen he should get $20 refundedand the store inventory should be
incremented by 1
Don’t
![Page 39: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/39.jpg)
Keep scenarios simple by focusing on a single domain
at a time
Do
![Page 40: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/40.jpg)
Given Nate purchased a shirt and the shirt cost $20
When he returns the shirtThen he should get $20 refunded
Given the store as 10 shirts in inventoryWhen 1 shirt is returned
Then the inventory for that shirt should be 11
Do
![Page 41: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/41.jpg)
Add unnecessary or
irrelevant context
Don’t
![Page 42: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/42.jpg)
Keep the context to just enough
Do
![Page 43: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/43.jpg)
Imperative vs.
declarativescenarios
![Page 44: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/44.jpg)
Given John enters john.doe@gmail as the username
and P@55W0rd as the password
When he logs inThen it should be successful
![Page 45: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/45.jpg)
Given John has valid credentialsWhen he logs in
Then he it should be successful
![Page 46: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/46.jpg)
Acceptance criteria vs.
Scenarios
![Page 47: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/47.jpg)
Given Nate purchased a shirt on December 24th 2014
When he returns the shirt on April 28th 2015
Then he should be denied a refund
![Page 48: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/48.jpg)
Given a shirt was purchasedwhen it is returned
and the purchase date is older than the allowed time frame
then it should not be refunded
![Page 49: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/49.jpg)
Three Amigos
domain expert – developer – tester
![Page 50: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/50.jpg)
domain expert
The person who knows the business rules
![Page 51: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/51.jpg)
developer
The person who thinks inthe solution space
![Page 52: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/52.jpg)
tester
The person who thinks inthe problem space
![Page 53: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/53.jpg)
No hand-offs
![Page 54: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/54.jpg)
The business writes the scenarios and gives them to the team
![Page 55: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/55.jpg)
The developer writes the scenarios without talking to the team
![Page 56: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/56.jpg)
The tester writes the scenarios after code finished for automated testing
![Page 57: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/57.jpg)
Applying BDD
![Page 58: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/58.jpg)
People don’t often speak using Given / When / Then
http://lizkeogh.com/2014/09/01/deriving-gherkin-from-real-conversations/
![Page 59: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/59.jpg)
Can you give me an example?
![Page 60: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/60.jpg)
What if…?
![Page 61: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/61.jpg)
Teams get bored with having conversations
![Page 62: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/62.jpg)
Getting buy-in
![Page 63: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/63.jpg)
Benefits of BDD
![Page 64: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/64.jpg)
Shared understanding
![Page 65: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/65.jpg)
Reduces waste / feedback loops
![Page 66: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/66.jpg)
Discover unknowns
![Page 67: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/67.jpg)
building the right thing
![Page 68: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/68.jpg)
Software that matters
![Page 69: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/69.jpg)
@njpetersonpa
![Page 70: Pitt agile201505](https://reader030.vdocument.in/reader030/viewer/2022032620/55c59f23bb61eb31388b45bc/html5/thumbnails/70.jpg)
ResourcesDan North - http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/Dan North - http://dannorth.net/whats-in-a-story/Dan North - http://dannorth.net/introducing-bdd/Liz Keogh - http://lizkeogh.com/behaviour-driven-development/Liz Keogh - http://www.slideshare.net/lunivore/behavior-driven-development-11754474Seb Rose - http://www.slideshare.net/sebrose/bdd-history-and-myths