Test Driven Development via Agile Testing

40
Test Driven Development via Agile Tes2ng

description

The following topics are covered:• Overview of Agile Testing• The Test Pyramid• Different flavors of TDDo BDD – Behavior Driven Developmento ATDD – Acceptance Driven Developmento BDT – Behavior Driven Testing• Difference between BDD and BDT• Tools that support BDT• The value proposition of BDT

Transcript of Test Driven Development via Agile Testing

Page 1: Test Driven Development via Agile Testing

Test  Driven  Development  via  

Agile  Tes2ng  

Page 2: Test Driven Development via Agile Testing

What  is  Tes*ng  on  Agile  projects?  

Page 3: Test Driven Development via Agile Testing

Itera&on  0  

Story  test  analysis  for  Itera2on  1  

Test  Automa&on  -­‐  strategy,  framework  setup,  etc.  

Itera&on  1  

IPM  

Itera&on  1  Story  tes&ng  

Story  test  analysis  for  Itera2on  2  

Itera&on  2  

Showcase  Itera2on  1,  

IPM  

Support  Itera2on  1  

Itera&on  2  Story  tes&ng  

Test  Automa&on  

maint.,  execu&on  

Story  test  analysis  for  Itera2on  3  

Itera&on  3  

Showcase  Itera2on  2,  

IPM  

Support  Itera2on  2  

Itera&on  3  Story  tes&ng  

Test  Automa&on  

maint.,  execu&on  

Story  test  analysis  for  Itera2on  4  

..   ..   Itera&on  n  

Showcase  Itera2on  n-­‐1,  

IPM  

Support  Itera2on  n-­‐1  

Itera&on  n  Story  tes&ng  

Test  Automa&on  

maint.,  execu&on  

Story  test  analysis  for  Itera2on  n+1  

Page 4: Test Driven Development via Agile Testing

Story  planning  and  wri&ng  

IPM  

QA  kickoff  

Story  kickoff  

Test  Scenario  Wri&ng  

Implement  Test  Automa&on  

BA  /  QA  Volleyball  

Manual  +  Exploratory  Tes&ng  

Automa&on  (execu&on,  

maintenance)  

Showcase  

Agile  Tes2ng    in  an   Itera2on

Page 5: Test Driven Development via Agile Testing

What  makes  Agile  Teams    successful?  

Test  Automa2on  

Page 6: Test Driven Development via Agile Testing

What  makes  Agile  Tes*ng  unsuccessful?  

Test  Automa2on  

Page 7: Test Driven Development via Agile Testing

•  “Succeeding  with  Agile”  –  Mike  Cohn  

•  Mar*n  Fowler  –  Test  Pyramid  –  hCp://mar*nfowler.com/bliki/TestPyramid.html  

The  Test  Pyramid  

Page 8: Test Driven Development via Agile Testing

Ideal  Test  Pyramid  

Page 9: Test Driven Development via Agile Testing
Page 10: Test Driven Development via Agile Testing

Test  Pyramid  reality  

Development  team  Test  Pyramid   QA  team  

Test  Pyramid  

Page 11: Test Driven Development via Agile Testing

Test  Pyramid  –  An*  PaCern  

Page 12: Test Driven Development via Agile Testing

Case  Study  

•  Mul*ple,  long  running  projects  

•  Legacy  applica*ons  

•  Integrated  

Page 13: Test Driven Development via Agile Testing
Page 14: Test Driven Development via Agile Testing
Page 15: Test Driven Development via Agile Testing

Its  not  what  I  said,  its  what  I  

mean!  

Page 16: Test Driven Development via Agile Testing
Page 17: Test Driven Development via Agile Testing
Page 18: Test Driven Development via Agile Testing

•  Remove  the  ambiguity  •  Same  visibility  for  all  

Page 19: Test Driven Development via Agile Testing
Page 20: Test Driven Development via Agile Testing

Evolu*on  of  Test  Frameworks  Behavior  Driven  

Development  (BDD)  

Op*mized  scripts  

Record  &  Playback    

Core  Framework  

Page 21: Test Driven Development via Agile Testing

Behavior  Driven  Development    (BDD)  

Page 22: Test Driven Development via Agile Testing

RED  

GREEN  REFACTOR  

Page 23: Test Driven Development via Agile Testing

Behavior  Driven  Tes*ng  (BDT)  

Page 24: Test Driven Development via Agile Testing

Expected  Func&onality:  

 

The  customer  should  be  able  to  withdraw  money  from  his  account  via  an  ATM  machine  

Page 25: Test Driven Development via Agile Testing

Given  the  account  has  balance  of  INR  5000  When  the  customer  requests  INR  1000  Then  the  account  is  debited  by  INR  1000  

BDD  Example:  

Page 26: Test Driven Development via Agile Testing

Given  the  account  is  in  credit  

And  the  dispenser  contains  cash  

 

When  the  customer  requests  cash  

 

Then  ensure  the  account  is  debited  

And  ensure  cash  is  dispensed  

And  ensure  the  card  is  returned  

BDT  Example:  

Page 27: Test Driven Development via Agile Testing

New  Expected  Func&onality:  

 

The  customer  should  be  able  to  withdraw  money  from  his  account  only  if  his  card  is  valid  

Page 28: Test Driven Development via Agile Testing

Given  the  account  is  in  credit  And  the  card  is  valid  And  the  dispenser  contains  cash    When  the  customer  requests  cash    Then  ensure  the  account  is  debited  And  ensure  cash  is  dispensed  And  ensure  the  card  is  returned  

BDT  Example  -­‐  updated:  

Page 29: Test Driven Development via Agile Testing

Test  specifica*on  styles  

Story:  Animal  Submission    As  a  Zoologist  I  want  to  add  a  new  animal  to  the  site  So  that  I  can  share  my  animal  knowledge  with  the  community  

Page 30: Test Driven Development via Agile Testing

Impera*ve  Scenario  

Reference:  hCp://wa*rmelon.com/2010/12/10/cucumber-­‐impera*ve-­‐or-­‐declara*ve-­‐that-­‐is-­‐the-­‐ques*on/  

Given  I  am  on  the  animal  crea*on  page    When  I  fill  in  Name  with  ‘Alligator’  And  fill  in  Genus  with  ‘Alligator’  And  check  Lay  Eggs  And  click  the  Create  buCon    Then  I  should  see  the  no*ce  ‘Thank  you  for  your  animal  submission!’  And  the  page  should  include  the  animal’s  name,  genus  and  lay’s  eggs  

Page 31: Test Driven Development via Agile Testing

Declara*ve  Scenario  

Reference:  hCp://wa*rmelon.com/2010/12/10/cucumber-­‐impera*ve-­‐or-­‐declara*ve-­‐that-­‐is-­‐the-­‐ques*on/  

Given  I  am  on  the  animal  crea*on  page    When  I  add  a  new  animal    Then  I  animal  should  be  created  successfully  

Page 32: Test Driven Development via Agile Testing

What  does  this  do  for  me?  

Page 33: Test Driven Development via Agile Testing
Page 34: Test Driven Development via Agile Testing
Page 35: Test Driven Development via Agile Testing

How  did  we  accomplish  this?  

Page 36: Test Driven Development via Agile Testing
Page 37: Test Driven Development via Agile Testing

Who  is  doing  the  ac*on?  

What  is  the  business  func*onality?  

Ac*ons  and  verifica*ons  happen  implicitly  Depicts  a  user  flow  

Given  auc&oneer  creates  a  sale  And  5  items  are  added  to  the  sale            When  auc&oneer  starts  the  sale  And  auc&oneer  sets  a  star*ng  bid  of  5000  And  buyer_1  bids  And  buyer_2  bids    Then  auc&oneer  Sells  the  item  And  buyer_2  wins  the  item  

Page 38: Test Driven Development via Agile Testing

Current  state  Tests  running  on  Hudson  /  Jenkins   Since  1st  test  was  automated  

Feature  files   33  

Scenarios   65  

Smoke  tests  execu*on  *me   15  minutes  

Regression  tests  execu*on  *me   45  minutes  

Test  case  repository  (manual  +  automated)  

Cucumber  .feature  files  with  appropriate  tagging  

Project  Management  tool   Mingle  

Page 39: Test Driven Development via Agile Testing

Tools  to  enable  BDD  /  BDT  

•  Cucumber  •  JBehave  •  SpecFlow  •  Twist  

Page 40: Test Driven Development via Agile Testing

[email protected]  

[email protected]  

 ThoughtWorks®