Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

bdd

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

It is a tool to bring a structure into agile processes.

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

BDD

Slide 8

Slide 8 text

BDD is agile enabler.

Slide 9

Slide 9 text

is a BDD enabler

Slide 10

Slide 10 text

How?

Slide 11

Slide 11 text

Requirements Analysis Design Develop Test [Royce 1970] 9 months 3 months 2 months 12 months ...

Slide 12

Slide 12 text

Most of the cost in software development is in feedback delay

Slide 13

Slide 13 text

Let’s reduce feedback delay

Slide 14

Slide 14 text

[Beck & Cunningham 1996-99] Refactoring Code Test Requirements Acceptance

Slide 15

Slide 15 text

Let’s rename a few things

Slide 16

Slide 16 text

Incremental Design Implement Describe Object Narratives What do you mean [North 03]

Slide 17

Slide 17 text

Incremental Design Implement Describe Object Narratives What do you mean StoryBDD TDD

Slide 18

Slide 18 text

StoryBDD

Slide 19

Slide 19 text

StoryBDD could look like functional TDD to people from outside BDD community, but it’s a lie.

Slide 20

Slide 20 text

We are not testing that application functions as we (developers) expect it to, but instead we’re testing that it fullfils clients business needs.

Slide 21

Slide 21 text

Some applications could easily fullfill developers expectations and still not being able to cover business needs.

Slide 22

Slide 22 text

You might think about StoryBDD as a technique to teach your clients about testing, but in reality it's a tool to teach you about client business.

Slide 23

Slide 23 text

Exploration OF Domain area

Slide 24

Slide 24 text

3 levels of domain exploration

Slide 25

Slide 25 text

1 2 3 narrative possible scenarios scenario details

Slide 26

Slide 26 text

Feature: Authorization In order to get access to the shopping history As a frequent buyer I need to be able to authenticate 1 2 3 possible scenarios scenario details

Slide 27

Slide 27 text

Feature: Authorization In order to get access to the shopping history As a frequent buyer I need to be able to authenticate Scenario: Successfully authenticating with correct credentials 1 2 3 scenario details

Slide 28

Slide 28 text

Feature: Authorization In order to get access to the shopping history As a frequent buyer I need to be able to authenticate Scenario: Successfully authenticating with correct credentials Given there is a user “everzet” with password “123” And I am on the login page When I fill in “username” with “everzet” And I fill in “password” with “123” And I press “login” Then I should see “Hello, everzet” 1 2 3

Slide 29

Slide 29 text

Feature: Authorization In order to get access to the shopping history As a frequent buyer I need to be able to authenticate Scenario: Successfully authenticating with correct credentials Scenario: Can not authenticate with wrong credentials Scenario: Blocked user can not authenticate, even with correct credentials

Slide 30

Slide 30 text

Feature: Authorization In order to get access to the shopping history As a frequent buyer I need to be able to authenticate user story =>

Slide 31

Slide 31 text

StoryBDD helps ensuring that development team has understanding of business on the same level that client does

Slide 32

Slide 32 text

StoryBDD helps ensuring that development team has understanding of business on the same level that client does And even leveling up client knowledge of his business

Slide 33

Slide 33 text

How?

Slide 34

Slide 34 text

by Forcing you business questions to answer

Slide 35

Slide 35 text

1. For who?

Slide 36

Slide 36 text

1. For who? 2. What?

Slide 37

Slide 37 text

1. For who? 2. What? 3. How?

Slide 38

Slide 38 text

1. For who? 2. What? 3. How? Why?

Slide 39

Slide 39 text

example Registration

Slide 40

Slide 40 text

” I want visitors to be able to register on my website through simple registration form. Your hypothetical client

Slide 41

Slide 41 text

1.Who?

Slide 42

Slide 42 text

1.Who? users?

Slide 43

Slide 43 text

1.Who? users visitors

Slide 44

Slide 44 text

1.Who? users visitors 2.Why?

Slide 45

Slide 45 text

1.Who? users visitors 2.Why? it’s common?

Slide 46

Slide 46 text

1.Who? users visitors 2.Why? it’s common buyings history

Slide 47

Slide 47 text

Know your client clients!

Slide 48

Slide 48 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site

Slide 49

Slide 49 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration

Slide 50

Slide 50 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration benefit role (benefitiar)

Slide 51

Slide 51 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration benefit role (benefitiar) in order to ... as a ... i need to ... Feature: ... benefit role (benefitiar) in order to ... as a ... i need to ... Feature: ... benefit role (benefitiar) in order to ... as a ... i need to ... Feature: ... benefit role (benefitiar)

Slide 52

Slide 52 text

in order to ... as a ... i need to ... Feature: ... benefit role (benefitiar) in order to ... as a ... i need to ... Feature: ... benefit role (benefitiar) in order to ... as a ... i need to ... Feature: ... benefit role (benefitiar) in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration benefit role (benefitiar) SELECT f.* FROM ‘/features’ as f ORDER BY f.role, f.benefit LIMIT 10 PSEUDOAgileQL

Slide 53

Slide 53 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration

Slide 54

Slide 54 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration Scenario: Successful registration when visitor provides all the required info

Slide 55

Slide 55 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration Scenario: Successful registration when visitor provides all the required info Scenario: Unable to register when visitor misses required info

Slide 56

Slide 56 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration Scenario: Successful registration when visitor provides all the required info Scenario: Unable to register when visitor misses required info Scenario: ...

Slide 57

Slide 57 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration Scenario: Successful registration when visitor provides all the required info Scenario: Unable to register when visitor misses required info Scenario: ... Scenario: ... Scenario: ... Scenario: ... Scenario: ...

Slide 58

Slide 58 text

in order to maintain my shopping history as a site visitor i need to be able to register on this site Feature: registration Scenario: Successful registration when visitor provides all the required info Given I am on homepage And I follow “sign up” When I fill in “email” with “[email protected]” And I fill in “username” with “linkedin” And I fill in “password” with “sha1_without_salt” And I press “register” Then I should see “You have been successfully registered” And I should be on homepage

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

$> vim composer.json { “require-dev”: { “behat/behat”: “~2.4.5”, }, “config”: { “bin-dir”: “bin/” } } $> curl http://getcomposer.org/installer | php $> php composer.phar install --dev

Slide 61

Slide 61 text

$> bin/behat --init +d features +d features/bootstrap +f features/bootstrap/FeatureContext.php

Slide 62

Slide 62 text

Slide 63

Slide 63 text

$> bin/behat ... You can implement step definitions for undefined steps with these snippets: /** * @When /^I fill in “([^”]+)” with “([^”]+)”$/ */ public function iFillInWith($val1, $val2) { throw new PendingException(); } ...

Slide 64

Slide 64 text

$> bin/behat ... You can implement step definitions for undefined steps with these snippets: /** * @When /^I fill in “([^”]+)” with “([^”]+)”$/ */ public function iFillInWith($val1, $val2) { throw new PendingException(); } ...

Slide 65

Slide 65 text

$> bin/behat --append-snippets

Slide 66

Slide 66 text

/** * @Given /^I am on homepage$/ */ public function iAmOnHomepage() { throw new PendingException(); } /** * @Given /^I follow “sign up”$/ */ public function iFollowSignUp() { throw new PendingException(); } /** * @When /^I fill in “([^”]+)” with “([^”]+)”$/ */ public function iFillInWith($val1, $val2) { throw new PendingException(); }

Slide 67

Slide 67 text

$> bin/behat Feature: registration in order to maintain my shopping history as a site visitor i need to be able to register on this site Scenario: Successful registration when visitor provides all the required info Given I am on homepage TODO: write pending definition And I follow “sign up” When I fill in “email” with “[email protected]” And I fill in “username” with “linkedin” And I fill in “password” with “sha1_without_salt” And I press “register” Then I should see “You have been successfully registered” And I should be on homepage 1 scenario (1 pending) 8 steps (7 skipped, 1 pending) 0m0.015s

Slide 68

Slide 68 text

/** * @Given /^I am on homepage$/ */ public function iAmOnHomepage() { $crawler = new \Some\Crawler\Lib\Crawler(); $crawler->goto(“http://localhost:8080/”); if (200 !== $crawler->getCurrentStatusCode()) { throw new \RuntimeException(‘Can not open homepage’); } }

Slide 69

Slide 69 text

$> bin/behat Feature: registration in order to maintain my shopping history as a site visitor i need to be able to register on this site Scenario: Successful registration when visitor provides all the required info Given I am on homepage Can not open homepage And I follow “sign up” When I fill in “email” with “[email protected]” And I fill in “username” with “linkedin” And I fill in “password” with “sha1_without_salt” And I press “register” Then I should see “You have been successfully registered” And I should be on homepage 1 scenario (1 failed) 8 steps (7 skipped, 1 failed) 0m0.015s

Slide 70

Slide 70 text

$> vim src/

Slide 71

Slide 71 text

Incremental Design Implement Describe Object Narratives What do you mean StoryBDD TDD

Slide 72

Slide 72 text

$> bin/behat Feature: registration in order to maintain my shopping history as a site visitor i need to be able to register on this site Scenario: Successful registration when visitor provides all the required info Given I am on homepage And I follow “sign up” TODO: write pending definition When I fill in “email” with “[email protected]” And I fill in “username” with “linkedin” And I fill in “password” with “sha1_without_salt” And I press “register” Then I should see “You have been successfully registered” And I should be on homepage 1 scenario (1 pending) 8 steps (1 passed, 1 pending, 6 skipped) 0m0.015s