Slide 1

Slide 1 text

©1993 – 2018 Scrum.org All Rights Reserved @ScrumDotOrg Dr. Charles (Chuck) Suscheck [email protected] 07/09/2018 Behavior Driven Development The Secret to Effective Backlog Refinement

Slide 2

Slide 2 text

©1993 – 2018 Scrum.org All Rights Reserved Let’s Talk… Proud Member: The Professional Agile Partnership SMOOTHAPPS 972-948-3151 [email protected] Ravi Verma The Org Whisperer BDD Class: Dec 13 – 14 2018

Slide 3

Slide 3 text

©1993 – 2018 Scrum.org All Rights Reserved This is me 3 PST Developer Doctor Strategist CAT

Slide 4

Slide 4 text

©1993 – 2018 Scrum.org All Rights Reserved @ScrumDotOrg 1 Let’s GO!

Slide 5

Slide 5 text

©1993 – 2018 Scrum.org All Rights Reserved Imagine a time when a project went just right 5

Slide 6

Slide 6 text

©1993 – 2018 Scrum.org All Rights Reserved Did everyone work in concert? 6

Slide 7

Slide 7 text

©1993 – 2018 Scrum.org All Rights Reserved Was everyone on the same page for the product? 7

Slide 8

Slide 8 text

©1993 – 2018 Scrum.org All Rights Reserved How did you figure out requirements? 8

Slide 9

Slide 9 text

©1993 – 2018 Scrum.org All Rights Reserved What’s the costliest problem with software? q Bugs q Users don’t use part of the product q Developers are highly paid q QA takes an unpredictable amount of time q Requirements are misunderstood q Technology is ever changing

Slide 10

Slide 10 text

©1993 – 2018 Scrum.org All Rights Reserved Discrete, wordy requirements don’t work 10

Slide 11

Slide 11 text

©1993 – 2018 Scrum.org All Rights Reserved Our brain is stimulated by examples 11

Slide 12

Slide 12 text

©1993 – 2018 Scrum.org All Rights Reserved Let’s construct an example of BDD! 12

Slide 13

Slide 13 text

©1993 – 2018 Scrum.org All Rights Reserved The application 13 You are writing a the blue light special app When people are running the app and connected to the store Wifi, The store can activate a “blue light special” deal message that is active for a pre- determined amount of time The deal can be active for a maximum of 15 minutes The deal message is short - 500 characters

Slide 14

Slide 14 text

©1993 – 2018 Scrum.org All Rights Reserved Quick think of a story for this application 14 Story As a store advertising manager I want to send out a blue light special to customers connected to the store wifi So they are encouraged to use the store wifi Acceptance criteria Special messages are <= 500 characters Messages only go to connected customers Messages are active a maximum of 15 minutes Title Body As a < role > I want to < do something > So that < I get business value > Acceptance criteria

Slide 15

Slide 15 text

©1993 – 2018 Scrum.org All Rights Reserved When a customer is connected to the wifi they will not receive a blue light message Write some concrete examples Customer Joe is connected to the store wifi When a blue light special with the message “dog food 15% off” is sent Joe will see the message “dog food 15% off” Here’s an example Here’s a concrete example

Slide 16

Slide 16 text

©1993 – 2018 Scrum.org All Rights Reserved When a customer isn’t connected to the wifi they will not receive a blue light message Write some concrete examples Customer Joe is not connected to the store wifi When a blue light special with the message “dog food 15% off” is sent Joe will not see the message Here’s an example Here’s a concrete example

Slide 17

Slide 17 text

©1993 – 2018 Scrum.org All Rights Reserved If a customer becomes connected to the wifi, the customer will receive messages as long as they were sent no more than 15 seconds before the connection occurred Write some concrete examples A blue light special with the message “dog food 15% off” is sent Customer Joe becomes connected to the store wifi Then Joe will see (ask the PO) Here’s rule Here’s a concrete example

Slide 18

Slide 18 text

©1993 – 2018 Scrum.org All Rights Reserved If a customer becomes disconnected to the wifi while receiving a message the message will not be displayed Write some concrete examples A blue light special with the message “dog food 15% off” is sent Customer Joe becomes disconnected from the wifi while receiving the message Then Joe will see (ask the PO) Here’s rule Here’s a concrete example

Slide 19

Slide 19 text

©1993 – 2018 Scrum.org All Rights Reserved Other examples to consider Does this work with all mobile? Can the message notification be turned off? What if the characters are > 200? What if 2 messages are active and a customer connects?

Slide 20

Slide 20 text

©1993 – 2018 Scrum.org All Rights Reserved Why examples are appropriate Inductive reasoning moves from specific instances into a generalized conclusion Deductive reasoning moves from generalized principles that are known to be true to a true and specific conclusion. Inductive reasoning is good for drawing conclusions that are not explicitly stated

Slide 21

Slide 21 text

©1993 – 2018 Scrum.org All Rights Reserved Pick a story Pick acceptance criteria Come up with examples Make new rules Split story or add ACC Purpose is to use examples to make rules

Slide 22

Slide 22 text

©1993 – 2018 Scrum.org All Rights Reserved

Slide 23

Slide 23 text

©1993 – 2018 Scrum.org All Rights Reserved @ScrumDotOrg 2 What is BDD?

Slide 24

Slide 24 text

©1993 – 2018 Scrum.org All Rights Reserved Isn’t this BDD?

Slide 25

Slide 25 text

©1993 – 2018 Scrum.org All Rights Reserved BDD General interpretation of BDD Automation (given, when, then + tools)

Slide 26

Slide 26 text

©1993 – 2018 Scrum.org All Rights Reserved BDD "BDD practitioners explore, discover, define then drive out the desired behavior of software using conversation, concrete examples and automated tests" Matt Wynne, The Cucumber Book Automate Tools Formulate Given, when, then Discover Examples and rules

Slide 27

Slide 27 text

©1993 – 2018 Scrum.org All Rights Reserved BDD

Slide 28

Slide 28 text

©1993 – 2018 Scrum.org All Rights Reserved Test Automation BDD

Slide 29

Slide 29 text

©1993 – 2018 Scrum.org All Rights Reserved Used after code is produced BDD

Slide 30

Slide 30 text

©1993 – 2018 Scrum.org All Rights Reserved Just another type of TDD BDD

Slide 31

Slide 31 text

©1993 – 2018 Scrum.org All Rights Reserved Just Technically Focused BDD

Slide 32

Slide 32 text

©1993 – 2018 Scrum.org All Rights Reserved The components Discovery Using examples to drive out story details, acceptance criteria, and new stories Formulation Using the examples to create a standardized (ubiquitous) language Automation Using the ubiquitous language to drive out automated specification verifications (tests)

Slide 33

Slide 33 text

©1993 – 2018 Scrum.org All Rights Reserved What to focus on in BDD Discover Formulate Automate Discover Formulate Automate Benefits Effort to Enact Discover Formulate Automate Effectiveness for Refinement

Slide 34

Slide 34 text

©1993 – 2018 Scrum.org All Rights Reserved Discover Automate Formulate Some BDD Tools Gherkin Given, when, then Cucumber/Specflow Regex, datatables, outlines Example Mapping Rules, acceptance criteria

Slide 35

Slide 35 text

©1993 – 2018 Scrum.org All Rights Reserved Inductive rule generation

Slide 36

Slide 36 text

©1993 – 2018 Scrum.org All Rights Reserved @ScrumDotOrg 3 Discovery

Slide 37

Slide 37 text

©1993 – 2018 Scrum.org All Rights Reserved . . . . Iterative Product Backlog Refinement 100% Story Title 50% Refined with AC 70% Story Body 25% Refined again 2 sprints sprint ready Sprint Planned Story Format Title: Body: As a I want So that Acceptance Criteria: -Verify that -Verify that -Verify that

Slide 38

Slide 38 text

©1993 – 2018 Scrum.org All Rights Reserved Acceptance Criteria Acceptance Criteria The conditions that a software product must satisfy to be accepted by a user or customer. Rule One of a set of explicit or understood regulations or principles governing conduct within a particular activity or sphere. Acceptance criteria = Type of rule

Slide 39

Slide 39 text

©1993 – 2018 Scrum.org All Rights Reserved Developed by Matt Wynne https://cucumber.io/blog/2015/12/08/example-mapping-introduction

Slide 40

Slide 40 text

©1993 – 2018 Scrum.org All Rights Reserved Rule Rule https://cucumber.io/blog/2018/05/23/your-first-example-mapping-session Rule Example Story Question Example Example Example Example Example Example Example Example Story Question Question Question

Slide 41

Slide 41 text

©1993 – 2018 Scrum.org All Rights Reserved An alternative format for examples Context Action Outcome A blue light special with the message “dog food 15% off” is sent Customer Joe is not connected to the store wifi Joe will see no message

Slide 42

Slide 42 text

©1993 – 2018 Scrum.org All Rights Reserved Sounds like GWT format, doesn’t it? Given When Then A blue light special with the message “dog food 15% off” is sent Customer Joe is not connected to the store wifi Joe will see no message

Slide 43

Slide 43 text

©1993 – 2018 Scrum.org All Rights Reserved @ScrumDotOrg 4 Formulation

Slide 44

Slide 44 text

©1993 – 2018 Scrum.org All Rights Reserved Basic Gherkin Syntax Given When Then And But * # (Comments) Scenario: Feature: Numbers become an input “quote” makes the string an input

Slide 45

Slide 45 text

©1993 – 2018 Scrum.org All Rights Reserved Example of business side

Slide 46

Slide 46 text

©1993 – 2018 Scrum.org All Rights Reserved @ScrumDotOrg 5 Automation

Slide 47

Slide 47 text

©1993 – 2018 Scrum.org All Rights Reserved Automated Tests UI Acceptance Unit Rough quantity Exploratory Testing

Slide 48

Slide 48 text

©1993 – 2018 Scrum.org All Rights Reserved Discover with Examples Pick a story Discover Make the test pass Refactor Code Write a failing unit test TDD BDD Convert example into Scenario Formulate Generate Scenario Automate Implement Scenario

Slide 49

Slide 49 text

©1993 – 2018 Scrum.org All Rights Reserved Overview of technology Feature File Step Def Files Cucumber tool Business Side Implementation Side Junit tests Code Implement Step Def

Slide 50

Slide 50 text

©1993 – 2018 Scrum.org All Rights Reserved Stepdef Code @Given("^I enter (\\d+) and -?(\\d+)$") public void i_enter_and(int arg1, int arg2) throws Throwable { myCalculator.insertNumber(arg1); myCalculator.insertNumber(arg2); // throw new PendingException(); } @When("^I press \"(w*?)\"$") public void i_press(String arg1) throws Throwable { myCalculator.press(arg1); } @Then("^I will see -?(\\d+)$") public void i_will_see(int arg1) throws Throwable { int result = myCalculator.getResult(); Assert.assertEquals("Test failed", arg1, result); // throw new PendingException(); }

Slide 51

Slide 51 text

©1993 – 2018 Scrum.org All Rights Reserved @ScrumDotOrg 6 Let’s END

Slide 52

Slide 52 text

©1993 – 2018 Scrum.org All Rights Reserved References • Discovery by Seb Rose • The Cucumber Book by Wynne and Hellesoy • Cucumber for Java by Rose and Wynne • Cucumber.io • https://cucumber.io/blog/2015/12/08/example-mapping- introduction

Slide 53

Slide 53 text

©1993 – 2018 Scrum.org All Rights Reserved 53 Webcasts and Videos – Learn From Our Trainers

Slide 54

Slide 54 text

©1993 – 2018 Scrum.org All Rights Reserved 54 • https://www.scrum.org/ resources/blog • Articles to further your Scrum knowledge and improve your Agile practices. • Written by our community of world-class Professional Scrum Trainers. Blog - Read Insights and Tips from Our Trainers

Slide 55

Slide 55 text

©1993 – 2018 Scrum.org All Rights Reserved Thank you! Charles Suscheck [email protected] @dr_chuck 55 Dec 13 – 14 2018

Slide 56

Slide 56 text

©1993 – 2018 Scrum.org All Rights Reserved You’re still here? 56