Slide 1

Slide 1 text

Cucumber BRIDGING COMMUNICATION GAPS WITH DEVELOPERS AND STAKEHOLDERS @BERMONPAINTER ConFoo 2014

Slide 2

Slide 2 text

The hardest single part of building a software system is deciding precisely what to build. ! - Fred Brooks

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Overview OUTLINE UNIT TESTS vs. ACCEPTANCE TESTS Workflow FEATURES, SCENARIOS, & STEPS Step Definitions VERIFY ACCEPTANCE CRITERIA Benefits & Best Practices WRITING FEATURES & IMPROVING COLLABORATION Convincing Stakeholders 5 WAYS TO CONVINCE STAKEHOLDERS TO WRITE FEATURES

Slide 5

Slide 5 text

Cucumber BEHAVIOR DRIVEN DEVELOPMENT FRAMEWORK

Slide 6

Slide 6 text

Written in a plain text language called Gherkin. CUCUMBER

Slide 7

Slide 7 text

Describes how software should behave. CUCUMBER

Slide 8

Slide 8 text

Helps bridge gaps in communication with non-technical and technical teams. CUCUMBER

Slide 9

Slide 9 text

Can provide a consistent feedback loop. CUCUMBER

Slide 10

Slide 10 text

Minimizes misunderstandings & incorrect concepts before implementing in code. CUCUMBER

Slide 11

Slide 11 text

Reduces costs, decreases time-to- market and improves maintainability. CUCUMBER

Slide 12

Slide 12 text

Unit Tests UNIT TESTS vs. ! ACCEPTANCE TESTS ENSURE YOU BUILD THE THING RIGHT

Slide 13

Slide 13 text

Unit Tests UNIT TESTS vs. ! ACCEPTANCE TESTS ENSURE YOU BUILD THE THING RIGHT Acceptance Tests ENSURE YOU BUILD THE RIGHT THING

Slide 14

Slide 14 text

Workflow FEATURES, SCENARIOS & STEPS

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Features WRITTEN BY STAKEHOLDERS IN COLLABORATION WITH THE TEAM

Slide 17

Slide 17 text

Step Definitions WRITTEN BY DEVELOPERS

Slide 18

Slide 18 text

Application WRITTEN BY DEVELOPERS

Slide 19

Slide 19 text

Feature Files DESCRIBE HOW STAKEHOLDERS THINK THE SYSTEM SHOULD WORK

Slide 20

Slide 20 text

FEATURE FILES Feature: Feedback when entering invalid credit card details ! In user testing we've seen a lot of people who made mistakes entering their credit card. We need to be as helpful as possible here to avoid losing users at this crucial stage of the transaction. ! Scenario: Credit card number too short Given I have chosen some items to buy
 And I am about to enter credit card info
 When I enter a card number that's only 15 digits long
 And all the other details are correct
 And I submit the form
 Then the form should be redisplayed
 And I should see a message advising me of the correct number of digits

Slide 21

Slide 21 text

FEATURE FILES Feature: … ! Scenario: … Given: … And: … When: … Then: … And: … Features EACH FEATURE FILE BEGINS WITH A FEATURE IN ORDER TO PROVIDE A DESCRIPTIVE SUMMARY. ! FEATURE DESCRIPTIONS PROVIDE CONTEXT.

Slide 22

Slide 22 text

FEATURE FILES Feature: … ! Scenario: … Given: … And: … When: … Then: … But: … Scenarios SCENARIOS PROVIDE AN EXAMPLE OF HOW THE SYSTEM SHOULD BEHAVE.

Slide 23

Slide 23 text

FEATURE FILES Feature: … ! Scenario: … Given: … And: … When: … Then: … But: … Steps WRITTEN IN PLAIN ENGLISH. STEPS WILL MAKE UP THE MAJORITY OF A FEATURE FILE.

Slide 24

Slide 24 text

FEATURE FILES Feature: … ! Scenario: … Given: … And: … When: … Then: … But: … Steps GIVEN: SETUP

Slide 25

Slide 25 text

FEATURE FILES Feature: … ! Scenario: … Given: … And: … When: … Then: … But: … Steps GIVEN: SETUP ! WHEN: ACTIONS ! THEN: ASSERTIONS

Slide 26

Slide 26 text

FEATURE FILES Feature: … ! Scenario: … Given: … And: … When: … Then: … But: … Steps GIVEN: SETUP ! WHEN: ACTIONS ! THEN: ASSERTIONS ! AND/BUT: HELPERS

Slide 27

Slide 27 text

FEATURE FILES Feature: Feedback when entering invalid credit card details ! In user testing we've seen a lot of people who made mistakes entering their credit card. We need to be as helpful as possible here to avoid losing users at this crucial stage of the transaction. ! Scenario: Credit card number too short Given I have chosen some items to buy
 Given I am about to enter credit card info
 Given I enter a card number that's only 15 digits long
 Given all the other details are correct
 Given I submit the form
 Given the form should be redisplayed
 Given I should see a message advising me of the correct number of digits

Slide 28

Slide 28 text

FEATURE FILES Feature: Feedback when entering invalid credit card details ! In user testing we've seen a lot of people who made mistakes entering their credit card. We need to be as helpful as possible here to avoid losing users at this crucial stage of the transaction. ! Scenario: Credit card number too short * I have chosen some items to buy
 * I am about to enter credit card info
 * I enter a card number that's only 15 digits long
 * all the other details are correct
 * I submit the form
 * the form should be redisplayed
 * I should see a message advising me of the correct number of digits

Slide 29

Slide 29 text

Step Definitions EXECUTE SCENARIOS IN FEATURE FILES AND VERIFY THAT THE SYSTEM MEETS ACCEPTANCE CRITERIA

Slide 30

Slide 30 text

STEP DEFINITIONS Feature: Feedback when entering invalid credit card details ! Given /I have chosen some items to buy/ do
 # CODE GOES HERE end ! When /I enter a card number that's only 15 digits long/ do
 # CODE GOES HERE end ! And /all the other details are correct/ do
 # CODE GOES HERE end ! And /I submit the form/ do
 # CODE GOES HERE end ! Then /the form should be redisplayed/ do
 # CODE GOES HERE end

Slide 31

Slide 31 text

Process PUTTING ALL OF THE PIECES TOGETHER AS A TEAM

Slide 32

Slide 32 text

1. Describe Behaviors (STAKEHOLDER + TEAM) ! 2. Write Step Definitions (DEVELOPERS) ! 3. Run Tests (TESTS FAIL) ! 4. Write Code for Tests to Pass ! 5. Run Tests (TESTS PASS) FAIL PASS REFACTOR

Slide 33

Slide 33 text

Writing Features BENEFITS & BEST PRACTICES TO GET THE MOST OUT OF CUCUMBER & BDD

Slide 34

Slide 34 text

Improve client & team communication BENEFITS

Slide 35

Slide 35 text

Encourages discussions among all team members BENEFITS

Slide 36

Slide 36 text

Better integration & acceptance testing BENEFITS

Slide 37

Slide 37 text

Describe features, not a sequence of actions BEST PRACTICES

Slide 38

Slide 38 text

Keep features at a high level BEST PRACTICES

Slide 39

Slide 39 text

Hide complexity in the implementation of the steps BEST PRACTICES

Slide 40

Slide 40 text

Test the most important/risky pieces of a system first BEST PRACTICES

Slide 41

Slide 41 text

Write tests until the remaining risk isn't worth the time & money to address BEST PRACTICES

Slide 42

Slide 42 text

Commit Feature Files to Version Control. INSTANT FEATURE HISTORY

Slide 43

Slide 43 text

Improving Collaboration WORKING WITH TO IMPROVE COMMUNICATION WITH STAKEHOLDERS

Slide 44

Slide 44 text

Developers write all feature files UNFORTUNATE COMMON OCCURRENCES

Slide 45

Slide 45 text

Stakeholders write all feature files UNFORTUNATE COMMON OCCURRENCES

Slide 46

Slide 46 text

Stakeholders write feature files in collaboration with their team BEST CASE SCENARIO

Slide 47

Slide 47 text

Convincing Stakeholders 5 WAYS TO CONVINCE STAKEHOLDERS TO WRITE FEATURE FILES

Slide 48

Slide 48 text

Do only as much planning, analysis, and design as you need, but no more. ONE

Slide 49

Slide 49 text

Deliver stakeholder value TWO

Slide 50

Slide 50 text

Create a consistent language THREE

Slide 51

Slide 51 text

Concise and understandable documentation FOUR

Slide 52

Slide 52 text

Explore examples through collaboration FIVE

Slide 53

Slide 53 text

You should not be afraid to delete tests that are no longer providing value, no matter whether you originally planned to keep them or not. We tend to treat tests as these holy creatures that live blameless, irreproachable lives once they have sprung into existence. ! Not so. ! The maintenance required to keep a test running weighs against its value in further development. Sometimes these lines cross, and the test simply becomes a burden on the project. Having the skill and experience to recognize a burdensome test is something we should be bringing to our clients, as well as the fortitude to rewrite it, rethink it, or delete it. ! - Adam Milligan

Slide 54

Slide 54 text

Fin. @BERMONPAINTER ConFoo 2014