Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to make your clients happy with BDD

How to make your clients happy with BDD

Talk about role of narrative in BDD *.features

Konstantin Kudryashov

March 17, 2012
Tweet

More Decks by Konstantin Kudryashov

Other Decks in Programming

Transcript

  1. using BDD How to make your clients happy

  2. AM who i @everzet senior from-birth web developer in

  3. Agile mentor in KnpLabs since 2011 BDD evangelist Creator of

    Behat, Mink Contributor to Symfony2 framework everzet@knplabs.com http://github.com/everzet http://card.everzet.com AM who i @everzet senior from-birth web developer in
  4. What’s our primary job ?

  5. to make our clients happy !

  6. Current state:

  7. more awesome languages

  8. more awesome frameworks

  9. more awesome developers http://www.flickr.com/photos/officialgdc/4421337520

  10. clients happiness = ?

  11. None
  12. clients happiness =valuable product

  13. awesome languages ≠valuable product

  14. awesome languages frameworks ≠valuable product

  15. awesome languages frameworks developers ≠valuable product

  16. awesome valuable ≉

  17. = valuable product

  18. popular = valuable product

  19. popular useful = valuable product

  20. popular useful profitable = valuable product

  21. BUT

  22. How to bring value into client product ?

  23. especially, when client doesn’t know that he needs it

  24. By asking

  25. http://www.flickr.com/photos/brendio/71252025

  26. Client wants internationalization?

  27. http://www.flickr.com/photos/editor/6698208975

  28. Client wants authorization?

  29. http://www.flickr.com/photos/quinnanya/3588989219

  30. Client wants this new shiny awesome feature?

  31. Well, you got it....

  32. COMMUNICATIONS photo by joshfassbind.com

  33. How does it helps?

  34. Correct answers to WHY? helps you to bring higher priority

    on things, that really matter
  35. How does the correct answer looks like? WHY?

  36. None
  37. Correct WHY? answer should point out:

  38. Correct WHY? answer should point out: • Added value of

    the feature
  39. Correct WHY? answer should point out: • Added value of

    the feature • Benefitiar of the feature
  40. In order to see top users

  41. In order to see top users As a visitor

  42. In order to see top users As a visitor I

    need to be able to sort them by rating
  43. In order to see top users As a visitor I

    need to be able to sort them by rating
  44. In order to get latest news As a visitor I

    need to be able to see last 3 articles on homepage In order to see top users As a visitor I need to be able to sort them by rating
  45. In order to spend my money As a user I

    need to be able to buy rating on site In order to get latest news As a visitor I need to be able to see last 3 articles on homepage In order to see top users As a visitor I need to be able to sort them by rating
  46. X - the benefit or value of the feature Y

    - the person (or role) who will benefit Z - some feature In order to [X] As a [Y] I need [Z] Its strength is that it forces you to identify the value of delivering a story when you first define it. © Dan North ❤ of BDD
  47. In order to spend my money As a user I

    need to be able to buy rating on site In order to get latest news As a visitor I need to be able to see last 3 articles on homepage In order to see top users As a visitor I need to be able to sort them by rating
  48. 2 1 3 In order to spend my money As

    a user I need to be able to buy rating on site In order to get latest news As a visitor I need to be able to see last 3 articles on homepage In order to see top users As a visitor I need to be able to sort them by rating define priorities
  49. In order to [X] As a [Y] I need [Z]

  50. Hey, it looks like a user story!

  51. In order to [X] As a [Y] I need [Z]

    UserStory: it IS
  52. Given some initial context (the givens), When an event occurs,

    Then ensure some outcomes. In order to [X] As a [Y] I need [Z] UserStory:
  53. Given some initial context (the givens), When an event occurs,

    Then ensure some outcomes. In order to [X] As a [Y] I need [Z] Given some initial context (the givens), When an event occurs, Then ensure some outcomes. UserStory:
  54. In order to [X] As a [Y] I need [Z]

    Scenario 1: Scenario 2: Given some initial context (the givens), When an event occurs, Then ensure some outcomes. Given some initial context (the givens), When an event occurs, Then ensure some outcomes. UserStory:
  55. A story’s behaviour is simply its acceptance criteria! - if

    the system fulfills all the acceptance criteria, it’s behaving correctly; if it doesn’t, it isn’t.
  56. Acceptance criteria could be automated!

  57. None
  58. In order to ... As a ... I need ...

    Scenario: 1st scenario title Scenario: 2nd scenario title Feature: Feature description Given some initial context (the givens) When an event occurs Then ensure some outcomes Given some initial context (the givens) When an event occurs Then ensure some outcomes
  59. 1. feature 2. scenario 3. step ... ... 2. scenario

    3. step ... ... Given some initial context (the givens) When an event occurs Then ensure some outcomes In order to ... As a ... I need ... Given some initial context (the givens) When an event occurs Then ensure some outcomes Scenario: 1st scenario title Scenario: 2nd scenario title Feature: Feature description feature tree
  60. <?php $steps->Given('/^I have a bank account$/', function($world) { $world->account =

    new BankAccount(); } ); Given I have a bank account
  61. <?php $steps->Given('/^I have a bank account$/', function($world) { $world->account =

    new BankAccount(); } ); <?php $steps->When('/^I deposit (\d+)\$$/', function($world, $dollars) { $world->account->deposit($dollars); } ); Given I have a bank account When I deposit 35$
  62. Then I should have 35$

  63. Then I should have 35$ <?php $steps->Then('/^I should have (\d+)\$$/',

    function($world, $balance) { if ($balance !== $world->account->getBalance()) { throw new \Exception('Wrong balance!'); } } );
  64. <?php $steps->Given('/^I have a bank account$/', function($world) { $world->account =

    new BankAccount(); } ); $steps->When('/^I deposit (\d+)\$$/', function($world, $dollars) { $world->account->deposit($dollars); } ); $steps->Then('/^I should have (\d+)\$$/', function($world, $balance) { assertEquals($balance, $world->account->getBalance()); } );
  65. Feature: User logins

  66. In order to have extended abilities As a site user

    I need to be able to login Feature: User logins
  67. In order to have extended abilities As a site user

    I need to be able to login Scenario: Existing user can login Feature: User logins
  68. In order to have extended abilities As a site user

    I need to be able to login Scenario: Existing user can login Scenario: Non-existing user can’t login Feature: User logins
  69. Given a site have “everzet” user with “qwerty” password And

    I am on the “/login” When I fill in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have “everzet” user with “qwerty” password And I am on the “/login” When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
  70. Given a site have “everzet” user with “qwerty” password And

    I am on the “/login” When I fill in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have “everzet” user with “qwerty” password And I am on the “/login” When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
  71. Given I am on the “/login” page When I fill

    in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given I am on the “/login” page When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
  72. Given I am on the “/login” page When I fill

    in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have “everzet” user with “qwerty” password Background: Given I am on the “/login” page When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
  73. Given I am on the “/login” page When I fill

    in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have users: Background: Given I am on the “/login” page When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login | username | password | | everzet | qwerty | Feature: User logins
  74. Given I am on the “/login” page When I fill

    in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Given a site have users: Background: | username | password | | everzet | qwerty | Feature: User logins
  75. Given I am on the “/login” page When I fill

    in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Given a site have users: Background: | username | password | | everzet | qwerty | Examples: Feature: User logins
  76. Given I am on the “/login” page When I fill

    in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Feature: User logins Given a site have users: Background: | username | password | | everzet | qwerty | Examples: | username | password | message | | everzet | qwerty | Welcome, everzet | | someone | pa$$word | Login or password is incorrect |
  77. In-browser testing and frameworks support

  78. Sahi Goutte Selenium sfBrowser Symfony2 Client

  79. Sahi Goutte Selenium sfBrowser Symfony2 Client through one clean API

  80. M!"#

  81. Given I am on the “/login” page When I fill

    in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Feature: User logins Given a site have users: Background: | username | password | | everzet | qwerty | Examples: | username | password | message | | everzet | qwerty | Welcome, everzet | | someone | pa$$word | Login or password is incorrect |
  82. Given I am on the “/login” page When I fill

    in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Feature: User logins Given a site have users: Background: | username | password | | everzet | qwerty | Examples: | username | password | message | | everzet | qwerty | Welcome, everzet | | someone | pa$$word | Login or password is incorrect | @javascript
  83. Questions?