behavior driven development
TRANSCRIPT
Test Fasterwith Behavior Driven Development
Jennifer Starkey & Stephanie Vineyard
Why are we here?
Business Analysis Service Lead, Agile trainer and coach
Board member of the IIBA DC Chapter
CSM, CSPO, PMP, ITIL
Stephanie Vineyard
Business Analysis Lead on USCIS Verifications Project
CSM, CSPO, PMP
Jenn Starkey
Why does testing matter?What is Behavior Driven Development?What is the impact?How do I use this?
Intentions
Why does testing matter?
BABOK: Verify and Validate
Requirements
BABOK: Achieve stakeholders’
desired state
Agile Manifesto
15
Individuals and interactions over Process and tools
Working software over Comprehensive documentation
Customer collaboration over Contract negotiation
Responding to change over Following a plan
We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value:
That is, while there is value in the items on the right, we value the items on the left more.
http://agilemanifesto.org/
Value to USCISU.S. Citizen Immigration Service – Status
Verification System
Enables better communication across cross-functional scrum teams
PO BA Dev Team
Ensures the team delivers business
value.
Helps to automateUAT!
What is BDD?Behavior Driven Development
Gherkin
gher·kinˈgərkin/noun1. a small variety of cucumber, or a young green cucumber used for pickling.Business readable, domain specific language
Gherkin syntax
• Given < situation >• When < action >• Then < expected result >
16
Let’s see it in action
How USCIS Verifications is Using BDD
Code Gets Merged to MasterPipeline Runs all Cucumber Tests
Devs Write Code and Gherkin ScriptsFeeds the AC into Automated Testing Tool
BAs Assist the PO to Write ACGiven/When/Then
BAs Enter Stories into Jira
Given unavailable user is logged in and viewing casesWhen the user selects available status Then the user sees their current status as availableAnd the verifier receives an active case
Devs Write Gherkin Scripts
Devs Merge Code
UAT is Automated!
What were the results?• Demo and implement agile best
practices in the federal government• Went from project kick-off to
production in 3 months• Continuously improve as a team
Why does testing matter?What is Behavior Driven Development?What is the impact?How do I use this?
Intentions
Try it out
Example – start with the user story then create your BDD
User Story: As a customer, I want to review shipping costs in my shopping cart before checking out, so I can see if I will receive free shipping.
Acceptance Criteria:• Orders less than $50 pay shipping of $3.99• Orders greater than $50 have free shipping
Gherkin syntax
• Given < situation >• When < action >• Then < expected result >
27
Exercise 1Scenario: Standard Shipping RateGiven I am a customerAnd my order amount is $49.99When I view my cartThen I see that shipping costs are $3.99
Scenario: Free Shipping RateGiven I am a customerAnd my order amount is $50.00When I view my cartThen I see that shipping costs are $0.00
Scenario OutlinesFeature: Determine shipping rate
Scenario Outline: Standard shipping rate• Given that I am a customer• And my order amount is <order amount>• When I view my cart• Then I see that shipping costs are <shipping cost>
Example Tables:| order amount | shipping cost| $49.99 | $3.99| $50.00 | $0.00| $75.00 | $0.00
Exercises
• In small groups, review scenario 1 and 2.
• How could these be better written?
Scenario 1
OkayExample:GivenanactiveuserwithvalidcredentialsandthatuserhaspreviouslysubmittedaticketWhenthatuserfindsapreviouslysubmittedticketinanactivestatusThenthatuserhastheoptionofsendingamessage
BetterExample:GivenIamanactiveuserwithvalidcredentialsAndIpreviouslysubmittedaticketAndtheticketisinanactivestatusWhenIfindapreviouslysubmittedticketThenIshouldseeanoptionforsendingamessage
Exercise 2
OkayExample:GivenIamanunregistereduserWhenIenter“jsmith”in“username”and“secret123!”in“password”AndIpressthe“OK”buttonThenIsee“Profilesuccessfullycreated”ontheWelcomepage
BetterExample:GivenIamanunregistereduserAndIenter“<username>”AndIenter“<password>”WhenIpressthe“OK”buttonThenIsee“<message>”ontheWelcomepageExamples:
username password messagejsmith secret123! Profile successfully created
jsmith2 secret123 Your password must contain a special character
Feature: CreatenewaccountScenario: Usercreatesaccountsuccessfully
Imperative Style
Feature: CreatenewaccountScenario: Usercreatesaccountsuccessfully
Imperative(Narrative)GivenIamanunregistereduserAndIamontheloginpageAndIenter<username>AndIenter<password>WhenIselectthe“OK”buttonThenIsee<message>onthewelcomepage
ImplementationDetail– whatifdecidetouseToken-basedauthenticationorsinglesign-on?
UIDetail– whatiftheuserinterfacechangesandyouselectnamefromadrop-downlistorselectaradiobutton?
Declarative Style
Feature: CreatenewaccountScenario: Usercreatesaccountsuccessfully
Declarative(Informative)
GivenIamanunregistereduserAndIamontheloginpageWhenIsubmitvalidcredentialsThenIseethewelcomepage
Side-by-side ComparisonFeature: CreatenewaccountScenario: Usercreatesaccountsuccessfully
Imperative(Narrative) Declarative(Informative)
GivenIamanunregistereduserAndIamontheloginpageAndIenter<username>AndIenter<password>WhenIselectthe“OK”buttonThenIshouldseethewelcomepage
GivenIamanunregistereduserAndIamontheloginpage
WhenIsubmitvalidcredentialsThenIshouldseethewelcomepage
Background Statement
Why does testing matter?What is Behavior Driven Development?What is the impact?How do I use this?
Were our intentions met?
Jennifer StarkeyJennifer.starkey@excella.
com
LinkedIn: https://www.linkedin.com/in/jennifer-starkey
Stephanie Vineyard
Stephanie.vineyard@ex
cella.com
Twitter: @tesiemae
LinkedIn:
https://www.linkedin.co
m/in/smvineyard
Behavior Driven Developmentis a product which has just enough features to gather validated learning about the product and its continued development...
Minimal Viable Product (MVP)is a product which has just enough features to gather validated learning about the product and its continued development.
Acceptance Testis a …
Agile ManifestoIndividuals and interactions over Process and toolsWorking product over Comprehensive documentationCustomer collaboration over Contract negotiationResponding to change over Following a plan
Terminology