Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Behavior Driven Development Pros and Cons


Published on

Published in: Technology
  • Be the first to comment

Behavior Driven Development Pros and Cons

  1. 1. The Pros of Behavior Driven Development (BDD): Business User Scenarios Natalya Zaytseva Exactpro Systems LLC
  2. 2. Test Driven Development (TDD) Test Failed Add a test Test Passed Update the code Refactor
  3. 3. Test Driven Development (TDD) <ul><li>Benefits </li></ul><ul><li>Unit tests prove that code actually works </li></ul><ul><li>Refactoring allows to improve the design of the code </li></ul><ul><li>Low-level regression test suite </li></ul><ul><li>Test-first reduces the cost of bugs </li></ul><ul><li>Drawbacks </li></ul><ul><li>Developers can consider it as a waste of time </li></ul><ul><li>Anticipation by developers the concept of “Testing” </li></ul><ul><li>The tests can be targeted on verification of classes and methods and not on what the code really should do </li></ul>
  4. 4. Behavior Driven Development (BDD) <ul><li>Shifting from thinking in “tests” to thinking in “behavior” </li></ul><ul><li>Collaboration between Business stakeholders, Business Analysts, QA team and Developers </li></ul><ul><li>Ubiquitous language </li></ul><ul><li>. </li></ul>
  5. 5. Behavior Driven Development (BDD) <ul><li>Approach </li></ul>a feature4 QA Analyst Ubiquitous language Behavior feature1 feature3 QA Analyst Scenarios Class Developer
  6. 6. BDD: Business Scenarios <ul><ul><li>Story: [Narrative] </li></ul></ul><ul><ul><li>As a Role </li></ul></ul><ul><ul><li>I request a Feature </li></ul></ul><ul><ul><li>To gain a Benefit </li></ul></ul><ul><ul><li>Scenario </li></ul></ul><ul><ul><li>Given [context] </li></ul></ul><ul><ul><li>AND [some more context] </li></ul></ul><ul><li>When [Event] </li></ul><ul><li>Then [Outcome] </li></ul><ul><li>And [Another Outcome] </li></ul>
  7. 7. BDD Cons Ivan Bobrov EXTENT October 2011
  8. 8. The Beginning
  9. 9. Is it easy to describe? <ul><li>Scenario: An Artist creates an art work Given I am a registered artist And I am on my dashboard And I follow &quot;Add an artwork&quot; within &quot;#dashboard&quot; When I fill in &quot;Title&quot; with &quot;The Portrait&quot; And I fill in &quot;Description&quot; with &quot;A nice portrait.&quot; And I select &quot;Painting&quot; from &quot;Category&quot; And I attach “ portret .jpg&quot; to &quot;Select picture&quot; And I press &quot;Create&quot; Then I should see &quot;The Portrait &quot; was successfully added to your art collection </li></ul>
  10. 10. A Client and BDD is Face to Face <ul><li>With every new project I hoped that Cucumber can become one of the communication tools between our team and the customer. Only once I managed to get the customer write the scenarios , however the quality wasn't good and they had to be rewritten by a developer </li></ul><ul><li>It was difficult to convince the customer to review the scenarios on a daily basis . They preferred writing a document or using a ticketing system like Redmine. The result is that we have requirements in 2 places - tickets and scenarios </li></ul><ul><li>Andrzej Krzywda </li></ul>
  11. 11. Are developers ready for BDD? <ul><li>A developer often writes specifications </li></ul><ul><li>Specs are very detailed </li></ul><ul><li>Scripts, scenarios or a manual? </li></ul><ul><li>Easy to understand </li></ul>
  12. 12. BDD doesn’t show a real life <ul><li>In BBD Scenario NewOrderSingle where SecurityID=S1 and Price=P1 and Side=BUY and Quantity=Q1 … </li></ul><ul><li>In Real Life </li></ul><ul><li>Initialize TCP connection </li></ul><ul><li>Send Logon to the GW </li></ul><ul><li>Wait for Logon response </li></ul><ul><li>Start sending HeartBeats </li></ul><ul><li>Send NewOrderSingle with …. </li></ul>
  13. 13. Release <ul><li>A Product is ready to use </li></ul><ul><li>BDD it’s a design tool </li></ul>
  14. 14. 1770 year
  15. 15. 2011 year
  16. 16. <ul><li>Thank you. </li></ul>