the fastest bdd crash-course ever

44
@gil_zilberfeld @gil_zilberfeld BDD Crash Course

Upload: gil-zilberfeld

Post on 21-Jan-2018

285 views

Category:

Software


0 download

TRANSCRIPT

@gil_zilberfeld@gil_zilberfeld

BDD Crash Course

@gil_zilberfeld

Hello!

I AM GIL ZILBERFELD

www.gilzilberfeld.com

www.everydayunittesting.com

@gil_zilberfeld

@gil_zilberfeld@gil_zilberfeld

Behavior Driven Development

@gil_zilberfeld

BDD“Combines the general techniques and

principles of TDD with ideas from

DDD and OOAD to provide software

development and management teams with

shared tools and a shared process to

collaborate on software development..”

@gil_zilberfeld@gil_zilberfeld

It’s all about conversations!

Automation comes later

@gil_zilberfeld

Not the testing pyramid

@gil_zilberfeld

A story

◉ Who – Stakeholder

◉ Why – Goals

◉ What - Capabilities

◉ How - Implementation

@gil_zilberfeld

@gil_zilberfeld

Stakeholder“An individual, group, or

organization, who may affect, be

affected by, or perceive itself to be

affected by a decision, activity, or

outcome of a project.”

@gil_zilberfeld

Stakeholders

◉ Users

◉ Customers

◉ Builders

◉ Regulators

◉ Bystanders

@gil_zilberfeld

Categorizing stakeholders

◉ Roles

◉ Jobs to be done (JTBD)

◉ What’s important for them?

◉ How does the product impact their lives?

@gil_zilberfeld@gil_zilberfeld

Who are the stakeholders of Airbnb?

@gil_zilberfeld

Testicorn – A killer app

The ghost of the

testing unicorn

that terrorizes the

city of Stockholm

@gil_zilberfeld

Exercise: Testicorn stakeholders

◉ List them

◉ Categorize them

◉ Rate them

@gil_zilberfeld

@gil_zilberfeld

@gil_zilberfeld

Goal“A goal is a desired result that a person or a system envisions, plans and commits to achieve.”

@gil_zilberfeld@gil_zilberfeld

What are the goals of the stakeholders of Airbnb?

@gil_zilberfeld

@gil_zilberfeld

Capability“An ability to perform or achieve certain actions or outcomes through a set of controllable and measurable faculties, features, functions, processes, or services.”

@gil_zilberfeld

Exercise: Stakeholders goals and capabilities

◉ What is important to our stakeholders?

◉ What do they want to achieve?

◉ What options do we have to meet the goals?

◉ Prioritize them

@gil_zilberfeld

@gil_zilberfeld

Risk

“The potential of gaining or

losing something of value.”

@gil_zilberfeld@gil_zilberfeld

What are the risks of the stakeholders of Airbnb?

@gil_zilberfeld

Exercise: Stakeholder’s risks

◉ What can go wrong?

◉ What happens when things go wrong?

◉ Think about how risks relate to capabilities

◉ Prioritize them

@gil_zilberfeld@gil_zilberfeld

Why do we need to slice stories?

@gil_zilberfeld

Questions about stories

◉ Are the stories ready for work?

◉ Do they fit in a sprint?

◉ How complex are they?

◉ What will we learn?

◉ What options do we have for implementation?

◉ Do we need to do a POC?

@gil_zilberfeld

The template

As a …

I want a …

In order to …

@gil_zilberfeld

The template

As a killer unicorn

I want to get near a victim

In order to kill it

@gil_zilberfeld@gil_zilberfeld

What is the acceptance criteria?

@gil_zilberfeld@gil_zilberfeld

Give me an example!

@gil_zilberfeld

The template

As a killer unicorn

I need to be at least 12 steps

from a victim

In order to kill it

@gil_zilberfeld

Good user stories

Independent

Negotiable

Valuable

Estimable

Small

Testable

Bill Wake, 2003

@gil_zilberfeld

Good user stories

Independent

Negotiable

Valuable

Estimable

Small

Testable

Bill Wake, 2003

@gil_zilberfeld

Exercise

◉ Write stories for the capabilities and risks

◉ Remember who the stake holder is

@gil_zilberfeld@gil_zilberfeld

Gherkin

Finally some automation

@gil_zilberfeld

The keywords

Given

When

Then

And

@gil_zilberfeld

The scenario

Given the Testicorn is 12 steps

from the victim

When it tries to kill the victim

Then it succeeds

@gil_zilberfeld

The other scenario

Given the Testicorn is 50 steps

from the victim

When it tries to kill the victim

Then it fails

@gil_zilberfeld@gil_zilberfeld

Cucumber example

@gil_zilberfeld

Setting up Eclipse with Cucumber

◉ “Help”->”Add new software” from: Cucumber.io

◉ Create simple maven project

◉ Add the Cucumber dependencies

◉ Add to src/test/java a new .feature file

◉ Run and copy the generated errors to create

functions

@gil_zilberfeld

Setting up VS with SpecFlow

◉ Add the SpecFlow extenstion

◉ Create a unit test project

◉ Get SpecFlow.MsTest from NuGet

◉ Add New Item -> SpecFlow Feature file

◉ Write scenarios

◉ Right click -> Generate Step Definitions

@gil_zilberfeld

Summary

◉ It’s all about the shared understanding

◉ Shared language between users, product

people, developers and testers

◉ Gherkin tests help when there is code that is not

a shared language

◉ Part of the professional tool belt

@gil_zilberfeld

Thanks!

ANY QUESTIONS?

You can find me at:

@gil_zilberfeld

http://www.GilZilberfeld.com

http://www.EverydayUnitTesting.com