42
John Ferguson Smart BDD In Action Principles, practices and real-world applicatio ns

BDD in Action – principles, practices and real-world application

Embed Size (px)

Citation preview

Page 1: BDD in Action – principles, practices and real-world application

John  Ferguson  Smart

BDD In Action Principles, practices and real-world applications

Page 2: BDD in Action – principles, practices and real-world application

John Ferguson Smart

Consultant  Trainer  Mentor  Author  Speaker  Coder

Page 3: BDD in Action – principles, practices and real-world application

There are only two problems in software development

1) Building the software wrong

2) Building the wrong software

Page 4: BDD in Action – principles, practices and real-world application

BDD

Feature InjectionAutomated Acceptance

Criteria

API and code design

Collaboration

Building the software right

Building the right software

Living Documentation

What  is  Behaviour  Driven  Development

Page 5: BDD in Action – principles, practices and real-world application

Behaviour  Driven  Development  is…

Conversa>on  Focused

Page 6: BDD in Action – principles, practices and real-world application

Story

bug  reports

Working  code boring  

manual  tes>ng

WASTEBA

Developer

Tester

Many teams build features like this…

Conversa>on  Focused

Page 7: BDD in Action – principles, practices and real-world application

…but a little cooperation goes a long way…

Working  code    and    

Working  Automated  Acceptance  Tests Exploratory  tes>ng,  

usability  tes>ng...

Shared  understanding

StoryExamplesAutomated  acceptance  criteria

Conversa>on  Focused

Page 8: BDD in Action – principles, practices and real-world application

We call this “The Three Amigos”

BA  and/or  product  owner

Tester Developer Automatable  Acceptance  Criteria

Shared  understanding

Conversa>on  Focused

Page 9: BDD in Action – principles, practices and real-world application

We call this “The Three Amigos”

Conversa>on  Focused

Page 10: BDD in Action – principles, practices and real-world application

Behaviour  Driven  Development  is…

Example-­‐based

Page 11: BDD in Action – principles, practices and real-world application

Example-­‐based

Page 12: BDD in Action – principles, practices and real-world application

Behaviour  Driven  Development  is…

Value-­‐Driven

Page 13: BDD in Action – principles, practices and real-world application

Behaviour  Driven  Development  is…

Outside-­‐in

OutsideIn

Page 14: BDD in Action – principles, practices and real-world application

Behaviour  Driven  Development  is…

Executable  Specifica>ons

Page 15: BDD in Action – principles, practices and real-world application

More value faster

Delivery  Time

Trad

i>on

al

Using  BDD

31%  faster  delivery

Behaviour  Driven  Development  is…

Page 16: BDD in Action – principles, practices and real-world application

Higher Quality

Defect  Rate

Trad

i>on

al

Using  BDD

4  >mes  less  defects

Behaviour  Driven  Development  is…

Page 17: BDD in Action – principles, practices and real-world application

Scenario

Step  Defini>ons

Low  level  specifica>ons  (aka  “unit  tests”)

Applica>on  Code

BDD  guides  development

Page 18: BDD in Action – principles, practices and real-world application

Oh, the things you can learn…

BDD  guides  development

Page 19: BDD in Action – principles, practices and real-world application

What  would  we  like  the  API  to  look  like?

BDD  guides  development

Page 20: BDD in Action – principles, practices and real-world application

Then  write  low-­‐level  specifica>ons  for  the  code

BDD  guides  development

Page 21: BDD in Action – principles, practices and real-world application

Then  write  low-­‐level  specifica>ons  for  the  code

BDD  guides  development

Page 22: BDD in Action – principles, practices and real-world application

“Every class is an API for someone”

Page 23: BDD in Action – principles, practices and real-world application

BDD  in  Ac>on  -­‐  some  real-­‐world  examples

Page 24: BDD in Action – principles, practices and real-world application

Mission  cri;cal  legacy  web  applica;on

Case  1  -­‐  an  e-­‐commerce  web  site

Frequent  small  changes

Business  requires  fast  release  cycle

Background

Page 25: BDD in Action – principles, practices and real-world application

Case  1  -­‐  an  e-­‐commerce  web  site

Approach

“BDD-­‐style”  regression  tests

High  communica;on  value

Designed  for  ease  of  maintenance

Illustrate  key  business  scenarios

Minimum  ini;al  impact  on  team

Page 26: BDD in Action – principles, practices and real-world application

“BDD-­‐style”  regression  tests

Case  1  -­‐  an  e-­‐commerce  web  site

Approach

Page 27: BDD in Action – principles, practices and real-world application

Case  1  -­‐  an  e-­‐commerce  web  site

Outcomes

Living  documenta;on

Page 28: BDD in Action – principles, practices and real-world application

Case  1  -­‐  an  e-­‐commerce  web  site

Outcomes

Living  documenta;on

Page 29: BDD in Action – principles, practices and real-world application

Case  1  -­‐  an  e-­‐commerce  web  site

Outcomes

Living  documenta;on

Page 30: BDD in Action – principles, practices and real-world application

New  large-­‐scale  project

Case  2  -­‐  a  large  financial  ins>tu>on

7  years,  2  Scrum  teams

Conserva;ve  organisa;on

Background

Regulatory  and  traceability  

Page 31: BDD in Action – principles, practices and real-world application

Approach

Full  team-­‐wide  BDD  adop;on

Test  automa;on  for  (almost)  all  acceptance  criteria

Tight  integra;on  with  JIRA  for  traceability  

“Three-­‐amigos”  sessions  to  refine  acceptance  criteria

High  ini;al  impact  on  team

Case  2  -­‐  a  large  financial  ins>tu>on

Page 32: BDD in Action – principles, practices and real-world application

\Approach

Case  2  -­‐  a  large  financial  ins>tu>on

Stories

Features

Capabilities

Goals

Requirements  organised  by  feature  and  capability

Page 33: BDD in Action – principles, practices and real-world application

\Approach

Case  2  -­‐  a  large  financial  ins>tu>on

Stories

Features

Capabilities

Goals

Requirements  managed  in  JIRA

Page 34: BDD in Action – principles, practices and real-world application

\Approach

Case  2  -­‐  a  large  financial  ins>tu>on

StoryExamplesAutomated  acceptance  criteria

“Three  amigos”  sessions  refine  acceptance  criteria

Page 35: BDD in Action – principles, practices and real-world application

\Approach

Case  2  -­‐  a  large  financial  ins>tu>on

Acceptance  Criteria  map  back  to  JIRA

Page 36: BDD in Action – principles, practices and real-world application

\Approach

Case  2  -­‐  a  large  financial  ins>tu>on

Stories

Features

Capabilities

Goals

Manual  test  cases  managed  in  Zephyr

Page 37: BDD in Action – principles, practices and real-world application

\Approach

Case  2  -­‐  a  large  financial  ins>tu>on

Stories

Features

Capabilities

Goals

Automated  and  Manual  Tests  produce  Living  Documenta;on  

Acceptance Criteria

Page 38: BDD in Action – principles, practices and real-world application

\Approach

Case  2  -­‐  a  large  financial  ins>tu>on

Releases  organised  in  JIRA

Page 39: BDD in Action – principles, practices and real-world application

\Outcomes

Case  2  -­‐  a  large  financial  ins>tu>on

Code  coverage  when  from  8%  to  80+%

Very  liZle  rework  to  delivered  features  

Well  documented  APIs

Automated  tests  used  to  demonstrate  features

Happy  teams!

Page 40: BDD in Action – principles, practices and real-world application

BDD  involves  a  major  culture  change

BDD  Adop>on  -­‐  Tips  and  Tricks

Don’t  skimp  on  training!

Put  care  into  your  test  automa;on  

Need  tester  and  BA  buy-­‐in

Page 41: BDD in Action – principles, practices and real-world application

References

http://jbehave.orgBDD in Java

http://thucydides.infoLiving Documentation

Issue tracking and Agile project management

Manual test case management in JIRA

Page 42: BDD in Action – principles, practices and real-world application

Thank you!

John Ferguson [email protected]

wakaleohttp://www.wakaleo.com