SlideShare a Scribd company logo
Behaviour Driven Development
with Drupal
Bridging the gap between business and technology
Marcin Pajdzik
Twitter: @Marcin_Pajdzik
Dublin, May 2015
How BDD works?
Write scenarios that describe behaviours
Execute the scenarios against your application.
โ–ผ
How BDD works?
Write each step of your scenario
in plain English.
Write each step definition in PHP.
โ–ผ
NHS - National Health Service
Project started in 2002.
Project terminated in 2010
Cost: โ‚ฌ14 400 000 000
(billion)
NHS - National Health Service
โ‚ฌ14.4bn would pay a salary of:
60000 nurses for 10 years in the UK
240000 nurses for 10 years in Poland.
NHS - National Health Service
Result: IT system was not FIT for the NHS
Why projects fail?
3. Unrealistic deadlines.
2. Insufficient resource planning.
1. Poor communication.
Source: Computing Technology Industry Association, 2007
Source: Project Management Institute, 2013
What is software development all about?
Delivering BUSINESS VALUE
How do we find out WHAT REALLY MATTERS to
the business?
Through effective communication!
What is the problem with communication?
Two people =
misunderstandings
Technical and Business = different language
Typical large project = large team, working in
a fast-evolving digital domain that no one fully
understands
The main idea behind BDD
Preventing communication gaps
What is BDD?
โ— Agile methodology based on Test Driven Development
โ— promotes communication, conversation and close collaboration
between everybody in the team
โ— focuses on writing specification of the system behaviour
Benefits of BDD
3. Business and behaviour first - prioritisation
1. Collaboration / Communication - same language for all
2. Quality โ€“ functional / integration / regression tests
4. Documentation
BDD stories
Title (one line describing the story)
Narrative:
As a [role]
I want [feature]
So that [benefit]
Acceptance Criteria: (presented as Scenarios)
Scenario 1: Title
Given [context]
When [event]
Then [outcome]
Scenario 2: ...
BDD stories
As a user
I want to login
So that I can access my account
As a [X]
I want [Y]
so that [Z]
Scenarios
Given some initial context
When an event occurs,
Then ensure some outcomes.
Given I am on the login page
When I login as โ€œjsmithโ€ with password โ€œsecretโ€
Then I should see my account page
Scenarios
โ—Itโ€™s a speci๏ฌcation that everybody understands
โ—Itโ€™s a documentation that everybody can refer to
โ—Itโ€™s an automated test that can be run any time
BDD solves TDD shortcomings
Developers want to know:
โ— where to start
โ— what to test and what not to test
โ— how much to test in one go
โ— what to call their tests
โ— how to understand why a test fails
Declarative Scenario vs Imperative Scenario
Given I am on the login page
When I login as โ€œjohnโ€ with password โ€œsecretโ€
Then I should see my account page
When I go to "user/login"
And I enter "john" into the field "username"
And I enter "secret" into the field "password"
And I click on the button "login"
Drawbacks
Increases the cost of maintenance
Before doing BDD make sure that there is
enough return on investment to justify it.
BDD with Drupal
Behat - allows you to write tests in a human-readable language
called Gherkin and parses it into executable test-cases
Mink - web acceptance tests, provides MinkContext with step
definitions for interactions with a browser
Drupal Extension - provides Drupal specific functionality
Drupal Extension Drivers
Blackbox Driver
Drupal API Driver
Drush Driver
System Requirements
PHP 5.3.5 or higher with curl, mbstring and xml
Java required for Selenium
Installation
{
"require": {
"behat/behat": "2.4.*@stable"
},
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}
$ curl http://getcomposer.org/installer | php
$ php composer.phar install
$ bin/behat
$ mkdir ls_project
$ cd ls_project
$ behat --init
Installation
default:
paths:
features: 'features'
extensions:
BehatMinkExtensionExtension:
goutte: ~
selenium2: ~
base_url: http://seven.l
DrupalDrupalExtensionExtension:
blackbox: ~
Make your
FeatureContext.php
aware of both the
Drupal Extension and
the Mink Extension
How to make the scenarios available
to everybody?
Behat Jira Extension
Behat Jira Extension
{code:none}Feature: Jira integration
In order to facilitate the authoring of Behat features by non-developers
As a developer
I want to write an extension to load features from Jira issues.
Scenario: Load Me!
Given I am a Jira issue
And I contain a Behat feature
When I am loaded by JiraExtension
Then I should parsed by Gherkin
{code}
Behat Jira Extension
bin/behat jira:BDD-1
bin/behat http://jira.example.com:8080/browse/BDD-1
BDD in business
โ€œAfter the decision to move our websites onto
Drupal, adopting Behavior Driven Development
has been one of the best decisions weโ€™ve made
for our organization in years.โ€
Paul Lomax - CTO, Dennis Publishing
References
Dan North & Associates - http://dannorth.net/
Mink - http://mink.behat.org/
Behat - http://behat.org/
DSpeak - http://dspeak.com/drupalextension/intro.html
Marcin Pajdzik
LinkedIn: uk.linkedin.com/in/marcinpajdzik/
Twitter: @Marcin_Pajdzik
Owner / Consultant @ Codewriters Ltd
Thank You
Ad

More Related Content

What's hot (6)

Php melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddyPhp melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddy
Douglas Reith
ย 
Web Design & Development - Session 7
Web Design & Development - Session 7Web Design & Development - Session 7
Web Design & Development - Session 7
Shahrzad Peyman
ย 
Detangling Your JavaScript
Detangling Your JavaScriptDetangling Your JavaScript
Detangling Your JavaScript
Chris Powers
ย 
Myths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentMyths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven Development
Pankaj Nakhat
ย 
Bdd agile requirements
Bdd agile requirementsBdd agile requirements
Bdd agile requirements
Agile Vietnam
ย 
What's DSL and what isn't
What's DSL and what isn'tWhat's DSL and what isn't
What's DSL and what isn't
Leandro Parazito
ย 
Php melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddyPhp melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddy
Douglas Reith
ย 
Web Design & Development - Session 7
Web Design & Development - Session 7Web Design & Development - Session 7
Web Design & Development - Session 7
Shahrzad Peyman
ย 
Detangling Your JavaScript
Detangling Your JavaScriptDetangling Your JavaScript
Detangling Your JavaScript
Chris Powers
ย 
Myths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentMyths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven Development
Pankaj Nakhat
ย 
Bdd agile requirements
Bdd agile requirementsBdd agile requirements
Bdd agile requirements
Agile Vietnam
ย 
What's DSL and what isn't
What's DSL and what isn'tWhat's DSL and what isn't
What's DSL and what isn't
Leandro Parazito
ย 

Similar to Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015 (20)

Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
willmation
ย 
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
Nicolรฒ Pignatelli
ย 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
Ivo Jansch
ย 
So What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With TestingSo What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With Testing
sjmarsh
ย 
DC
DCDC
DC
Dipti Choudhari
ย 
Topic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionTopic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolution
Hoa Le
ย 
Moving away from legacy code with BDD
Moving away from legacy code with BDDMoving away from legacy code with BDD
Moving away from legacy code with BDD
Konstantin Kudryashov
ย 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
Positive Hack Days
ย 
ChetanResume
ChetanResumeChetanResume
ChetanResume
chetan sharma
ย 
Strategies for Context Data Persistence
Strategies for Context Data PersistenceStrategies for Context Data Persistence
Strategies for Context Data Persistence
FIWARE
ย 
Open event presentation.3 2
Open event presentation.3 2Open event presentation.3 2
Open event presentation.3 2
Jorge Lรณpez-Lago
ย 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.
Vlad Fedosov
ย 
CV_AmalMandal
CV_AmalMandalCV_AmalMandal
CV_AmalMandal
Amal Mandal - Looking for a Change
ย 
My cv bangla
My cv banglaMy cv bangla
My cv bangla
rajibhossain65
ย 
Noman Khan Internship Report 2.pptx
Noman Khan Internship Report 2.pptxNoman Khan Internship Report 2.pptx
Noman Khan Internship Report 2.pptx
NomanKhan869872
ย 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
Nalin Goonawardana
ย 
Yatin kalaria
Yatin kalariaYatin kalaria
Yatin kalaria
Yatin Kalaria
ย 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
Claudio Beatrice
ย 
IT for HR professionals
IT for HR professionalsIT for HR professionals
IT for HR professionals
Miguel Pinto
ย 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWest
Joshua Warren
ย 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
willmation
ย 
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
Nicolรฒ Pignatelli
ย 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
Ivo Jansch
ย 
So What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With TestingSo What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With Testing
sjmarsh
ย 
Topic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionTopic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolution
Hoa Le
ย 
Moving away from legacy code with BDD
Moving away from legacy code with BDDMoving away from legacy code with BDD
Moving away from legacy code with BDD
Konstantin Kudryashov
ย 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
Positive Hack Days
ย 
ChetanResume
ChetanResumeChetanResume
ChetanResume
chetan sharma
ย 
Strategies for Context Data Persistence
Strategies for Context Data PersistenceStrategies for Context Data Persistence
Strategies for Context Data Persistence
FIWARE
ย 
Open event presentation.3 2
Open event presentation.3 2Open event presentation.3 2
Open event presentation.3 2
Jorge Lรณpez-Lago
ย 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.
Vlad Fedosov
ย 
Noman Khan Internship Report 2.pptx
Noman Khan Internship Report 2.pptxNoman Khan Internship Report 2.pptx
Noman Khan Internship Report 2.pptx
NomanKhan869872
ย 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
Nalin Goonawardana
ย 
Yatin kalaria
Yatin kalariaYatin kalaria
Yatin kalaria
Yatin Kalaria
ย 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
Claudio Beatrice
ย 
IT for HR professionals
IT for HR professionalsIT for HR professionals
IT for HR professionals
Miguel Pinto
ย 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWest
Joshua Warren
ย 
Ad

Recently uploaded (20)

How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
ย 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
ย 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
ย 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
ย 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
ย 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
ย 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
ย 
HCL Nomad Web โ€“ Best Practices and Managing Multiuser Environments
HCL Nomad Web โ€“ Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web โ€“ Best Practices and Managing Multiuser Environments
HCL Nomad Web โ€“ Best Practices and Managing Multiuser Environments
panagenda
ย 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
ย 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
ย 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
ย 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
ย 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
ย 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
ย 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
ย 
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy ConsumptionDrupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Exove
ย 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
ย 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
ย 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
ย 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
ย 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
ย 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
ย 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
ย 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
ย 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
ย 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
ย 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
ย 
HCL Nomad Web โ€“ Best Practices and Managing Multiuser Environments
HCL Nomad Web โ€“ Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web โ€“ Best Practices and Managing Multiuser Environments
HCL Nomad Web โ€“ Best Practices and Managing Multiuser Environments
panagenda
ย 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
ย 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
ย 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
ย 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
ย 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
ย 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
ย 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
ย 
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy ConsumptionDrupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Exove
ย 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
ย 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
ย 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
ย 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
ย 
Ad

Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015

  • 1. Behaviour Driven Development with Drupal Bridging the gap between business and technology Marcin Pajdzik Twitter: @Marcin_Pajdzik Dublin, May 2015
  • 2. How BDD works? Write scenarios that describe behaviours Execute the scenarios against your application. โ–ผ
  • 3. How BDD works? Write each step of your scenario in plain English. Write each step definition in PHP. โ–ผ
  • 4. NHS - National Health Service Project started in 2002. Project terminated in 2010 Cost: โ‚ฌ14 400 000 000 (billion)
  • 5. NHS - National Health Service โ‚ฌ14.4bn would pay a salary of: 60000 nurses for 10 years in the UK 240000 nurses for 10 years in Poland.
  • 6. NHS - National Health Service Result: IT system was not FIT for the NHS
  • 7. Why projects fail? 3. Unrealistic deadlines. 2. Insufficient resource planning. 1. Poor communication. Source: Computing Technology Industry Association, 2007
  • 8. Source: Project Management Institute, 2013
  • 9. What is software development all about? Delivering BUSINESS VALUE How do we find out WHAT REALLY MATTERS to the business? Through effective communication!
  • 10. What is the problem with communication? Two people = misunderstandings Technical and Business = different language Typical large project = large team, working in a fast-evolving digital domain that no one fully understands
  • 11. The main idea behind BDD Preventing communication gaps
  • 12. What is BDD? โ— Agile methodology based on Test Driven Development โ— promotes communication, conversation and close collaboration between everybody in the team โ— focuses on writing specification of the system behaviour
  • 13. Benefits of BDD 3. Business and behaviour first - prioritisation 1. Collaboration / Communication - same language for all 2. Quality โ€“ functional / integration / regression tests 4. Documentation
  • 14. BDD stories Title (one line describing the story) Narrative: As a [role] I want [feature] So that [benefit] Acceptance Criteria: (presented as Scenarios) Scenario 1: Title Given [context] When [event] Then [outcome] Scenario 2: ...
  • 15. BDD stories As a user I want to login So that I can access my account As a [X] I want [Y] so that [Z]
  • 16. Scenarios Given some initial context When an event occurs, Then ensure some outcomes. Given I am on the login page When I login as โ€œjsmithโ€ with password โ€œsecretโ€ Then I should see my account page
  • 17. Scenarios โ—Itโ€™s a speci๏ฌcation that everybody understands โ—Itโ€™s a documentation that everybody can refer to โ—Itโ€™s an automated test that can be run any time
  • 18. BDD solves TDD shortcomings Developers want to know: โ— where to start โ— what to test and what not to test โ— how much to test in one go โ— what to call their tests โ— how to understand why a test fails
  • 19. Declarative Scenario vs Imperative Scenario Given I am on the login page When I login as โ€œjohnโ€ with password โ€œsecretโ€ Then I should see my account page When I go to "user/login" And I enter "john" into the field "username" And I enter "secret" into the field "password" And I click on the button "login"
  • 20. Drawbacks Increases the cost of maintenance Before doing BDD make sure that there is enough return on investment to justify it.
  • 21. BDD with Drupal Behat - allows you to write tests in a human-readable language called Gherkin and parses it into executable test-cases Mink - web acceptance tests, provides MinkContext with step definitions for interactions with a browser Drupal Extension - provides Drupal specific functionality
  • 22. Drupal Extension Drivers Blackbox Driver Drupal API Driver Drush Driver
  • 23. System Requirements PHP 5.3.5 or higher with curl, mbstring and xml Java required for Selenium
  • 24. Installation { "require": { "behat/behat": "2.4.*@stable" }, "minimum-stability": "dev", "config": { "bin-dir": "bin/" } } $ curl http://getcomposer.org/installer | php $ php composer.phar install $ bin/behat $ mkdir ls_project $ cd ls_project $ behat --init
  • 25. Installation default: paths: features: 'features' extensions: BehatMinkExtensionExtension: goutte: ~ selenium2: ~ base_url: http://seven.l DrupalDrupalExtensionExtension: blackbox: ~ Make your FeatureContext.php aware of both the Drupal Extension and the Mink Extension
  • 26. How to make the scenarios available to everybody? Behat Jira Extension
  • 27. Behat Jira Extension {code:none}Feature: Jira integration In order to facilitate the authoring of Behat features by non-developers As a developer I want to write an extension to load features from Jira issues. Scenario: Load Me! Given I am a Jira issue And I contain a Behat feature When I am loaded by JiraExtension Then I should parsed by Gherkin {code}
  • 28. Behat Jira Extension bin/behat jira:BDD-1 bin/behat http://jira.example.com:8080/browse/BDD-1
  • 29. BDD in business โ€œAfter the decision to move our websites onto Drupal, adopting Behavior Driven Development has been one of the best decisions weโ€™ve made for our organization in years.โ€ Paul Lomax - CTO, Dennis Publishing
  • 30. References Dan North & Associates - http://dannorth.net/ Mink - http://mink.behat.org/ Behat - http://behat.org/ DSpeak - http://dspeak.com/drupalextension/intro.html
  • 31. Marcin Pajdzik LinkedIn: uk.linkedin.com/in/marcinpajdzik/ Twitter: @Marcin_Pajdzik Owner / Consultant @ Codewriters Ltd Thank You