SlideShare a Scribd company logo
Behat for Drupal
Automated tests and much more
Andrea Pescetti
andrea@nuvole.org
Fabian Bircher
fabian@nuvole.org
Antonio De Marco
antonio@nuvole.org
web: nuvole.org       twitter: @nuvoleweb
🎯
Our experience
Nuvole is a 100% Drupal company.
Projects: Drupal 8 websites, mostly in the high-profile range.
Clients: International organizations in the US and Europe.
Team: Distributed in 4 European countries - small and agile.

Behat: an overview
A generic tool for PHP (not just Drupal).
Focus: behavior-driven development (BDD).
In plain English: a way for developers and business to agree on
project specifications that can be validated automatically.
Or, in other words, a way to use machine-readable user stories.
🔍
Behat: basic example
Feature: Users
Scenario: Visitors can access the login form
Given I am not logged in
When I visit "/user"
Then I should see "Username"
And I should see "Password"
📚
Gherkin: Scenario Background
Feature: Users
Background:
Given users:
| name | mail | pass |
| testing | testing@example.com | pass |
Scenario: Users can login
Given I am not logged in
When I visit "/user"
Then I should see "Username"
When I enter "testing" for "Username"
And I enter "pass" for "Password"
And I press the "Log in" button
Then I should see the link "View"
And I should see the link "Edit"
📚
Gherkin: Scenario Outline
Scenario Outline: Ordinary users cannot create content
Given I am logged in as "testing"
And I visit "/node/add/<type>"
Then I should not see "Create"
Examples:
| type |
| document |
| news |

Drupal Behat: Built-in steps
Compact format (list):
$ behat --definitions l
Extended format (info):
$ behat --definitions i

Custom steps
New steps for Behat can easily be added when needed by
providing custom Behat Contexts.
Just write the test in Gherkin as if the custom step existed.
Behat will give you a stub for the step code!
👑
Behat: best practices
Behat will clean up added users/content after use.
But the database after a Behat run should be considered "dirty".
Backup first if needed.
Never run in production.
👑
Behat: clean-room or real-life?
Maintain a set of tests that are supposed to run on a freshly
installed site.
Maintain a set of tests that are supposed to run on any site state,
including a snapshot of the current production database.
Tags can help to discriminate such tests.
👑
Behat for speci cations
Gherkin is readable (and almost writable) by the business -
localized variants available too.
Well-written Behat tests give you a way for encoding and testing
site specifications.
This can be reused for a site manual/documentation later.
You get to decide the level of coverage!
👑
Behat for development
Write the test first and run it.
It will fail due to missing steps or code (or it doesn't, and you know
the test is incomplete!).
Develop missing steps and code, run until green.
Bonus: you know that the test is actually good.
👑
Behat for regression testing
Update core and modules.
Site still working? Security patch brough a new permission to be
configured?
Run the full test suite and ensure everything is OK.
If not, you can even git bisect until you find the problematic
commit.
👑
Site migration
Example: convert a Drupal 7 site to a (new) Drupal 8 site.
We want to test proper implementation of functionality (not
content migration).
Encode the current functionality in Behat tests that run
successfully on the D7 site.
Use them (the same files) as a basis for the D8 development.
End of the "It used to work like this" headaches!
nuvole.org @nuvoleweb

More Related Content

What's hot

Website factory with domain Access: why and how& - Kiêt Trân & David Ferlay
Website factory with domain Access: why and how& - Kiêt Trân & David FerlayWebsite factory with domain Access: why and how& - Kiêt Trân & David Ferlay
Website factory with domain Access: why and how& - Kiêt Trân & David Ferlay
DrupalCamp Kyiv
 
Drupal 8 Vocabulary Lesson
Drupal 8 Vocabulary LessonDrupal 8 Vocabulary Lesson
Drupal 8 Vocabulary Lesson
Mediacurrent
 
The Workflow Methodology to Train Your Team on Drupal 8
The Workflow Methodology to Train Your Team on Drupal 8The Workflow Methodology to Train Your Team on Drupal 8
The Workflow Methodology to Train Your Team on Drupal 8
Acquia
 
Digital Signage for YMCA and the Drupal role
Digital Signage for YMCA and the Drupal roleDigital Signage for YMCA and the Drupal role
Digital Signage for YMCA and the Drupal role
Dmitry Drozdik
 
Composer and deployer for enterprise
Composer and deployer for enterpriseComposer and deployer for enterprise
Composer and deployer for enterprise
Elena Pustovoit
 
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
Wong Hoi Sing Edison
 
Drupal 8 and Pantheon
Drupal 8 and PantheonDrupal 8 and Pantheon
Drupal 8 and Pantheon
Pantheon
 
How to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparevHow to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparev
Oleksii Bogush
 
Why Drupal 8? Why now? APR/MAY 2015
Why Drupal 8? Why now? APR/MAY 2015Why Drupal 8? Why now? APR/MAY 2015
Why Drupal 8? Why now? APR/MAY 2015
Jeffrey McGuire
 
Building Drupal 8 Sites
Building Drupal 8 SitesBuilding Drupal 8 Sites
Building Drupal 8 Sites
Exove
 
Plugin Development for Beginners v.2019
Plugin Development for Beginners v.2019Plugin Development for Beginners v.2019
Plugin Development for Beginners v.2019
Joe Cartonia
 
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
DrupalCamp Kyiv
 
Global Open Source Development 2011-2014 Review and 2015 Forecast
Global Open Source Development 2011-2014 Review and 2015 ForecastGlobal Open Source Development 2011-2014 Review and 2015 Forecast
Global Open Source Development 2011-2014 Review and 2015 Forecast
Sammy Fung
 
Headless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal MeetupHeadless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal Meetup
Pratomo Ardianto
 
Drupal core indeas - Andy Postnikov
Drupal core indeas  - Andy PostnikovDrupal core indeas  - Andy Postnikov
Drupal core indeas - Andy Postnikov
DrupalCamp Kyiv
 
Drupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven DevelopmentDrupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven Development
Mediacurrent
 
TagSpaces Introduction
TagSpaces IntroductionTagSpaces Introduction
TagSpaces Introduction
Ilian Sapundshiev
 
Drupal Café October 2014: DrupalCon Amsterdam
Drupal Café October 2014: DrupalCon AmsterdamDrupal Café October 2014: DrupalCon Amsterdam
Drupal Café October 2014: DrupalCon Amsterdam
Exove
 
Dimpact wim bumpy road of building reusable platform for municipalities from...
Dimpact wim  bumpy road of building reusable platform for municipalities from...Dimpact wim  bumpy road of building reusable platform for municipalities from...
Dimpact wim bumpy road of building reusable platform for municipalities from...
DrupalCamp Kyiv
 
Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?
Bertrand Delacretaz
 

What's hot (20)

Website factory with domain Access: why and how& - Kiêt Trân & David Ferlay
Website factory with domain Access: why and how& - Kiêt Trân & David FerlayWebsite factory with domain Access: why and how& - Kiêt Trân & David Ferlay
Website factory with domain Access: why and how& - Kiêt Trân & David Ferlay
 
Drupal 8 Vocabulary Lesson
Drupal 8 Vocabulary LessonDrupal 8 Vocabulary Lesson
Drupal 8 Vocabulary Lesson
 
The Workflow Methodology to Train Your Team on Drupal 8
The Workflow Methodology to Train Your Team on Drupal 8The Workflow Methodology to Train Your Team on Drupal 8
The Workflow Methodology to Train Your Team on Drupal 8
 
Digital Signage for YMCA and the Drupal role
Digital Signage for YMCA and the Drupal roleDigital Signage for YMCA and the Drupal role
Digital Signage for YMCA and the Drupal role
 
Composer and deployer for enterprise
Composer and deployer for enterpriseComposer and deployer for enterprise
Composer and deployer for enterprise
 
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
 
Drupal 8 and Pantheon
Drupal 8 and PantheonDrupal 8 and Pantheon
Drupal 8 and Pantheon
 
How to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparevHow to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparev
 
Why Drupal 8? Why now? APR/MAY 2015
Why Drupal 8? Why now? APR/MAY 2015Why Drupal 8? Why now? APR/MAY 2015
Why Drupal 8? Why now? APR/MAY 2015
 
Building Drupal 8 Sites
Building Drupal 8 SitesBuilding Drupal 8 Sites
Building Drupal 8 Sites
 
Plugin Development for Beginners v.2019
Plugin Development for Beginners v.2019Plugin Development for Beginners v.2019
Plugin Development for Beginners v.2019
 
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
 
Global Open Source Development 2011-2014 Review and 2015 Forecast
Global Open Source Development 2011-2014 Review and 2015 ForecastGlobal Open Source Development 2011-2014 Review and 2015 Forecast
Global Open Source Development 2011-2014 Review and 2015 Forecast
 
Headless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal MeetupHeadless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal Meetup
 
Drupal core indeas - Andy Postnikov
Drupal core indeas  - Andy PostnikovDrupal core indeas  - Andy Postnikov
Drupal core indeas - Andy Postnikov
 
Drupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven DevelopmentDrupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven Development
 
TagSpaces Introduction
TagSpaces IntroductionTagSpaces Introduction
TagSpaces Introduction
 
Drupal Café October 2014: DrupalCon Amsterdam
Drupal Café October 2014: DrupalCon AmsterdamDrupal Café October 2014: DrupalCon Amsterdam
Drupal Café October 2014: DrupalCon Amsterdam
 
Dimpact wim bumpy road of building reusable platform for municipalities from...
Dimpact wim  bumpy road of building reusable platform for municipalities from...Dimpact wim  bumpy road of building reusable platform for municipalities from...
Dimpact wim bumpy road of building reusable platform for municipalities from...
 
Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?
 

Viewers also liked

[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.
[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.
[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.
DrupalDay
 
[drupalday2017] - Drupal 4 Stakeholders
[drupalday2017] - Drupal 4 Stakeholders[drupalday2017] - Drupal 4 Stakeholders
[drupalday2017] - Drupal 4 Stakeholders
DrupalDay
 
[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...
[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...
[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...
DrupalDay
 
[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming
[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming
[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming
DrupalDay
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
DrupalDay
 
[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza
[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza
[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza
DrupalDay
 
[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...
[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...
[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...
DrupalDay
 
[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party
DrupalDay
 
[drupalday2017] - Async navigation with a lightweight ES6 framework
[drupalday2017] - Async navigation with a lightweight ES6 framework[drupalday2017] - Async navigation with a lightweight ES6 framework
[drupalday2017] - Async navigation with a lightweight ES6 framework
DrupalDay
 
[drupalday2017] - Venezia & Drupal. Venezia è Drupal!
[drupalday2017] - Venezia & Drupal. Venezia è Drupal![drupalday2017] - Venezia & Drupal. Venezia è Drupal!
[drupalday2017] - Venezia & Drupal. Venezia è Drupal!
DrupalDay
 
[drupalday2017] - Quando l’informazione è un servizio
[drupalday2017] - Quando l’informazione è un servizio[drupalday2017] - Quando l’informazione è un servizio
[drupalday2017] - Quando l’informazione è un servizio
DrupalDay
 
[drupalday2017] - Cosa significa convertire un modulo da D7 a D8
[drupalday2017] - Cosa significa convertire un modulo da D7 a D8[drupalday2017] - Cosa significa convertire un modulo da D7 a D8
[drupalday2017] - Cosa significa convertire un modulo da D7 a D8
DrupalDay
 
[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...
[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...
[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...
DrupalDay
 
[drupalday2017] - REST in pieces
[drupalday2017] - REST in pieces[drupalday2017] - REST in pieces
[drupalday2017] - REST in pieces
DrupalDay
 
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
DrupalDay
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
DrupalDay
 
Come progettare e realizzare una distribuzione in Drupal 8
Come progettare e realizzare una distribuzione in Drupal 8Come progettare e realizzare una distribuzione in Drupal 8
Come progettare e realizzare una distribuzione in Drupal 8
DrupalDay
 
Da X a Drupal 8, migra tutto e vivi sereno
Da X a Drupal 8, migra tutto e vivi serenoDa X a Drupal 8, migra tutto e vivi sereno
Da X a Drupal 8, migra tutto e vivi sereno
DrupalDay
 
Tooling per il tema in Drupal 8
Tooling per il tema in Drupal 8Tooling per il tema in Drupal 8
Tooling per il tema in Drupal 8
DrupalDay
 
Once you go cloud you never go down
Once you go cloud you never go downOnce you go cloud you never go down
Once you go cloud you never go down
DrupalDay
 

Viewers also liked (20)

[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.
[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.
[drupalday 2017] - Accessibilità Web: Finalità, metodologie e strumenti.
 
[drupalday2017] - Drupal 4 Stakeholders
[drupalday2017] - Drupal 4 Stakeholders[drupalday2017] - Drupal 4 Stakeholders
[drupalday2017] - Drupal 4 Stakeholders
 
[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...
[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...
[drupalday2017] - Open Data con Drupal nella PA: considerazioni su licensing ...
 
[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming
[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming
[drupalday2017] - Drupal & Patternlab: un nuovo approccio al theming
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
 
[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza
[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza
[drupalday2017] - DRUPAL per la PA: il modello della Trasparenza di Sapienza
 
[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...
[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...
[drupalday2017] - Cloud e integrazione per la PA: la sfida dell'Open Source t...
 
[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party
 
[drupalday2017] - Async navigation with a lightweight ES6 framework
[drupalday2017] - Async navigation with a lightweight ES6 framework[drupalday2017] - Async navigation with a lightweight ES6 framework
[drupalday2017] - Async navigation with a lightweight ES6 framework
 
[drupalday2017] - Venezia & Drupal. Venezia è Drupal!
[drupalday2017] - Venezia & Drupal. Venezia è Drupal![drupalday2017] - Venezia & Drupal. Venezia è Drupal!
[drupalday2017] - Venezia & Drupal. Venezia è Drupal!
 
[drupalday2017] - Quando l’informazione è un servizio
[drupalday2017] - Quando l’informazione è un servizio[drupalday2017] - Quando l’informazione è un servizio
[drupalday2017] - Quando l’informazione è un servizio
 
[drupalday2017] - Cosa significa convertire un modulo da D7 a D8
[drupalday2017] - Cosa significa convertire un modulo da D7 a D8[drupalday2017] - Cosa significa convertire un modulo da D7 a D8
[drupalday2017] - Cosa significa convertire un modulo da D7 a D8
 
[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...
[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...
[drupalday2017] - Contenuti educativi digitali aperti, creare contenuti e dis...
 
[drupalday2017] - REST in pieces
[drupalday2017] - REST in pieces[drupalday2017] - REST in pieces
[drupalday2017] - REST in pieces
 
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Come progettare e realizzare una distribuzione in Drupal 8
Come progettare e realizzare una distribuzione in Drupal 8Come progettare e realizzare una distribuzione in Drupal 8
Come progettare e realizzare una distribuzione in Drupal 8
 
Da X a Drupal 8, migra tutto e vivi sereno
Da X a Drupal 8, migra tutto e vivi serenoDa X a Drupal 8, migra tutto e vivi sereno
Da X a Drupal 8, migra tutto e vivi sereno
 
Tooling per il tema in Drupal 8
Tooling per il tema in Drupal 8Tooling per il tema in Drupal 8
Tooling per il tema in Drupal 8
 
Once you go cloud you never go down
Once you go cloud you never go downOnce you go cloud you never go down
Once you go cloud you never go down
 

Similar to [drupalday2017] - Behat per Drupal: test automatici e molto di più

Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
Adam Englander
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldLorna Mitchell
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
Adam Englander
 
Automation in Drupal
Automation in DrupalAutomation in Drupal
Automation in Drupal
Bozhidar Boshnakov
 
BDD, Behat & Drupal
BDD, Behat & DrupalBDD, Behat & Drupal
BDD, Behat & Drupal
Bozhidar Boshnakov
 
Docker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatternsDocker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatterns
Lenses.io
 
Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!Joel Farris
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
toddbr
 
Building products people actually can use – why all developers need to unders...
Building products people actually can use – why all developers need to unders...Building products people actually can use – why all developers need to unders...
Building products people actually can use – why all developers need to unders...
Cyber-Duck
 
30 Skills to Master to Become a Senior Software Engineer
30 Skills to Master to Become a Senior Software Engineer30 Skills to Master to Become a Senior Software Engineer
30 Skills to Master to Become a Senior Software Engineer
Sean Coates
 
Resources For Floss Projects
Resources For Floss ProjectsResources For Floss Projects
Resources For Floss Projects
Jon Spriggs
 
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Lorenzo Barbieri
 
Laravel CI / CD in Azure Web Apps - Global Azure Bootcamp Jakarta
Laravel CI / CD in Azure Web Apps -  Global Azure Bootcamp JakartaLaravel CI / CD in Azure Web Apps -  Global Azure Bootcamp Jakarta
Laravel CI / CD in Azure Web Apps - Global Azure Bootcamp Jakarta
Billy Riantono
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
Robin O'Brien
 
From Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
From Drupal 7 to Drupal 8 - Drupal Intensive Course OverviewFrom Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
From Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
Italo Mairo
 
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
 
An Introduction to Microservices
An Introduction to MicroservicesAn Introduction to Microservices
An Introduction to Microservices
Ad van der Veer
 
The development and future of GlotPress
The development and future of GlotPressThe development and future of GlotPress
The development and future of GlotPress
Marko Heijnen
 

Similar to [drupalday2017] - Behat per Drupal: test automatici e molto di più (20)

Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP World
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
 
Automation in Drupal
Automation in DrupalAutomation in Drupal
Automation in Drupal
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
 
BDD, Behat & Drupal
BDD, Behat & DrupalBDD, Behat & Drupal
BDD, Behat & Drupal
 
Docker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatternsDocker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatterns
 
Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
Building products people actually can use – why all developers need to unders...
Building products people actually can use – why all developers need to unders...Building products people actually can use – why all developers need to unders...
Building products people actually can use – why all developers need to unders...
 
30 Skills to Master to Become a Senior Software Engineer
30 Skills to Master to Become a Senior Software Engineer30 Skills to Master to Become a Senior Software Engineer
30 Skills to Master to Become a Senior Software Engineer
 
Resources For Floss Projects
Resources For Floss ProjectsResources For Floss Projects
Resources For Floss Projects
 
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
 
Laravel CI / CD in Azure Web Apps - Global Azure Bootcamp Jakarta
Laravel CI / CD in Azure Web Apps -  Global Azure Bootcamp JakartaLaravel CI / CD in Azure Web Apps -  Global Azure Bootcamp Jakarta
Laravel CI / CD in Azure Web Apps - Global Azure Bootcamp Jakarta
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
 
From Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
From Drupal 7 to Drupal 8 - Drupal Intensive Course OverviewFrom Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
From Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
 
An Introduction to Microservices
An Introduction to MicroservicesAn Introduction to Microservices
An Introduction to Microservices
 
The development and future of GlotPress
The development and future of GlotPressThe development and future of GlotPress
The development and future of GlotPress
 

More from DrupalDay

Drupal per la PA
Drupal per la PADrupal per la PA
Drupal per la PA
DrupalDay
 
Mantenere una distribuzione Drupal attraverso test coverage: Paddle case study
Mantenere una distribuzione Drupal attraverso test coverage: Paddle case studyMantenere una distribuzione Drupal attraverso test coverage: Paddle case study
Mantenere una distribuzione Drupal attraverso test coverage: Paddle case study
DrupalDay
 
Invisiblefarm condivide l'esperienza DrupalGIS
Invisiblefarm condivide l'esperienza DrupalGISInvisiblefarm condivide l'esperienza DrupalGIS
Invisiblefarm condivide l'esperienza DrupalGIS
DrupalDay
 
La semantica per automatizzare una redazione web: l'esperienza di Innolabplus.eu
La semantica per automatizzare una redazione web: l'esperienza di Innolabplus.euLa semantica per automatizzare una redazione web: l'esperienza di Innolabplus.eu
La semantica per automatizzare una redazione web: l'esperienza di Innolabplus.eu
DrupalDay
 
"Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen...
"Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen..."Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen...
"Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen...
DrupalDay
 
Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...
Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...
Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...
DrupalDay
 

More from DrupalDay (6)

Drupal per la PA
Drupal per la PADrupal per la PA
Drupal per la PA
 
Mantenere una distribuzione Drupal attraverso test coverage: Paddle case study
Mantenere una distribuzione Drupal attraverso test coverage: Paddle case studyMantenere una distribuzione Drupal attraverso test coverage: Paddle case study
Mantenere una distribuzione Drupal attraverso test coverage: Paddle case study
 
Invisiblefarm condivide l'esperienza DrupalGIS
Invisiblefarm condivide l'esperienza DrupalGISInvisiblefarm condivide l'esperienza DrupalGIS
Invisiblefarm condivide l'esperienza DrupalGIS
 
La semantica per automatizzare una redazione web: l'esperienza di Innolabplus.eu
La semantica per automatizzare una redazione web: l'esperienza di Innolabplus.euLa semantica per automatizzare una redazione web: l'esperienza di Innolabplus.eu
La semantica per automatizzare una redazione web: l'esperienza di Innolabplus.eu
 
"Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen...
"Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen..."Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen...
"Twig e i belli dentro": panoramica sui nuovi standard di frontend-developmen...
 
Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...
Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...
Drupal 8: dal download del Core alla pubblicazione in produzione. Cos'è cambi...
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 

[drupalday2017] - Behat per Drupal: test automatici e molto di più

  • 1. Behat for Drupal Automated tests and much more Andrea Pescetti andrea@nuvole.org Fabian Bircher fabian@nuvole.org Antonio De Marco antonio@nuvole.org web: nuvole.org       twitter: @nuvoleweb
  • 2.
  • 3. 🎯 Our experience Nuvole is a 100% Drupal company. Projects: Drupal 8 websites, mostly in the high-profile range. Clients: International organizations in the US and Europe. Team: Distributed in 4 European countries - small and agile.
  • 4.  Behat: an overview A generic tool for PHP (not just Drupal). Focus: behavior-driven development (BDD). In plain English: a way for developers and business to agree on project specifications that can be validated automatically. Or, in other words, a way to use machine-readable user stories.
  • 5. 🔍 Behat: basic example Feature: Users Scenario: Visitors can access the login form Given I am not logged in When I visit "/user" Then I should see "Username" And I should see "Password"
  • 6. 📚 Gherkin: Scenario Background Feature: Users Background: Given users: | name | mail | pass | | testing | testing@example.com | pass | Scenario: Users can login Given I am not logged in When I visit "/user" Then I should see "Username" When I enter "testing" for "Username" And I enter "pass" for "Password" And I press the "Log in" button Then I should see the link "View" And I should see the link "Edit"
  • 7. 📚 Gherkin: Scenario Outline Scenario Outline: Ordinary users cannot create content Given I am logged in as "testing" And I visit "/node/add/<type>" Then I should not see "Create" Examples: | type | | document | | news |
  • 8.  Drupal Behat: Built-in steps Compact format (list): $ behat --definitions l Extended format (info): $ behat --definitions i
  • 9.  Custom steps New steps for Behat can easily be added when needed by providing custom Behat Contexts. Just write the test in Gherkin as if the custom step existed. Behat will give you a stub for the step code!
  • 10. 👑 Behat: best practices Behat will clean up added users/content after use. But the database after a Behat run should be considered "dirty". Backup first if needed. Never run in production.
  • 11. 👑 Behat: clean-room or real-life? Maintain a set of tests that are supposed to run on a freshly installed site. Maintain a set of tests that are supposed to run on any site state, including a snapshot of the current production database. Tags can help to discriminate such tests.
  • 12. 👑 Behat for speci cations Gherkin is readable (and almost writable) by the business - localized variants available too. Well-written Behat tests give you a way for encoding and testing site specifications. This can be reused for a site manual/documentation later. You get to decide the level of coverage!
  • 13. 👑 Behat for development Write the test first and run it. It will fail due to missing steps or code (or it doesn't, and you know the test is incomplete!). Develop missing steps and code, run until green. Bonus: you know that the test is actually good.
  • 14. 👑 Behat for regression testing Update core and modules. Site still working? Security patch brough a new permission to be configured? Run the full test suite and ensure everything is OK. If not, you can even git bisect until you find the problematic commit.
  • 15. 👑 Site migration Example: convert a Drupal 7 site to a (new) Drupal 8 site. We want to test proper implementation of functionality (not content migration). Encode the current functionality in Behat tests that run successfully on the D7 site. Use them (the same files) as a basis for the D8 development. End of the "It used to work like this" headaches!