Anand Bagmar - Behavior Driven Testing (BDT) in Agile
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Anand Bagmar - Behavior Driven Testing (BDT) in Agile

  • 2,558 views
Uploaded on

I delivered this talk in SiliconIndia's SoftTec 2012 on 14th July 2012. I introduce Behavior Driven Testing (BDT) with a couple of examples, the different ways of writing the tests in Imperative......

I delivered this talk in SiliconIndia's SoftTec 2012 on 14th July 2012. I introduce Behavior Driven Testing (BDT) with a couple of examples, the different ways of writing the tests in Imperative and Declarative style, the value proposition of BDT, and how BDT can help you build a very good safety net using Test Automation suite.

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • I find putting data in tables make the tests less readable. However, there is always a context to why and what you should do in the tests. One rule does not apply to all contexts.

    In ideal cases, there would be no parameters required at all. The framework should be able to 'use' the correct data based on the specification. However, in some cases you need a little - but very relevant data - this is where using parameters as strings would help. In rare cases, you would need to use a data table to specify the data.

    I definitely do NOT think this is an anti-pattern - infact its applying the knowledge and experience in building a good declarative test - which helps validate the product under test in the best possible fashion.

    Hope this helps. Happy to discuss more :)
    Are you sure you want to
    Your message goes here
  • @abagmar You are using String variables in step definitions with And And style of declaration the steps. Do you think it's a good practice to write tests in that way? I'm suggesting to use Gherkin tables instead and transform them into List of entities into the code that is much easier to maintain into programming.

    BDT scenarions how you are presenting is looks like BDD anti-patterns that was written in Cucumber and Specification by Example books.
    Are you sure you want to
    Your message goes here
  • Hi Andril, Not sure what are you referring to. Can you please clarify?
    Are you sure you want to
    Your message goes here
  • Why not to use Gherkin tables where you can specify any data you need. Creating steps with a lot of input strings will be very hard to maintain inside the code. Using tables you can store all the data into DataTable type or List of entities that is very useful from programming point of view.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
2,558
On Slideshare
2,474
From Embeds
84
Number of Embeds
5

Actions

Shares
Downloads
92
Comments
4
Likes
4

Embeds 84

http://www.linkedin.com 45
http://www.scoop.it 33
http://www.slashdocs.com 3
https://www.linkedin.com 2
https://twimg0-a.akamaihd.net 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Behavior  Driven  Tes.ng  (BDT)     in     Agile  
  • 2. What  is  Tes*ng  on  Agile  projects?  
  • 3. Story   planning  and   wri/ng   Showcase   IPM   Automa/on   (execu/on,   QA  kickoff   maintenance)   Agile  Tes.ng     in  an  Itera.on Manual  +  Exploratory   Story  kickoff   Tes/ng   BA  /  QA   Test  Scenario   Volleyball   Wri/ng   Implement   Test   Automa/on  
  • 4. A  prac*ce  that  makes  Agile  Teams     successful?   Test  Automa.on  
  • 5. A  prac*ce  that  makes  Agile  Teams   unsuccessful?   Test  Automa.on  
  • 6. The  Test  Pyramid  •  “Succeeding  with  Agile”  –  Mike  Cohn  •  Mar*n  Fowler  –  Test  Pyramid   –  hCp://mar*nfowler.com/bliki/TestPyramid.html  
  • 7. Ideal  Test  Pyramid   Func/onal  Tests  (GUI)   •  Developers  &  /  QA  team   API  Tests   •  Developers  &  /  QA  team   Integra/on  tests   •  Developers   Component  tests   •  Developers   Unit  Tests   •  Developers  Cost  /  Effort   Time  
  • 8. Test  Pyramid  reality  Development  team  Test  Pyramid   QA  team   Test  Pyramid  
  • 9. Test  Pyramid  –  An*  PaCern  
  • 10. Evolu*on  of  Test  Frameworks   Behavior   Driven   Development   (BDD)   Op/mized   scripts   Record  &   Playback     Core   Framework  
  • 11. Behavior  Driven  Development     (BDD)  
  • 12. RED  REFACTOR   GREEN  
  • 13. Behavior  Driven  Tes*ng   (BDT)  
  • 14. Expected  Func/onality:    The  customer  should  be  able  to  withdraw  money  from  his  account  via  an  ATM  machine  
  • 15. BDD  Example:  Given  the  account  has  balance  of  5000  When  the  customer  requests  1000  Then  the  account  is  debited  by  1000  
  • 16. BDT  Example:  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  
  • 17. New  Expected  Func/onality:    The  customer  should  be  able  to  withdraw  money  from  his  account  only  if  his  card  is  valid  
  • 18. BDT  Example  -­‐  updated:  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  
  • 19. Case  Study  
  • 20. Requirements  •  Guest  User  is  able  to  search  for  a  flight  for  a   single  traveller  •  Ability  to  specify  contact  informa*on  for   person  booking  the  flight  
  • 21. Search   Contact  Search     Results   Informa/on  
  • 22. Contact  Details  
  • 23. Test  specifica*on  styles  •  Impera*ve    •  Declara*ve  
  • 24. Impera*ve  style  Given  I  am  a  guest  user  on  the  Indigo  home  page  And  I  select  “round”  trip  op*on  And  I  select  “Pune”  from  the  origin  dropdown  And  I  select  “Bangalore”  from  the  des*na*on  drop  down  And  I  select  departure  date  as  “5  July  2012”  And  I  select  returning  date  as  “25  July  2012”    When  I  click  on  Search    Then  I  should  see  the  search  results  page    And  I  should  see  at  least  1  op*on  for  my  criteria    ...  
  • 25. …  When  I  select  the  “first”  op*on  Then  I  am  on  the  Contact  Informa*on  page    When  I  enter  first  name  as  “foo”  And  I  enter  last  name  as  “bar”  …  …  And  I  click  the  “Select  and  Con/nue”  buCon    Then  I  should  be  on  the  next  page    
  • 26. Declara*ve  style  Given  I  am  a  guest  user    When  I  search  for  flight  op*ons  for  a  “one-­‐way”  trip  for  “1”  “Adult”  from  “Delhi”  to  “Bangalore”  And  I  select  the  “first”  flight  And  I  enter  “valid”  contact  details  for  “traveller1”    Then  I  am  able  to  Save  and  Con*nue  
  • 27. Func/onal  Tests  (GUI)  •  Developers  &  /  QA  team  API  Tests  •  Developers  &  /  QA  team  Integra/on  tests  •  Developers  Component  tests  •  Developers  Unit  Tests  •  Developers  
  • 28. What  does  BDT  do  for  me?  
  • 29. What  BDT  does  NOT  do  for  me?  •  Replace  tes*ng  granular  func*onality     –  ONLY  when  it  has  just  been  developed  
  • 30. Steps  to  follow  to  implement  BDT  
  • 31. 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  +   Cucumber  .feature  files  with  automated)   appropriate  tagging  Project  Management  tool   Mingle  
  • 32. Tools  to  enable  BDD  /  BDT  •  Cucumber  •  JBehave  •  SpecFlow  •  Twist  
  • 33. Anand.Bagmar@thoughtworks.com   abagmar@gmail.com   ThoughtWorks®