devsmeetup freiburg: behavior driven development with behat/mink

Post on 08-May-2015

1.370 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Slides of my Introduction to Behavior Driven Development with Behat/Mink at DevsMeetUp Freiburg 06/2013

TRANSCRIPT

BDD - Behavior Driven Development

with Behat/Mink

Developers MeetUp Freiburg 06/2013

Developers MeetUp Freiburg

Developers MeetUp Freiburg

Steffen Müller

/gebrüderheitz GmbHPHP Software Architect + Developer

@t3node // www.t3node.com

Developers MeetUp Freiburg

Case Study

Developers MeetUp Freiburg

“Simple” order form

Developers MeetUp Freiburg

Related functional tests (Selenium)

Developers MeetUp Freiburg

How the complexity felt like

Image by Kyle Lease CC BY-SA 2.0 http://www.flickr.com/photos/kl75214/

Developers MeetUp Freiburg

Focus on requirements

instead of high coverage

Developers MeetUp Freiburg

Behavior Driven

Development

Developers MeetUp Freiburg

Behavior What?

Developers MeetUp Freiburg

Analyze

Concept

Test

Coding

Linear progress

Sketch inspired by J. B. Rainsberger:http://www.jbrains.ca/permalink/how-test-driven-development-works-and-more

Developers MeetUp Freiburg

Analyze Concept

Test Coding

Continuous Iteration

Shortcycles

Sketch inspired by J. B. Rainsberger:http://www.jbrains.ca/permalink/how-test-driven-development-works-and-more

Developers MeetUp Freiburg

BDD

Building the

right things

TDD

Building the

things right

TDD or BDD?

Developers MeetUp Freiburg

Communication

Images by Alberto Sanchis (MisteryCat)http://misterycat.deviantart.com/

Stakeholder

Developer

Developers MeetUp Freiburg

Ubiquitous Language

User

Customer

Unregistereduser

New customer

Images by Alberto Sanchis (MisteryCat)http://misterycat.deviantart.com/

Developers MeetUp Freiburg

Feature Description

Developers MeetUp Freiburg

“As a [role]

I want [feature]

so that [benefit]”

Feature Description

Developers MeetUp Freiburg

“As a [role]

I want [feature]

so that [benefit]”User Story

Feature Description

Developers MeetUp Freiburg

“As a customer

I need a shopping cart

to check my selected products”

Example Feature Description

Developers MeetUp Freiburg

Scenarios / Use cases

Developers MeetUp Freiburg

Scenario: [Use Case]

Given... [Context]

When... [Event]

Then... [Result]

Scenario

Developers MeetUp Freiburg

Scenario: See selected products in the

shopping cart

Given I visit the FooBar shop

And I add a “dishwasher” to my cart

When I go to the shopping cart

Then I should see a “dishwasher”

Example Scenario

Developers MeetUp Freiburg

Scenario: Find a product in the shopping basket

Given I visit the FooBar shop

And I select a “dishwasher”

When I go to the shopping basket

Then I should see a “dishwasher”gherkinExample Scenario

gherkin

Clearly structured language

Easy to understand

Easy to rephrase

Straightforward syntax

Executable steps

Developers MeetUp Freiburg

Developers MeetUp Freiburg

BehatA php framework for testingbusiness expectations

Developers MeetUp Freiburg

MinkAcceptance test frameworkfor web applications, written in PHP

BehatA php framework for testingbusiness expectations

Developers MeetUp Freiburg

Live Demo

Resources

BDD Introduction:http://dannorth.net/introducing-bdd/

Behat/Mink:http://behat.org/

bInit: kickstarter package for Behat:https://github.com/t3node/binit

Wynne + Hellesøy (2012):“The Cucumber Book”

Developers MeetUp Freiburg

Developers MeetUp Freiburg

Thank You!

If you need BDD + Behat/Mink support, send me a mail:

Steffen Müller <bdd@t3node.com>

top related