DevsMeetUp Freiburg: Behavior Driven Development with Behat/Mink
-
Upload
steffen-mueller -
Category
Technology
-
view
1.367 -
download
1
description
Transcript of DevsMeetUp Freiburg: Behavior Driven Development with Behat/Mink
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 <[email protected]>