bridging the gap between business and technology - behaviour driven development with drupal -...
TRANSCRIPT
![Page 1: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/1.jpg)
Behaviour Driven Development with Drupal
Bridging the gap between business and technology
Marcin Pajdzik
Twitter: @Marcin_PajdzikDublin, May 2015
![Page 2: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/2.jpg)
How BDD works?
Write scenarios that describe behaviours
Execute the scenarios against your application.
▼
![Page 3: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/3.jpg)
How BDD works?
Write each step of your scenarioin plain English.
Write each step definition in PHP.
▼
![Page 4: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/4.jpg)
NHS - National Health Service
Project started in 2002.
Project terminated in 2010
Cost: €14 400 000 000 (billion)
![Page 5: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/5.jpg)
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.
![Page 6: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/6.jpg)
NHS - National Health Service
Result: IT system was not FIT for the NHS
![Page 7: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/7.jpg)
Why projects fail?
3. Unrealistic deadlines.
2. Insufficient resource planning.
1. Poor communication.
Source: Computing Technology Industry Association, 2007
![Page 8: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/8.jpg)
Source: Project Management Institute, 2013
![Page 9: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/9.jpg)
What is software development all about?
Delivering BUSINESS VALUE
How do we find out WHAT REALLY MATTERS to the business?
Through effective communication!
![Page 10: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/10.jpg)
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
![Page 11: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/11.jpg)
The main idea behind BDD
Preventing communication gaps
![Page 12: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/12.jpg)
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
![Page 13: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/13.jpg)
Benefits of BDD
3. Business and behaviour first - prioritisation
1. Collaboration / Communication - same language for all
2. Quality – functional / integration / regression tests
4. Documentation
![Page 14: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/14.jpg)
BDD storiesTitle (one line describing the story) Narrative:As a [role]I want [feature]So that [benefit] Acceptance Criteria: (presented as Scenarios)
Scenario 1: TitleGiven [context]When [event]Then [outcome] Scenario 2: ...
![Page 15: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/15.jpg)
BDD stories
As a userI want to loginSo that I can access my account
As a [X]I want [Y]so that [Z]
![Page 16: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/16.jpg)
Scenarios
Given some initial contextWhen an event occurs,Then ensure some outcomes.
Given I am on the login pageWhen I login as “jsmith” with password “secret”Then I should see my account page
![Page 17: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/17.jpg)
Scenarios
●It’s a specification that everybody understands
●It’s a documentation that everybody can refer to
●It’s an automated test that can be run any time
![Page 18: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/18.jpg)
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
![Page 19: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/19.jpg)
Declarative Scenario vs Imperative Scenario
Given I am on the login pageWhen 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"
![Page 20: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/20.jpg)
Drawbacks
Increases the cost of maintenance
Before doing BDD make sure that there is enough return on investment to justify it.
![Page 21: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/21.jpg)
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
![Page 22: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/22.jpg)
Drupal Extension Drivers
Blackbox Driver
Drupal API Driver
Drush Driver
![Page 23: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/23.jpg)
System Requirements
PHP 5.3.5 or higher with curl, mbstring and xmlJava required for Selenium
![Page 24: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/24.jpg)
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
![Page 25: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/25.jpg)
Installation
default: paths: features: 'features' extensions: Behat\MinkExtension\Extension: goutte: ~ selenium2: ~ base_url: http://seven.l Drupal\DrupalExtension\Extension: blackbox: ~
Make your FeatureContext.php aware of both the Drupal Extension and the Mink Extension
![Page 26: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/26.jpg)
How to make the scenarios available to everybody?
Behat Jira Extension
![Page 27: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/27.jpg)
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}
![Page 28: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/28.jpg)
Behat Jira Extension
bin/behat jira:BDD-1
bin/behat http://jira.example.com:8080/browse/BDD-1
![Page 29: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/29.jpg)
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
![Page 30: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/30.jpg)
References
Dan North & Associates - http://dannorth.net/
Mink - http://mink.behat.org/
Behat - http://behat.org/
DSpeak - http://dspeak.com/drupalextension/intro.html
![Page 31: Bridging the gap between business and technology - Behaviour Driven Development with Drupal - Dublin, Ireland, May 2015](https://reader031.vdocument.in/reader031/viewer/2022021919/587065d91a28ab48378b4f67/html5/thumbnails/31.jpg)
Marcin Pajdzik
LinkedIn: uk.linkedin.com/in/marcinpajdzik/
Twitter: @Marcin_Pajdzik
Owner / Consultant @ Codewriters Ltd
Thank You