Slide 1

Slide 1 text

What is BDD ...and why should I care? @mattwynne BCS, Edinburgh 3rd October 2012

Slide 2

Slide 2 text

Living documentation BDD Kickstart.com mattwynne.net Coaching / blogging training Collaborating

Slide 3

Slide 3 text

BDD: Dual Audience Stakeholders, Customers, Users Programmers, Testers

Slide 4

Slide 4 text

Problem domain Solution domain

Slide 5

Slide 5 text

"Behaviour-Driven Development (BDD) builds upon Test-Driven Development (TDD) by formalising the good habits of the best TDD practitioners." -- The Cucumber Book, 2011

Slide 6

Slide 6 text

The best TDD practitioners... • Work from the outside-in • Use examples to clarify their requirements • Develop and use a ubiquitous language

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

UBIQUITOUS LANGUAGE

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

DDD + NLP

Slide 11

Slide 11 text

Language matters DDD + NLP

Slide 12

Slide 12 text

OUTSIDE IN

Slide 13

Slide 13 text

Outside-in

Slide 14

Slide 14 text

Why?

Slide 15

Slide 15 text

Why? Why? Why? Why? Why?

Slide 16

Slide 16 text

Organisation Goal

Slide 17

Slide 17 text

Product Features / Epics

Slide 18

Slide 18 text

User / Stakeholder Stories

Slide 19

Slide 19 text

VISA subscriptions In order to increase subscriptions visitors should be able to subscribe online with a VISA card User / Stakeholder Story

Slide 20

Slide 20 text

VISA subscriptions In order to increase subscriptions visitors should be able to subscribe online with a VISA card User / Stakeholder Story

Slide 21

Slide 21 text

VISA subscriptions In order to increase subscriptions visitors should be able to subscribe online with a VISA card User / Stakeholder Story

Slide 22

Slide 22 text

VISA subscriptions In order to increase subscriptions visitors should be able to subscribe online with a VISA card User / Stakeholder Story

Slide 23

Slide 23 text

VISA subscriptions In order to increase subscriptions visitors should be able to subscribe online with a VISA card Acceptance Criteria

Slide 24

Slide 24 text

Acceptance Criteria •Must support VISA •Does not need to support MasterCard, Switch •... •Customers should be prevented from entering invalid credit card details • ... Credit Card Processing Acceptance criteria:

Slide 25

Slide 25 text

Acceptance Criteria

Slide 26

Slide 26 text

Are we ready yet?

Slide 27

Slide 27 text

Really? So tell me... "Customers should be prevented from entering invalid credit card details"

Slide 28

Slide 28 text

Really? So tell me... "Customers should be prevented from entering invalid credit card details" • What exactly makes someone's credit card details invalid?

Slide 29

Slide 29 text

Really? So tell me... "Customers should be prevented from entering invalid credit card details" • What exactly makes someone's credit card details invalid? • Can they use spaces?

Slide 30

Slide 30 text

Really? So tell me... "Customers should be prevented from entering invalid credit card details" • What exactly makes someone's credit card details invalid? • Can they use spaces? • Should we checksum the digits?

Slide 31

Slide 31 text

Really? So tell me... "Customers should be prevented from entering invalid credit card details" • What exactly makes someone's credit card details invalid? • Can they use spaces? • Should we checksum the digits? • How do we feed back that the details are invalid?

Slide 32

Slide 32 text

Really? So tell me... "Customers should be prevented from entering invalid credit card details" • What exactly makes someone's credit card details invalid? • Can they use spaces? • Should we checksum the digits? • How do we feed back that the details are invalid?

Slide 33

Slide 33 text

Really? So tell me... "Customers should be prevented from entering invalid credit card details" • What exactly makes someone's credit card details invalid? • Can they use spaces? • Should we checksum the digits? • How do we feed back that the details are invalid? An example would be handy right about now...

Slide 34

Slide 34 text

EXAMPLES

Slide 35

Slide 35 text

Acceptance Criteria

Slide 36

Slide 36 text

Scenarios

Slide 37

Slide 37 text

"Customers should be prevented from entering invalid credit card details" 1. Customer enters a credit card number that contains only 15 digits 2. Customer tries to submit the form 3. form is re-displayed with an error message advising Customer that the correct number of digits is 16 For example, imagine this scenario:

Slide 38

Slide 38 text

"Customers should be prevented from entering invalid credit card details" 1. Customer enters a credit card number that contains only 15 digits 2. Customer tries to submit the form 3. form is re-displayed with an error message advising Customer that the correct number of digits is 16 For example, imagine this scenario: Really? Always?

Slide 39

Slide 39 text

"Customers should be prevented from entering invalid credit card details" 1. Customer enters a credit card number that contains only 15 digits 2. Customer tries to submit the form 3. form is re-displayed with an error message advising Customer that the correct number of digits is 16 For example, imagine this scenario: What if...? Really? Always?

Slide 40

Slide 40 text

Common understanding of Done

Slide 41

Slide 41 text

User Story Acceptance Criteria Scenarios

Slide 42

Slide 42 text

Scenarios

Slide 43

Slide 43 text

AUTOMATION

Slide 44

Slide 44 text

Behaviour = Context + Action + Outcome

Slide 45

Slide 45 text

Behaviour = Context + Action + Outcome Given

Slide 46

Slide 46 text

Behaviour = Context + Action + Outcome Given When

Slide 47

Slide 47 text

Behaviour = Context + Action + Outcome Given When Then

Slide 48

Slide 48 text

Scenario: Tickle a happy person Given I am in a good mood When you tickle me Then I will giggle

Slide 49

Slide 49 text

Scenario: Tickle a happy person Given I am in a good mood When you tickle me Then I will giggle

Slide 50

Slide 50 text

Scenario: Tickle a grumpy person Given I am in a bad mood When you tickle me Then I will giggle

Slide 51

Slide 51 text

Scenario: Tickle a grumpy person Given I am in a bad mood When you tickle me Then I will giggle expected: "tee hee hee", got: "bugger off"

Slide 52

Slide 52 text

Scenario: Tickle a grumpy person Given I am in a bad mood When you tickle me Then I will get cross

Slide 53

Slide 53 text

Scenario: Attack a happy person Given I am in a good mood When you kick me in the shins Then I will get cross

Slide 54

Slide 54 text

Scenario: Attack a happy person Given I am in a good mood When you kick me in the shins Then I will get cross

Slide 55

Slide 55 text

Behaviour = Context + Action + Outcome

Slide 56

Slide 56 text

Behaviour = Context + Action + Outcome Given

Slide 57

Slide 57 text

Behaviour = Context + Action + Outcome Given When

Slide 58

Slide 58 text

Behaviour = Context + Action + Outcome Given When Then

Slide 59

Slide 59 text

System = ∑(Behaviour)

Slide 60

Slide 60 text

http://cukes.info/

Slide 61

Slide 61 text

Javascript

Slide 62

Slide 62 text

Demo

Slide 63

Slide 63 text

Gherkin (language)

Slide 64

Slide 64 text

# language: en Feature: Division In order to avoid silly mistakes Cashiers must be able to calculate a fraction Scenario: Regular numbers Given I have entered 3 into the calculator And I have entered 2 into the calculator When I press divide Then the result should be 1.5 on the screen

Slide 65

Slide 65 text

# language: ja ϑΟʔνϟ: আࢉ όΧͳؒҧ͍Λආ͚ΔͨΊʹ ༗ཧ਺΋ܭࢉͰ͖Δ͜ͱ γφϦΦ: ;ͭ͏ͷ਺஋ લఏ 3 Λೖྗ ͔ͭ 2 Λೖྗ ΋͠ divide Λԡͨ͠ ͳΒ͹ 1.5 Λදࣔ

Slide 66

Slide 66 text

български català Cymraeg Česky dansk Deutsch English Australian LOLCAT Texan español eesti keel ೔ຊޠ 한국어 lietuvių kalba latviešu Nederlands norsk polski português română suomi français hrvatski magyar Bahasa Indonesia italiano русский Svenska Slovensky Узбекча Tiếng Việt 简ମதจ ൟᱪதจ תירבע !"#$%&ا

Slide 67

Slide 67 text

OH HAI: STUFFING MISHUN: CUCUMBR I CAN HAZ IN TEH BEGINNIN "3" CUCUMBRZ WEN I EAT "2" CUCUMBRZ DEN I HAZ "2" CUCUMBERZ IN MAH BELLY AN IN TEH END "1" CUCUMBRZ KTHXBAI!

Slide 68

Slide 68 text

Gherkin Fundamentals Feature: Feature name Description of feature goes here Scenario: Scenario name Description of scenario goes here Given a certain context When something happens Then an outcome And something else But not this though Scenario: Another scenario name Description of another scenario goes here ...

Slide 69

Slide 69 text

FORGET THE TOOLS

Slide 70

Slide 70 text

"Let's make toast the American way: You burn it, and I'll scrape it" - W. E. Demming

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

Plan

Slide 73

Slide 73 text

Plan Develop

Slide 74

Slide 74 text

Plan Develop Misery

Slide 75

Slide 75 text

Plan Develop Testing

Slide 76

Slide 76 text

Plan Develop Testing

Slide 77

Slide 77 text

Plan Develop Test

Slide 78

Slide 78 text

So... why should I care?

Slide 79

Slide 79 text

If you're a developer

Slide 80

Slide 80 text

If you're a developer • BDD will help you to focus

Slide 81

Slide 81 text

If you're a developer • BDD will help you to focus • BDD will give you confidence to refactor

Slide 82

Slide 82 text

If you're a developer • BDD will help you to focus • BDD will give you confidence to refactor • BDD will help you to understand the business-facing people on your team better

Slide 83

Slide 83 text

If you're a product owner or business analyst

Slide 84

Slide 84 text

If you're a product owner or business analyst • BDD will give you a greater insight into the complexity of what you're asking for

Slide 85

Slide 85 text

If you're a product owner or business analyst • BDD will give you a greater insight into the complexity of what you're asking for • BDD will give you transparency about what the team are doing in each iteration

Slide 86

Slide 86 text

If you're a product owner or business analyst • BDD will give you a greater insight into the complexity of what you're asking for • BDD will give you transparency about what the team are doing in each iteration • BDD will help your team ship faster

Slide 87

Slide 87 text

If you're a tester

Slide 88

Slide 88 text

If you're a tester • BDD will mean you can find bugs before they've even been written

Slide 89

Slide 89 text

If you're a tester • BDD will mean you can find bugs before they've even been written • BDD will free you to do interesting, creative, exploratory testing

Slide 90

Slide 90 text

If you're a project manager

Slide 91

Slide 91 text

If you're a project manager • BDD will help your team achieve a steadier, more predictable, and ultimately faster pace

Slide 92

Slide 92 text

Thanks • [email protected] • @mattwynne • http://blog.mattwynne.net