Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

38
Behavior Driven Development Naveen Kumar Singh Professional Scrum Trainer (PST) [email protected]

Transcript of Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Page 1: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Behavior Driven Development

Naveen Kumar Singh

Professional Scrum Trainer (PST)

[email protected]

Page 2: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Professional Scrum Trainer (PST) at Scrum.Org

Works as consultant agile coach and facilitator in software development field

Facilitate Scrum.Org and Scrum Alliance Training workshop

20 years working experience in product as well as service companiesincluding Xerox, Convergys, Cognizant and many more

Have been teaching and coaching multiple organizations on agile andengineering practices including Hays, Danfoss, KMG Infotech, Stryker,Robert Bosch, NCR Corporation and many more

Strength – Demonstrable knowledge about Scrum, Kanban and Large-Scale Scrum (LeSS, Nexus, Spotify) with Technical practices such TDD,BDD, CI/CD, DevOps

Weakness – Don’t go by book and don’t like prescriptive frameworks

Page 3: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Don’t blame waterfall. We haven’t practiced it

Page 4: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

New way is Agile way. But is this working for you?

Specification

Coding

Test cases

Testing

Deploy

Rework

Page 5: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

So what to do?

Max 2 suggestions

per team 5

Mins

Page 6: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

What Will cover here?

Goal Impact

Deliverables User Activities Features

User Stories Acceptance Criteria

Examples

Source Code

Page 7: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Scrum is nice but how to start delivering value?

Page 8: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

What’s needed to start Scrum?

• Problem Statement – Traffic jam in Dubai during pick hours

• You as stakeholder - What you can do?

• Simple solution - Are you Okay with Car Pooling?

• What stopping you?

Page 9: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

GOAL

• Let’s develop Car Pool Application

Registration Share Ride Book Ride Payment Review

Page 10: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Can we start development?

• Too big to develop and requirement is not yet clear?

• So what Next? Refinement

Registration Share Ride Book Ride Payment Review

Page 11: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Product Backlog Refinement

• When we refine? Couple of time before 1st

sprint and then continuous.

• Who do that? Product Owner and Development Team

• What we do? Understand, Split, Estimate and Order

• How to spilt? Is INVEST enough?

Page 12: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Some Splitting Technique

• Split based on WORKFLOW

Registration Signup Verification Login

LoginManage

ProfileLogout

Page 13: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Some Splitting Technique

• Split based on OPERATION

Share RidePublish New

Ride

View and

ConfirmModify Ride

Search all

My rideDelete Ride View Only

Page 14: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Some Splitting Technique

• Split based on RULES

Signup No Rules Only 18+Only IT

People

Only

Colombo

People

Page 15: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Some Splitting Technique

• Split based on DATA TYPE

PaymentReturn

FavorCredit Card Cash Card

Account

Transfer

Food

Coupon

Page 16: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Try splitting 2 per group

Signup VerificationManage

Profile

Publish New

Ride

Book Ride Review Credit Card Search Ride

10

Mins

Page 17: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

SO CAN WE START SPRINT?

• We need acceptance criteria.

• Not more than 3-4 criteria for a story.

Page 18: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Acceptance Criteria

• Feature: Quick Post

• As a car owner I want to post my ride with minimum requirement so that anyone can register for it.

Page 19: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Acceptance Criteria – Why?

Define boundaries

Provide values to feature

Shared understanding

Help in derive tests

Help in knowing

when to stop

Page 20: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Acceptance Criteria

• Source:______________ Destination:________________

• Time:________________ #Seat available:_____________

• Name:_______________ Email:______________________

• Phone:_______________

Cancel Submit

Share Your Ride

Page 21: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Acceptance Criteria

• Feature: Quick Post

• As a car owner I want to post my ride with minimum requirement so that anyone can register for it.

Data must be searchable to book rideEnsure only valid data getting saved even as guest userCancel should clear data so user can add new rideSuccessful submission will redirect user on home page

Page 22: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Discussion of Acceptance Criteria

If(user==“new”

{

object = user

}

Else

error

We should encourage

employee to update

rides

Login -> Click on

“New” and enter test

data and then Result

&%$^&

Page 23: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Collaboration of 3 amigos

Technical

Feasibility

Happy Path

Exceptions, Test

Data, Boundary

Conditions

Developer Business Tester

Page 24: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Building right or right product?

Business Failure

Useless Stuff

Business Success

Technical Debts

Specification By

Example

Build it Right

Build the Right Things

Page 25: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

What are Specifications by Example

Thin Slices of System Behavior

That Deliver Business Value

Described as concrete examples

That are potentially automatable

To create executable specifications

Captured in live documentation

Page 26: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Specifications By Collaboration

Page 27: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

What are Specifications by Example

Given_________________

When_________________

Then__________________Gherkin

Given “Naveen” enter source “Office” and destination “Airport”

and time “5.30pm” with 2 seats available

And he provides his mail id “[email protected]” and

phone number “9810547500”

When Click on “Submit”

Then Display message “Ride Share” with “OK” button

And take “Naveen” to “home” page on click on “OK”

And his ride should be shown on top

Page 28: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Acceptance Criteria

• Feature: Quick Post

Successful submission will redirect user on home page

Given “Naveen” enter source “Office” and destination “Airport”

and time “5.30pm” with 2 seats available

And he provides his mail id “[email protected]” and

phone number “9810547500”

When Click on “Submit”

Then Display message “Ride Share” with “OK” button

And take “Naveen” to “home” page on click on “OK”

And his ride should be shown on top

Page 29: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Gherkin

Feature – Name of feature

Scenario – Behavior to be developed

Given – Pre-conditions

When – Actions to be performed

Then – Expected Result

And – Use for multiple Given, When & Then

But – Describe exception cases

Scenario Outline – Define multiple scenarios

Examples – Multiple Scenarios

Background – Avoid repeated Given

Page 30: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Can We start Sprint Now?

Why not? We have testable specification so let’s start

Let’s make a rule for team to have examples for every specification

If examples not available then specification will not get picked up for sprint

Convert examples in test is our first activity

Write enough code to pass those tests

Page 31: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Test First

Test

Code

Test Again

Refactor

Pass

Fail

Fail

Page 32: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Behavior Driven Development

BDD

Given Scenario

Then Expected Outcome

When Perform Action

Page 33: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Let’s get started

Write Feature to describe scenario in Gherkin

Eclipse, Java, Cucumber, Selenium, Junit

Create Test Runner class file

Generate Steps file

Write code to pass test

Page 34: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

BDD - Characteristics

A testable story (it should be the smallest unit that fits in an iteration)

The title should describe an activity

The narrative should include a role, a feature, and a benefit

The scenario title should say what's different

The scenario should be described in terms of Givens, Events, and Outcomes

The givens should define all of, and no more than, the required context

The event should describe the feature

Page 35: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

BDD - Lifecycle

3

5

Your Project Features Scenarios Steps

Your SystemAutomation

LibrarySupport Code

Step

Definitions

Technology

Facing

Business

Facing

Page 36: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Professional Scrum Foundation (PSF)

Professional Scrum Developer (PSD)

Professional Scrum Master (PSM)

professional Scrum product Owner (PSPO)

Scaled Professional Scrum (SPS)

Page 37: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

Test Driven Development (TDD) Practitioner

Behavior Driven Development (BDD) Practitioner

Professional Agile Tester

Professional DevOps Consultant

Professional Lean Kanban Consultant

Extreme Programming (XP) Practitioner

Page 38: Workshop: Behavior Driven Development - Deliver value by Naveen Kumar Singh

GOLD SPONSORS

BRONZE SPONSOR SUPPORTER

MEDIA PARTNERS

SPONSORS & PARTNERS