SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
BEHAVIOUR DRIVEN
DEVELOPMENT
ALEXANDRU BADIU
BEHAVIOUR DRIVEN DEVELOPMENT
ALEXANDRU BADIU
Drupal developer for 10 years.	

Drupal Romania founding member.	

I work at Demotix / Corbis.	


!
http://alexandrubadiu.ro	

http://twitter.com/voidberg

Drupalcamp Tirgu Mures 2013
BDD IS A SECOND-GENERATION,
OUTSIDE–IN, PULL-BASED,
MULTIPLE- STAKEHOLDER,
MULTIPLE-SCALE, 	

HIGH- AUTOMATION, 	

AGILE METHODOLOGY.
BEHAVIOUR DRIVEN DEVELOPMENT
WAIT, WHAT?
BEHAVIOUR DRIVEN DEVELOPMENT
TDD’S SHORTCOMINGS

• Unit tests, Inside - out.	

• Write the unit test before the code.	

• Typically written by the programmer.	

• Can’t test everything: full functional tests?	

• Can’t refactor as you wish: dependent on early tests.

Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BDD FEATURES

• It picks up where TDD leaves off.	

• Rethinking the approach to unit and acceptance testing.	

• Uses a common language that everyone can use from
all chains of command.	

• Becomes a test, a piece of documentation, a
specification.	

• Supported by a wide range of tools: Gherkin, Cucumber,
Behat, Travis, Jenkins, Jira and so on.
Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BDD FEATURES

• Test code or describe behaviour?	

• Both.	

• TDD is about ensuring behaviour.	

• BDD is about describing behaviour.

Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BDD FEATURES

• User story.	

• Stakeholder, effect, value.	

• Acceptance criteria or scenarios.	

• Steps.	

• Initial conditions.	

• Triggers.	

• Outcomes.
Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BDD FEATURES
Feature: Authentication!

!
In order to change my information and add sessions!
As a registered Drupalcamp user!
I need to be able to authenticate!
!
Scenario: User login!
Given I am on "/"!
When I follow "Log in"!
And I fill in "name" with "bddtest"!
And I fill in "pass" with "bddtest"!
And I press "Log in"!
Then I should see "My account" !

!
Scenario: User logout!
Given I am logged in!
And I am on "/"!
When I follow "Log out"!
Then I should see "Log in"

Drupalcamp Tirgu Mures 2013
BDD IS A SECONDGENERATION, OUTSIDE–IN,
PULL-BASED, MULTIPLESTAKEHOLDER, MULTIPLE-SCALE, 	

HIGH- AUTOMATION, 	

AGILE METHODOLOGY.
BEHAVIOUR DRIVEN DEVELOPMENT
BDD IN PHP

• Behat.	

• OSS.	

• Cucumber “language”.	

• Mink for testing web apps.	

• Different drivers: Selenium, zombie.js, goutte etc.

Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
COMPOSER.JSON
{!
"require": {!
"behat/behat": "2.4.*@stable",!
"behat/mink": "1.5.*@stable",!
"behat/mink-extension": "*",!
"behat/mink-goutte-driver": "*",!
"behat/mink-selenium-driver": "*",!
"behat/mink-selenium2-driver": "*",!
"behat/mink-sahi-driver": "*",!
"behat/mink-zombie-driver": "*",!
},!
"minimum-stability": "dev",!
"config": {!
"bin-dir": "bin/"!
}!
}!

Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
INSTALL
curl http://getcomposer.org/installer | php!
php composer.phar install —prefer-source!
!
bin/behat —init!
!
+d features - place your *.feature files here!
+d features/bootstrap - place bootstrap scripts and
static files here!
+f features/bootstrap/FeatureContext.php - place your
feature related code here

Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BEHAT.YML
default:!
extensions:!
BehatMinkExtensionExtension:!
base_url: http://drupalcamp.ro/!
goutte: ~!
zombie: ~!
sahi:!
port: 9999!
selenium2:!
wd_host: "http://127.0.0.1:4444/wd/hub"!
!
default_session: 'selenium2'!
javascript_session: 'selenium2'!

Drupalcamp Tirgu Mures 2013
DEMO
BEHAVIOUR DRIVEN DEVELOPMENT
BDD IN DRUPAL

• Behat Drupal Extension.	

• Provides step definitions for common testing scenarios
specific to Drupal sites.
Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BDD IN DRUPAL
composer.json!

!
!
!
!
!

"require": {!
! "drupal/drupal-extension": "*"!
!
},!

behat.yml!

!
!

DrupalDrupalExtensionExtension:!
blackbox: ~

Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BDD IN DRUPAL
Given I am logged in as a user with the "authenticated
user" role!
!
Then I should see the heading “History"!
!
Then I should see the heading "User login" in the "left
sidebar" region!
!
Given the cache has been cleared!
!
When I run cron!
!

Drupalcamp Tirgu Mures 2013
BEHAVIOUR DRIVEN DEVELOPMENT
BDD IN DRUPAL
Given "page" nodes:!
| title
|!
| Page one |!
| Page two |!
!
And "article" nodes:!
| title
|!
| First article |!
| Second article |!
!
Given "article" nodes:!
| title
| promote
| First article with fields |
1
!
Given users:!
| name
| mail
| status
| Joe User | joe@example.com | 1

| body
|!
| PLACEHOLDER BODY |!

|!
|

Drupalcamp Tirgu Mures 2013
THANK YOU
Alexandru Badiu

ALEXANDRUBADIU.RO
We’re hiring!	

AngularJS, Node.js.	

Come talk to me if you’re interested.

Más contenido relacionado

La actualidad más candente

The JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in AhmedabadThe JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in AhmedabadTOPS Technologies
 
Full-Stack Development
Full-Stack DevelopmentFull-Stack Development
Full-Stack DevelopmentDhilipsiva DS
 
PHP 2014/15 - Visión global del ecosistema PHP
PHP 2014/15 - Visión global del ecosistema PHPPHP 2014/15 - Visión global del ecosistema PHP
PHP 2014/15 - Visión global del ecosistema PHPCarlos Buenosvinos
 
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...Evan Mullins
 
Morden F2E Education - Think of Progressive Web Apps
Morden F2E Education - Think of Progressive Web AppsMorden F2E Education - Think of Progressive Web Apps
Morden F2E Education - Think of Progressive Web AppsCaesar Chi
 
Getting Involved with Joomla - Why and how to contribute
Getting Involved with Joomla - Why and how to contributeGetting Involved with Joomla - Why and how to contribute
Getting Involved with Joomla - Why and how to contributeParth Lawate
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteChristian Heilmann
 
Prototyping UX Solutions with Playgrounds and Lightning Web Components
Prototyping UX Solutions with Playgrounds and Lightning Web ComponentsPrototyping UX Solutions with Playgrounds and Lightning Web Components
Prototyping UX Solutions with Playgrounds and Lightning Web ComponentsYeurDreamin'
 
Getting Started with DrupalGap
Getting Started with DrupalGapGetting Started with DrupalGap
Getting Started with DrupalGapAlex S
 
When to (use / not use) React Native.
When to (use / not use) React Native.When to (use / not use) React Native.
When to (use / not use) React Native.Bobby Schultz
 

La actualidad más candente (13)

Mobileweb
MobilewebMobileweb
Mobileweb
 
The JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in AhmedabadThe JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in Ahmedabad
 
Full-Stack Development
Full-Stack DevelopmentFull-Stack Development
Full-Stack Development
 
PHP 2014/15 - Visión global del ecosistema PHP
PHP 2014/15 - Visión global del ecosistema PHPPHP 2014/15 - Visión global del ecosistema PHP
PHP 2014/15 - Visión global del ecosistema PHP
 
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
 
Morden F2E Education - Think of Progressive Web Apps
Morden F2E Education - Think of Progressive Web AppsMorden F2E Education - Think of Progressive Web Apps
Morden F2E Education - Think of Progressive Web Apps
 
Java training in ahmedabad
Java training in ahmedabadJava training in ahmedabad
Java training in ahmedabad
 
Getting Involved with Joomla - Why and how to contribute
Getting Involved with Joomla - Why and how to contributeGetting Involved with Joomla - Why and how to contribute
Getting Involved with Joomla - Why and how to contribute
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynote
 
Prototyping UX Solutions with Playgrounds and Lightning Web Components
Prototyping UX Solutions with Playgrounds and Lightning Web ComponentsPrototyping UX Solutions with Playgrounds and Lightning Web Components
Prototyping UX Solutions with Playgrounds and Lightning Web Components
 
Kickstart Jpa
Kickstart JpaKickstart Jpa
Kickstart Jpa
 
Getting Started with DrupalGap
Getting Started with DrupalGapGetting Started with DrupalGap
Getting Started with DrupalGap
 
When to (use / not use) React Native.
When to (use / not use) React Native.When to (use / not use) React Native.
When to (use / not use) React Native.
 

Destacado

Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven DevelopmentBen Goldin
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven DevelopmentRichard Ruiter
 
Behaviour-Driven Development
Behaviour-Driven DevelopmentBehaviour-Driven Development
Behaviour-Driven DevelopmentKerry Buckley
 
Principles and patterns for test driven development
Principles and patterns for test driven developmentPrinciples and patterns for test driven development
Principles and patterns for test driven developmentStephen Fuqua
 
Bahaviour Driven Development
Bahaviour Driven DevelopmentBahaviour Driven Development
Bahaviour Driven Developmentbuildmaster
 
Changing Your Mindset: Getting Started With Test-Driven Development
Changing Your Mindset: Getting Started With Test-Driven DevelopmentChanging Your Mindset: Getting Started With Test-Driven Development
Changing Your Mindset: Getting Started With Test-Driven DevelopmentViget Labs
 
Informed & Agile: Test Driven Design w/ Jon Innes
Informed & Agile: Test Driven Design w/ Jon InnesInformed & Agile: Test Driven Design w/ Jon Innes
Informed & Agile: Test Driven Design w/ Jon InnesUserZoom
 
Introduction to Behaviour Driven Development
Introduction to Behaviour Driven DevelopmentIntroduction to Behaviour Driven Development
Introduction to Behaviour Driven DevelopmentChristophe Achouiantz
 
BDD - Keep love alive
BDD - Keep love aliveBDD - Keep love alive
BDD - Keep love aliveRory Preddy
 
Outside In - Behaviour Driven Development (BDD)
Outside In - Behaviour Driven Development (BDD)Outside In - Behaviour Driven Development (BDD)
Outside In - Behaviour Driven Development (BDD)Naresh Jain
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven developmenttoteb5
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)Brian Rasmussen
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)David Ehringer
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testingdversaci
 
Agile Test Driven Development
Agile Test Driven DevelopmentAgile Test Driven Development
Agile Test Driven DevelopmentViraf Karai
 

Destacado (18)

Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
Using Features
Using FeaturesUsing Features
Using Features
 
bdd behaviour driven development
bdd behaviour driven developmentbdd behaviour driven development
bdd behaviour driven development
 
Behaviour-Driven Development
Behaviour-Driven DevelopmentBehaviour-Driven Development
Behaviour-Driven Development
 
Principles and patterns for test driven development
Principles and patterns for test driven developmentPrinciples and patterns for test driven development
Principles and patterns for test driven development
 
TDD, BDD and mocks
TDD, BDD and mocksTDD, BDD and mocks
TDD, BDD and mocks
 
Bahaviour Driven Development
Bahaviour Driven DevelopmentBahaviour Driven Development
Bahaviour Driven Development
 
Changing Your Mindset: Getting Started With Test-Driven Development
Changing Your Mindset: Getting Started With Test-Driven DevelopmentChanging Your Mindset: Getting Started With Test-Driven Development
Changing Your Mindset: Getting Started With Test-Driven Development
 
Informed & Agile: Test Driven Design w/ Jon Innes
Informed & Agile: Test Driven Design w/ Jon InnesInformed & Agile: Test Driven Design w/ Jon Innes
Informed & Agile: Test Driven Design w/ Jon Innes
 
Introduction to Behaviour Driven Development
Introduction to Behaviour Driven DevelopmentIntroduction to Behaviour Driven Development
Introduction to Behaviour Driven Development
 
BDD - Keep love alive
BDD - Keep love aliveBDD - Keep love alive
BDD - Keep love alive
 
Outside In - Behaviour Driven Development (BDD)
Outside In - Behaviour Driven Development (BDD)Outside In - Behaviour Driven Development (BDD)
Outside In - Behaviour Driven Development (BDD)
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
 
Agile Test Driven Development
Agile Test Driven DevelopmentAgile Test Driven Development
Agile Test Driven Development
 

Similar a BDD Behaviour Driven Development in PHP and Drupal

Improving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profilingImproving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profilingSeravo
 
Auf Augenhöhe mit Android Studio und Gradle
Auf Augenhöhe mit Android Studio und GradleAuf Augenhöhe mit Android Studio und Gradle
Auf Augenhöhe mit Android Studio und Gradleinovex GmbH
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Michael Lihs
 
Quality code in wordpress
Quality code in wordpressQuality code in wordpress
Quality code in wordpressRan Bar-Zik
 
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)Hyun-woo Park
 
Moderne Android Builds mit Gradle
Moderne Android Builds mit GradleModerne Android Builds mit Gradle
Moderne Android Builds mit Gradleinovex GmbH
 
UMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, ChicagoUMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, Chicagobrockfanning
 
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo RadulovskiPlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo RadulovskiPlovDev Conference
 
Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...Eugenio Minardi
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpAhmed Abdou
 
Mobile Vue.js – From PWA to Native
Mobile Vue.js – From PWA to NativeMobile Vue.js – From PWA to Native
Mobile Vue.js – From PWA to NativeMartinSotirov
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToRaymond Camden
 
Introduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentIntroduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentÖzcan Zafer AYAN
 
BUILDING WEB APPS WITH ASP.NET MVC AND NOSQL
BUILDING WEB APPS WITH ASP.NET MVC AND NOSQLBUILDING WEB APPS WITH ASP.NET MVC AND NOSQL
BUILDING WEB APPS WITH ASP.NET MVC AND NOSQLMichael Kennedy
 
Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)Eugenio Minardi
 
Samsung Devcon - State of HTML5 - Chris Heilmann
Samsung Devcon - State of HTML5 - Chris HeilmannSamsung Devcon - State of HTML5 - Chris Heilmann
Samsung Devcon - State of HTML5 - Chris HeilmannChristian Heilmann
 
Debugging with Zend Studio for Eclipse
Debugging with Zend Studio for EclipseDebugging with Zend Studio for Eclipse
Debugging with Zend Studio for EclipseOSSCube
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers dssprakash
 

Similar a BDD Behaviour Driven Development in PHP and Drupal (20)

Improving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profilingImproving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profiling
 
Auf Augenhöhe mit Android Studio und Gradle
Auf Augenhöhe mit Android Studio und GradleAuf Augenhöhe mit Android Studio und Gradle
Auf Augenhöhe mit Android Studio und Gradle
 
Android Studio und gradle
Android Studio und gradleAndroid Studio und gradle
Android Studio und gradle
 
Don't screw it up! How to build durable API
Don't screw it up! How to build durable API Don't screw it up! How to build durable API
Don't screw it up! How to build durable API
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
Quality code in wordpress
Quality code in wordpressQuality code in wordpress
Quality code in wordpress
 
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
 
Moderne Android Builds mit Gradle
Moderne Android Builds mit GradleModerne Android Builds mit Gradle
Moderne Android Builds mit Gradle
 
UMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, ChicagoUMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, Chicago
 
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo RadulovskiPlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
 
Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
 
Mobile Vue.js – From PWA to Native
Mobile Vue.js – From PWA to NativeMobile Vue.js – From PWA to Native
Mobile Vue.js – From PWA to Native
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared To
 
Introduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentIntroduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App Development
 
BUILDING WEB APPS WITH ASP.NET MVC AND NOSQL
BUILDING WEB APPS WITH ASP.NET MVC AND NOSQLBUILDING WEB APPS WITH ASP.NET MVC AND NOSQL
BUILDING WEB APPS WITH ASP.NET MVC AND NOSQL
 
Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)
 
Samsung Devcon - State of HTML5 - Chris Heilmann
Samsung Devcon - State of HTML5 - Chris HeilmannSamsung Devcon - State of HTML5 - Chris Heilmann
Samsung Devcon - State of HTML5 - Chris Heilmann
 
Debugging with Zend Studio for Eclipse
Debugging with Zend Studio for EclipseDebugging with Zend Studio for Eclipse
Debugging with Zend Studio for Eclipse
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
 

Más de Alexandru Badiu

Drupal as a first class mobile platform
Drupal as a first class mobile platformDrupal as a first class mobile platform
Drupal as a first class mobile platformAlexandru Badiu
 
Cloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloudCloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloudAlexandru Badiu
 
Cloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloudCloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloudAlexandru Badiu
 
Learning the basics of the Drupal API
Learning the basics of the Drupal APILearning the basics of the Drupal API
Learning the basics of the Drupal APIAlexandru Badiu
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?Alexandru Badiu
 
Drupal, Android and iPhone
Drupal, Android and iPhoneDrupal, Android and iPhone
Drupal, Android and iPhoneAlexandru Badiu
 
Concepte de programare functionala in Javascript
Concepte de programare functionala in JavascriptConcepte de programare functionala in Javascript
Concepte de programare functionala in JavascriptAlexandru Badiu
 

Más de Alexandru Badiu (13)

Drupal 8
Drupal 8Drupal 8
Drupal 8
 
Drupal as a first class mobile platform
Drupal as a first class mobile platformDrupal as a first class mobile platform
Drupal as a first class mobile platform
 
Cloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloudCloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloud
 
REST Drupal
REST DrupalREST Drupal
REST Drupal
 
Cloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloudCloud to the rescue? How I learned to stop worrying and love the cloud
Cloud to the rescue? How I learned to stop worrying and love the cloud
 
Learning the basics of the Drupal API
Learning the basics of the Drupal APILearning the basics of the Drupal API
Learning the basics of the Drupal API
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?
 
Drupal, Android and iPhone
Drupal, Android and iPhoneDrupal, Android and iPhone
Drupal, Android and iPhone
 
Publish and Subscribe
Publish and SubscribePublish and Subscribe
Publish and Subscribe
 
Using Features
Using FeaturesUsing Features
Using Features
 
Concepte de programare functionala in Javascript
Concepte de programare functionala in JavascriptConcepte de programare functionala in Javascript
Concepte de programare functionala in Javascript
 
Drupal and Solr
Drupal and SolrDrupal and Solr
Drupal and Solr
 
Prezentare Wurbe
Prezentare WurbePrezentare Wurbe
Prezentare Wurbe
 

Último

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 

Último (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 

BDD Behaviour Driven Development in PHP and Drupal

  • 2. BEHAVIOUR DRIVEN DEVELOPMENT ALEXANDRU BADIU Drupal developer for 10 years. Drupal Romania founding member. I work at Demotix / Corbis. ! http://alexandrubadiu.ro http://twitter.com/voidberg Drupalcamp Tirgu Mures 2013
  • 3. BDD IS A SECOND-GENERATION, OUTSIDE–IN, PULL-BASED, MULTIPLE- STAKEHOLDER, MULTIPLE-SCALE, HIGH- AUTOMATION, AGILE METHODOLOGY.
  • 5. BEHAVIOUR DRIVEN DEVELOPMENT TDD’S SHORTCOMINGS • Unit tests, Inside - out. • Write the unit test before the code. • Typically written by the programmer. • Can’t test everything: full functional tests? • Can’t refactor as you wish: dependent on early tests. Drupalcamp Tirgu Mures 2013
  • 6. BEHAVIOUR DRIVEN DEVELOPMENT BDD FEATURES • It picks up where TDD leaves off. • Rethinking the approach to unit and acceptance testing. • Uses a common language that everyone can use from all chains of command. • Becomes a test, a piece of documentation, a specification. • Supported by a wide range of tools: Gherkin, Cucumber, Behat, Travis, Jenkins, Jira and so on. Drupalcamp Tirgu Mures 2013
  • 7. BEHAVIOUR DRIVEN DEVELOPMENT BDD FEATURES • Test code or describe behaviour? • Both. • TDD is about ensuring behaviour. • BDD is about describing behaviour. Drupalcamp Tirgu Mures 2013
  • 8. BEHAVIOUR DRIVEN DEVELOPMENT BDD FEATURES • User story. • Stakeholder, effect, value. • Acceptance criteria or scenarios. • Steps. • Initial conditions. • Triggers. • Outcomes. Drupalcamp Tirgu Mures 2013
  • 9. BEHAVIOUR DRIVEN DEVELOPMENT BDD FEATURES Feature: Authentication! ! In order to change my information and add sessions! As a registered Drupalcamp user! I need to be able to authenticate! ! Scenario: User login! Given I am on "/"! When I follow "Log in"! And I fill in "name" with "bddtest"! And I fill in "pass" with "bddtest"! And I press "Log in"! Then I should see "My account" ! ! Scenario: User logout! Given I am logged in! And I am on "/"! When I follow "Log out"! Then I should see "Log in" Drupalcamp Tirgu Mures 2013
  • 10. BDD IS A SECONDGENERATION, OUTSIDE–IN, PULL-BASED, MULTIPLESTAKEHOLDER, MULTIPLE-SCALE, HIGH- AUTOMATION, AGILE METHODOLOGY.
  • 11. BEHAVIOUR DRIVEN DEVELOPMENT BDD IN PHP • Behat. • OSS. • Cucumber “language”. • Mink for testing web apps. • Different drivers: Selenium, zombie.js, goutte etc. Drupalcamp Tirgu Mures 2013
  • 12. BEHAVIOUR DRIVEN DEVELOPMENT COMPOSER.JSON {! "require": {! "behat/behat": "2.4.*@stable",! "behat/mink": "1.5.*@stable",! "behat/mink-extension": "*",! "behat/mink-goutte-driver": "*",! "behat/mink-selenium-driver": "*",! "behat/mink-selenium2-driver": "*",! "behat/mink-sahi-driver": "*",! "behat/mink-zombie-driver": "*",! },! "minimum-stability": "dev",! "config": {! "bin-dir": "bin/"! }! }! Drupalcamp Tirgu Mures 2013
  • 13. BEHAVIOUR DRIVEN DEVELOPMENT INSTALL curl http://getcomposer.org/installer | php! php composer.phar install —prefer-source! ! bin/behat —init! ! +d features - place your *.feature files here! +d features/bootstrap - place bootstrap scripts and static files here! +f features/bootstrap/FeatureContext.php - place your feature related code here Drupalcamp Tirgu Mures 2013
  • 14. BEHAVIOUR DRIVEN DEVELOPMENT BEHAT.YML default:! extensions:! BehatMinkExtensionExtension:! base_url: http://drupalcamp.ro/! goutte: ~! zombie: ~! sahi:! port: 9999! selenium2:! wd_host: "http://127.0.0.1:4444/wd/hub"! ! default_session: 'selenium2'! javascript_session: 'selenium2'! Drupalcamp Tirgu Mures 2013
  • 15. DEMO
  • 16. BEHAVIOUR DRIVEN DEVELOPMENT BDD IN DRUPAL • Behat Drupal Extension. • Provides step definitions for common testing scenarios specific to Drupal sites. Drupalcamp Tirgu Mures 2013
  • 17. BEHAVIOUR DRIVEN DEVELOPMENT BDD IN DRUPAL composer.json! ! ! ! ! ! "require": {! ! "drupal/drupal-extension": "*"! ! },! behat.yml! ! ! DrupalDrupalExtensionExtension:! blackbox: ~ Drupalcamp Tirgu Mures 2013
  • 18. BEHAVIOUR DRIVEN DEVELOPMENT BDD IN DRUPAL Given I am logged in as a user with the "authenticated user" role! ! Then I should see the heading “History"! ! Then I should see the heading "User login" in the "left sidebar" region! ! Given the cache has been cleared! ! When I run cron! ! Drupalcamp Tirgu Mures 2013
  • 19. BEHAVIOUR DRIVEN DEVELOPMENT BDD IN DRUPAL Given "page" nodes:! | title |! | Page one |! | Page two |! ! And "article" nodes:! | title |! | First article |! | Second article |! ! Given "article" nodes:! | title | promote | First article with fields | 1 ! Given users:! | name | mail | status | Joe User | joe@example.com | 1 | body |! | PLACEHOLDER BODY |! |! | Drupalcamp Tirgu Mures 2013
  • 21. We’re hiring! AngularJS, Node.js. Come talk to me if you’re interested.