SlideShare a Scribd company logo
Enabling Agile
Through enabling BDD in PHP projects
Who?
BDD Evangelist
!
Creator of Behat, Mink, PhpSpec2,
Prophecy
!
Contributor to Symfony2, Composer
!
Host of the “Elephant in the Room”
podcast
Enabling agile devliery through enabling BDD in PHP projects
Enabling agile devliery through enabling BDD in PHP projects
BDD
– me, this month
BDD is a tool to bring structure
into the agile processes
Agile process
Out-of-the box
Agile process
Out-of-the box
BDD
In the Agile process
BDD is the
agile enabler
How does it
enable Agile?
Requirements
Analysis
Design
Development
Testing
9 months 3 m 2 m 12 m ...
[Royce 1970]
Most of the cost in
software development is
in the feedback delay
Lets reduce
feedback delay
Requirements
Acceptance
Testing
Coding
Refactoring
Weeks Minutes
[Beck & Cunningham 1996-99]
Requirements
Acceptance
Testing
?
Coding
Refactoring
[North 2003]
Weeks Minutes
Lets clarify
design intentions
Requirements
Acceptance
Specification
Implementation
Refactoring
[North 2003]
Weeks Minutes
Lets clarify
planning intentions
Adding value
What do you
mean?
Specification
Implementation
Refactoring
[North 2003]
Weeks Minutes
Adding value
What do you
mean?
Specification
Implementation
Refactoring
[North 2003]
Adding value
What do you
mean?
Specification
Implementation
Refactoring
[North 2003]
StoryBDD
SpecBDD
[North 2003]
Adding value
What do you
mean?
Specification
Implementation
Refactoring
Behat
PhpSpec
[North 2003]
Adding value
What do you
mean?
Specification
Implementation
Refactoring
StoryBDD
StoryBDD looks like a functional
TDD to the people from the outside
of the BDD community, but
it’s a simple confusion.
We are not testing that application
functions as we (developers) expect
it to, but instead we’re testing that
it fulfils our client business needs.
Some applications could easily fulfil
developers expectations and still not being
able to cover business needs.
You might think about StoryBDD as a
technique to teach your clients about
testing. In reality it's a tool to teach
you about your client business.
Enabling agile devliery through enabling BDD in PHP projects
User-story
• Narrative
• Business rules
• Communication
• Acceptance criteria
User-story
• Narrative
• Business rules == AC
• Communication
User-story
• Narrative
• Business rules == AC
• Comm == Examples
User-story
• Narrative
• Business rules
• Comm == Examples == AC
StoryBDD splits every
feature in your project
into the 3 separate layers.
Each new layer adds
more information to the
table.
1
2
3
narrative
possible scenarios
scenario details
1
2
3
possible scenarios
scenario details
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
I need to be able to authenticate
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
I need to be able to authenticate
1
2
3scenario details
Scenario: Successfully authenticating
with correct credentials
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
I need to be able to authenticate
1
2
3
Scenario: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
I need to be able to authenticate
1
2
3
Example: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
Structure
In the Agile process
StoryBDD forces you to
answer questions you did
not know you need to ask.
1. Why?
aka: how to prioritise
my backlog
Feature: Authorisation
Why might your users
want this feature?
Feature: Authorisation
In order to get access to the shopping history
Feature: Authorisation
In order to get access to the shopping history
Who is mostly
interested in this
feature?
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
How can you help
him get this value?
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
I need to be able to authenticate
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
I need to be able to authenticate
benefit
beneficiar
Feature: Authorisation
In order to get access to the shopping history
As a frequent buyer
I need to be able to authenticate
Feature: …
In order to …
As a …
I need to …
Feature: …
In order to …
As a …
I need to …
Feature: …
In order to …
As a …
I need to …
benefit
beneficiar
SELECT f.* as sprint
FROM ‘/features’ as f
ORDER BY f.role, f.benefit
LIMIT 10
PSEUDOAgileQL
2. What do you
mean?
aka: defining done through examples
How much “done” is
“done”?
How much of the
feature should be
delivered?
Scenario: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
Scenario: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
Given defines initial context
Scenario: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
When defines a user action (or state transition)
Scenario: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
Then defines an expected outcome
Scenario: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
And, But add more context, actions or outcomes
Scenario: Successfully authenticating
with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
!
3. When are we
done?
aka: closing feedback loop
Enabling agile devliery through enabling BDD in PHP projects
assertEquals(Your Feature, Your App)
Setup
• Dump your sprint features into text files
• Put those text files into the `features/` folder inside
project
• Install behat (via composer or behat.phar)
• Initialize behat test suite by running `bin/behat —init`
Context
<?php
!
use BehatBehatContextClosuredContextInterface,
BehatBehatContextTranslatedContextInterface,
BehatBehatContextBehatContext,
BehatBehatExceptionPendingException;
use BehatGherkinNodePyStringNode,
BehatGherkinNodeTableNode;
!
class FeatureContext extends BehatContext
{
}
First run
$> bin/behat
...
You can implement step definitions for undefined steps with these snippets:
!
/**
* @Then I should see :arg1
*/
public function iShouldSee($arg1)
{
throw new PendingException();
}
...
Append snippets
$> bin/behat --append-snippets
Feedback loop
$> bin/behat
!
Feature: registration
in order to maintain my shopping history
as a site visitor
i need to be able to register on this site
!
Scenario: Successful registration when visitor provides all the required info
Given I am on the homepage
TODO: write pending definition
When I follow “sign up”
And I fill in registration form
And I submit it
Then I should be successfully registered
And I should be on the homepage again
Stories
Examples
Describe
Implement
Design
Stories
Examples
Describe
Implement
Design
Colour it red.
Making it fail
/**
* @Given /^I am on the homepage$/
*/
public function iAmOnTheHomepage()
{
$crawler = new SomeCrawlerLibCrawler();
$crawler->goto(“http://localhost:8080/”);
if (200 !== $crawler->getCurrentStatusCode())
{
throw new RuntimeException(‘Can not open homepage’);
}
}
Making it fail
$> bin/behat
!
Feature: registration
in order to maintain my shopping history
as a site visitor
i need to be able to register on this site
!
Scenario: Successful registration when visitor provides all the required info
Given I am on the homepage
Can not open homepage (RuntimeException)
When I follow “sign up”
And I fill in registration form
And I submit it
Then I should be successfully registered
And I should be on the homepage again
Stories
Examples
Describe
Implement
Design
Change the message
As quickly as you can
Change the message
$> bin/behat
!
Feature: registration
in order to maintain my shopping history
as a site visitor
i need to be able to register on this site
!
Scenario: Successful registration when visitor provides all the required info
Given I am on the homepage
Can not open homepage (RuntimeException)
When I follow “sign up”
And I fill in registration form
And I submit it
Then I should be successfully registered
And I should be on the homepage again
Change the message
$> bin/behat
!
Feature: registration
in order to maintain my shopping history
as a site visitor
i need to be able to register on this site
!
Scenario: Successful registration when visitor provides all the required info
Given I am on the homepage
Route … not found (FrameworkException)
When I follow “sign up”
And I fill in registration form
And I submit it
Then I should be successfully registered
And I should be on the homepage again
Change the message
$> bin/behat
!
Feature: registration
in order to maintain my shopping history
as a site visitor
i need to be able to register on this site
!
Scenario: Successful registration when visitor provides all the required info
Given I am on the homepage
Template … not found (FrameworkException)
When I follow “sign up”
And I fill in registration form
And I submit it
Then I should be successfully registered
And I should be on the homepage again
Change the message
$> bin/behat
!
Feature: registration
in order to maintain my shopping history
as a site visitor
i need to be able to register on this site
!
Scenario: Successful registration when visitor provides all the required info
Given I am on the homepage
When I follow “sign up”
TODO: write pending definition
And I fill in registration form
And I submit it
Then I should be successfully registered
And I should be on the homepage again
Read more at
behat.org
Stories
Examples
Describe
Implement
Design
Spec-BDD
Stories
Examples
Describe
Implement
Design
Spec-BDD
Stories
Examples
Describe
Implement
Design
Spec-BDD
Stories
Examples
Describe
Implement
Design
Read more at
phpspec.net
That’s all nice
theoretical stuff
Enabling agile devliery through enabling BDD in PHP projects
http://inviqa.com/careers
Thank you!

More Related Content

PDF
Moving away from legacy code with BDD
PPT
WordCamp Detroit 2010 Wordpress Theme Hacks
PDF
Testing web APIs
PPTX
5 Reasons To Love CodeIgniter
PDF
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)
PDF
Data Validation models
PDF
2013-06-25 - HTML5 & JavaScript Security
PPT
JavaScript Needn't Hurt!
Moving away from legacy code with BDD
WordCamp Detroit 2010 Wordpress Theme Hacks
Testing web APIs
5 Reasons To Love CodeIgniter
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)
Data Validation models
2013-06-25 - HTML5 & JavaScript Security
JavaScript Needn't Hurt!

What's hot (18)

PPT
Php Tutorial | Introduction Demo | Basics
PPTX
Behat - Drupal South 2018
PPTX
Quality code by design
PPTX
I Love codeigniter, You?
PDF
Crafting Quality PHP Applications (PHPkonf 2018)
PDF
Phone calls and sms from php
PPT
Eugene Andruszczenko: jQuery
PDF
Disregard Inputs, Acquire Zend_Form
PPTX
Testing ASP.net Web Applications using Ruby
PDF
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS» QADay 2019
PDF
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
PPTX
jQuery from the very beginning
PDF
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
PDF
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
PDF
Curso Symfony - Clase 4
KEY
IoC with PHP
PDF
Php Tutorial | Introduction Demo | Basics
Behat - Drupal South 2018
Quality code by design
I Love codeigniter, You?
Crafting Quality PHP Applications (PHPkonf 2018)
Phone calls and sms from php
Eugene Andruszczenko: jQuery
Disregard Inputs, Acquire Zend_Form
Testing ASP.net Web Applications using Ruby
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS» QADay 2019
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
jQuery from the very beginning
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
Curso Symfony - Clase 4
IoC with PHP
Ad

Viewers also liked (12)

PDF
Modern Project Toolbox
PDF
Being effective with legacy projects
PDF
Min-Maxing Software Costs
PDF
Moving away from legacy code with BDD
PDF
BDD в PHP с Behat и Mink
PDF
BDD для PHP проектов
PDF
Modern Agile Project Toolbox
PDF
Decoupling with Design Patterns and Symfony2 DIC
PDF
Bridging The Communication Gap, Fast
PDF
Moving away from legacy code (AgileCymru)
PDF
Taking back BDD
PDF
Design how your objects talk through mocking
Modern Project Toolbox
Being effective with legacy projects
Min-Maxing Software Costs
Moving away from legacy code with BDD
BDD в PHP с Behat и Mink
BDD для PHP проектов
Modern Agile Project Toolbox
Decoupling with Design Patterns and Symfony2 DIC
Bridging The Communication Gap, Fast
Moving away from legacy code (AgileCymru)
Taking back BDD
Design how your objects talk through mocking
Ad

Similar to Enabling agile devliery through enabling BDD in PHP projects (20)

PDF
Behat for writing tests in a stylized way
PPTX
Introduce cucumber
PDF
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
PDF
I put on my mink and wizard behat - Confoo Canada
PDF
I put on my mink and wizard behat (talk)
PDF
Transformando os pepinos do cliente no código de testes da sua aplicação
PDF
I put on my mink and wizard behat
PDF
How to improve our acceptance tests - Pyccuracy VS Splinter
PDF
Behavior Driven Development with Cucumber
PDF
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
PDF
Quick ref capybara
PDF
Quick ref capybara
PDF
Controller Testing: You're Doing It Wrong
PDF
Writing Software not Code with Cucumber
PDF
Software Testing
PDF
BDD - Collaborate like you mean it!
PDF
BDD - Writing better scenario
PDF
Passwords suck, but centralized proprietary services are not the answer
PDF
Behavioral Driven Development
Behat for writing tests in a stylized way
Introduce cucumber
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
I put on my mink and wizard behat - Confoo Canada
I put on my mink and wizard behat (talk)
Transformando os pepinos do cliente no código de testes da sua aplicação
I put on my mink and wizard behat
How to improve our acceptance tests - Pyccuracy VS Splinter
Behavior Driven Development with Cucumber
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Quick ref capybara
Quick ref capybara
Controller Testing: You're Doing It Wrong
Writing Software not Code with Cucumber
Software Testing
BDD - Collaborate like you mean it!
BDD - Writing better scenario
Passwords suck, but centralized proprietary services are not the answer
Behavioral Driven Development

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Modernizing your data center with Dell and AMD
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Modernizing your data center with Dell and AMD
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
A Presentation on Artificial Intelligence
Chapter 3 Spatial Domain Image Processing.pdf
Empathic Computing: Creating Shared Understanding
NewMind AI Monthly Chronicles - July 2025
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
cuic standard and advanced reporting.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Enabling agile devliery through enabling BDD in PHP projects