SlideShare a Scribd company logo
Drupal 7 Continuous
Integration and Testing
Smashing Phing and Behat for fun & profit
Heya! |°▿▿▿▿°|/
• Claudio Beatrice
• @omissis
• 7+ years experience in PHP
• Founder of the Drupal Italia
Association
• Worked in Italy, France and
Germany
So: D7, CI and Testing
Yeah! Nowadays it’s
possible to leverage the
power of a tool or two to
get a seamless continuous
integration process not
much different to the one
we’re used to when
developing with lower-level
frameworks.
Continuous Integration
Continuous integration (CI) is the practice, in
software engineering, of merging all developer
workspaces with a shared mainline several times a
day.
- Wikipedia
Testing History tldr
BDD
Combining TDD with Domain-Driven Design
Unit testing
Testing code automatically
TDD
Writing tests first
Agile Testing Matrix
by Briack Marick
Acceptance
Testing
Usability
Testing
Unit Testing
Performance
Testing
Technology-facing
Business-facing
Critiqueproduct
Support
programming
What is that about?
Basically, a collection of softwares sporting the ugliest
set of icons in the known universe!
Jenkins
Jenkins is a Java application that monitors executions of
repeated jobs, such as building a software project or jobs
run by cron.
Jenkins
In a nutshell, Jenkins provides an easy-to-use so-called
continuous integration system, making it easier for
developers to integrate changes to the project, and
making it easier for users to obtain a fresh build. The
automated, continuous build increases the productivity.
Phing
A cross-platform build tool for PHP based on Apache Ant
It offers a standard, declarative way(XML) of writing
scripts to handle operations such as packaging,
deploying and testing web application.
It features a rich set of tasks for dealing with file system
operations, SQL executions, code analysis and linting,
documentation generation and much, much more.
Phing
Drush
Drush is a command line shell and scripting interface for
Drupal, a veritable Swiss Army knife designed to make life
easier for those of us who spend some of our working
hours hacking away at the command prompt.
PHPUnit
It’s the de-facto standard unit testing framework for PHP and
part of the larger xUnit family.
Its primary goal is to take the smallest piece of testable
software in the application, isolate it from the rest of the code,
and determine whether it behaves exactly as you expect.
PHPUnit
It provides a very useful set of tools for testing code units
such as:
• Assertions
• Fixtures
• Database testing
• Mock Objects
• Code coverage analysis
• Several kind of logging formats
Behat
Behat is a tool for writing human-readable tests in the
form of a story, using a language called Gherkin, that
describe the behavior of your application.
By writing stories, it is possible to define acceptance
criteria that can be actually executed for testing the
behavior of a web application.
Ambiguity and miscommunication between developers,
business owners and testers can be greatly reduced.
Behat
One vocabulary to rule them all
Behat
Feature: front page
In order to access the website
As an anonymous user
I need to be able to see the login form
Every feature comes with a name, followed by three lines
describing the benefit, the role and the feature itself.
This section is required but not important to Behat in
terms of execution, it’s just there for reading purposes.
Behat
Scenario: Login page shows the correct buttons
Given I am on “/”
Then I should not see the link “register”
And I should see the link “login”
And I should see the link “forgot password”
Every scenario describes how a feature acts under
different conditions and it’s composed by three parts: the
context, the event and the outcome
This is the part that will be transformed into a test.
Behat
/**
* @Then /^I should not see the link "(?P<link>[^"]*)"$/
*/
public function iShouldNotSeeTheLink($link) {
$element = $this->getSession()->getPage();
$result = $element->findLink($link);
if ($result) {
throw new Exception(sprintf(
"The link '%s' was present on the page %s and was not
supposed to be",
$link,
$this->getSession()->getCurrentUrl()
));
}
}
A few more little pieces...
• Git, for versioning code
• Drush Phing Task, for integrating Drush commands into
Phing targets
• Drupal Behat extension, needed to leverage the power
of Drush into our Behat features
• Migrate Module, for importing fixtures and migrating
data whenever needed
• Features Module, for exporting configuration into code
...and files!
• .gitignore, for not tracking a good bunch of files we
don’t need
• drush make, for keeping track of the modules, themes
and libraries to ues
• build.xml, for describing all the actions Phing will have
to take to build the website
• build.ENV.properties, for storing environments variables
used during the build process
• behat.yml.dist, for storing Behat’s configurations
Save the environment(s)!
• local, the developer’s machine, where everyday work is
done.
• dev, a server where the CI actually happens. It gets
rebuilt from scratch and throughly tested every
time(ideally after every push on the repository)
• stage, a server used to deploy “stable” dev snapshots
at a given point in time, usually for letting the client
tests on a more stable environment
Save the environment(s)!
• debug, a copy of the production environment (as
faithful as possible), used for easily reproducing bugs
happening on production and also to test deploys.
• prod, the environment that hosts the final product,
tuned and optimized for best performances.
Let’s sum up a second
Jenkins takes those logs and publishes the results
Jenkins clones the repository and invokes Phing
Phing performs the build of the website, upload the files
and the database and finally launches the tests
PHPUnit and Behat run the tests
and log the results in JUnit format
Time for some action!
Go grab the code at
http://github.com/agavee/drupal7-base
You deserve some moar
• http://www.slideshare.net/everzet/bdd-in-symfony2/
• http://www.slideshare.net/headrevision/web-
acceptance-testing-with-behat/
• http://www.exampler.com/old-blog/2003/08/21/
• http://www.phpunit.de/manual/current/en/index.html
• http://dannorth.net/whats-in-a-story/
Thank you!
http://silent-voice.org/
http://agavee.com/
@omissis
Ad

More Related Content

What's hot (19)

Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
Panoptic Development, Inc.
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
nagpalprachi
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
wajrcs
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
vodQA
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, Successfully
Sauce Labs
 
Codeception
CodeceptionCodeception
Codeception
Jonathan Lau
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
AgileEngine
 
Selenium Frameworks
Selenium FrameworksSelenium Frameworks
Selenium Frameworks
Dave Haeffner
 
Automated testing in Drupal
Automated testing in DrupalAutomated testing in Drupal
Automated testing in Drupal
Artem Berdishev
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
Dave Haeffner
 
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
brian d foy
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
Jeremy Coates
 
Drupalcamp Simpletest
Drupalcamp SimpletestDrupalcamp Simpletest
Drupalcamp Simpletest
lyricnz
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Faichi Solutions
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
IlPeach
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
Dave Haeffner
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
Sam Becker
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Cogapp
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
Simon Guest
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
nagpalprachi
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
wajrcs
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
vodQA
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, Successfully
Sauce Labs
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
AgileEngine
 
Automated testing in Drupal
Automated testing in DrupalAutomated testing in Drupal
Automated testing in Drupal
Artem Berdishev
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
Dave Haeffner
 
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
brian d foy
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
Jeremy Coates
 
Drupalcamp Simpletest
Drupalcamp SimpletestDrupalcamp Simpletest
Drupalcamp Simpletest
lyricnz
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Faichi Solutions
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
IlPeach
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
Dave Haeffner
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
Sam Becker
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Cogapp
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
Simon Guest
 

Similar to Drupal 7 ci and testing (20)

Build Time Hacking
Build Time HackingBuild Time Hacking
Build Time Hacking
Mohammed Tanveer
 
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
 
O365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - MaterialO365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - Material
Thomas Daly
 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
willmation
 
Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021
WrapPixel
 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/Ops
Erik Osterman
 
Automation in Drupal
Automation in DrupalAutomation in Drupal
Automation in Drupal
Bozhidar Boshnakov
 
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
Michael Lihs
 
Tell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature FlagsTell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature Flags
Jorge Ortiz
 
Slides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testingSlides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testing
SwapnilNarayan
 
Part 2 improving your software development v1.0
Part 2   improving your software development v1.0Part 2   improving your software development v1.0
Part 2 improving your software development v1.0
Jasmine Conseil
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
Paul Jensen
 
Php Development Stack
Php Development StackPhp Development Stack
Php Development Stack
shah_neeraj
 
Php Development Stack
Php Development StackPhp Development Stack
Php Development Stack
Bipin Upadhyay
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
Mikkel Flindt Heisterberg
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
Jared Faris
 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.
Vlad Fedosov
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17
Jared Faris
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw
 
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
 
O365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - MaterialO365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - Material
Thomas Daly
 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
willmation
 
Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021
WrapPixel
 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/Ops
Erik Osterman
 
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
Michael Lihs
 
Tell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature FlagsTell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature Flags
Jorge Ortiz
 
Slides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testingSlides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testing
SwapnilNarayan
 
Part 2 improving your software development v1.0
Part 2   improving your software development v1.0Part 2   improving your software development v1.0
Part 2 improving your software development v1.0
Jasmine Conseil
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
Paul Jensen
 
Php Development Stack
Php Development StackPhp Development Stack
Php Development Stack
shah_neeraj
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
Mikkel Flindt Heisterberg
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
Jared Faris
 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.
Vlad Fedosov
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17
Jared Faris
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw
 
Ad

Recently uploaded (20)

Tree Trimming Tips Every Shellharbour Homeowner Should Know.pdf
Tree Trimming Tips Every Shellharbour Homeowner Should Know.pdfTree Trimming Tips Every Shellharbour Homeowner Should Know.pdf
Tree Trimming Tips Every Shellharbour Homeowner Should Know.pdf
All Round Tree Last Garden Care
 
Rostering Software for Disability Support
Rostering Software for Disability SupportRostering Software for Disability Support
Rostering Software for Disability Support
marketingbloom06
 
Paralino- Fun, Private and encrypted location sharing
Paralino- Fun, Private and encrypted location sharingParalino- Fun, Private and encrypted location sharing
Paralino- Fun, Private and encrypted location sharing
Paralino
 
Poppy | Redefining Contemporary Fashion|
Poppy | Redefining Contemporary Fashion|Poppy | Redefining Contemporary Fashion|
Poppy | Redefining Contemporary Fashion|
sohamnettech
 
dua-samat.ppt which is written for all to read
dua-samat.ppt which is written for all to readdua-samat.ppt which is written for all to read
dua-samat.ppt which is written for all to read
alirezarazzaz
 
PVC Ecology Fence for Eco-Conscious Spaces
PVC Ecology Fence for Eco-Conscious SpacesPVC Ecology Fence for Eco-Conscious Spaces
PVC Ecology Fence for Eco-Conscious Spaces
professionalneonae
 
Chris Hilken on Navigating Parenting During Life Transitions
Chris Hilken on Navigating Parenting During Life TransitionsChris Hilken on Navigating Parenting During Life Transitions
Chris Hilken on Navigating Parenting During Life Transitions
Chris Hilken
 
Revista Ser Padres (Sección Mamá Bloguera)
Revista Ser Padres (Sección Mamá Bloguera)Revista Ser Padres (Sección Mamá Bloguera)
Revista Ser Padres (Sección Mamá Bloguera)
Karina Cortes
 
How the NGO Eurasia Supports Volunteering Efforts on the Black Sea
How the NGO Eurasia Supports Volunteering Efforts on the Black SeaHow the NGO Eurasia Supports Volunteering Efforts on the Black Sea
How the NGO Eurasia Supports Volunteering Efforts on the Black Sea
luciekhensamphanh
 
Discovering Your True Value by Rich Vibes Publication
Discovering Your True Value by Rich Vibes PublicationDiscovering Your True Value by Rich Vibes Publication
Discovering Your True Value by Rich Vibes Publication
Rich Vibes Publication
 
AHEPA Senior Living breaks ground on second South Bend community
AHEPA Senior Living breaks ground on second South Bend communityAHEPA Senior Living breaks ground on second South Bend community
AHEPA Senior Living breaks ground on second South Bend community
Ahepa Senior Living
 
What Defines A Crime Novel As A "Best Seller" In 2025?
What Defines A Crime Novel As A "Best Seller" In 2025?What Defines A Crime Novel As A "Best Seller" In 2025?
What Defines A Crime Novel As A "Best Seller" In 2025?
Nitish Bhushan
 
The Billionaires Illusion by Rich Vibes Publication
The Billionaires Illusion by Rich Vibes PublicationThe Billionaires Illusion by Rich Vibes Publication
The Billionaires Illusion by Rich Vibes Publication
Rich Vibes Publication
 
45 year old celebrities female​.pptx
45  year  old  celebrities  female​.pptx45  year  old  celebrities  female​.pptx
45 year old celebrities female​.pptx
richardwilliam20023
 
How Modern Lifestyle Trends Are Shaping Daily Life in the USA
How Modern Lifestyle Trends Are Shaping Daily Life in the USAHow Modern Lifestyle Trends Are Shaping Daily Life in the USA
How Modern Lifestyle Trends Are Shaping Daily Life in the USA
Raj Kumble
 
Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...
Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...
Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...
3Cube
 
Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...
Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...
Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...
Rich Vibes Publication
 
10. Material Lifecycle Office to Outdoor Seating.pdf
10. Material Lifecycle  Office to Outdoor Seating.pdf10. Material Lifecycle  Office to Outdoor Seating.pdf
10. Material Lifecycle Office to Outdoor Seating.pdf
diyasocial123
 
10.Durability and Vandal Resistance in Public Chairs.pdf
10.Durability and Vandal Resistance in Public Chairs.pdf10.Durability and Vandal Resistance in Public Chairs.pdf
10.Durability and Vandal Resistance in Public Chairs.pdf
diyasocial123
 
Someshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdf
Someshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdfSomeshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdf
Someshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdf
SomeshwarSrivastava1
 
Tree Trimming Tips Every Shellharbour Homeowner Should Know.pdf
Tree Trimming Tips Every Shellharbour Homeowner Should Know.pdfTree Trimming Tips Every Shellharbour Homeowner Should Know.pdf
Tree Trimming Tips Every Shellharbour Homeowner Should Know.pdf
All Round Tree Last Garden Care
 
Rostering Software for Disability Support
Rostering Software for Disability SupportRostering Software for Disability Support
Rostering Software for Disability Support
marketingbloom06
 
Paralino- Fun, Private and encrypted location sharing
Paralino- Fun, Private and encrypted location sharingParalino- Fun, Private and encrypted location sharing
Paralino- Fun, Private and encrypted location sharing
Paralino
 
Poppy | Redefining Contemporary Fashion|
Poppy | Redefining Contemporary Fashion|Poppy | Redefining Contemporary Fashion|
Poppy | Redefining Contemporary Fashion|
sohamnettech
 
dua-samat.ppt which is written for all to read
dua-samat.ppt which is written for all to readdua-samat.ppt which is written for all to read
dua-samat.ppt which is written for all to read
alirezarazzaz
 
PVC Ecology Fence for Eco-Conscious Spaces
PVC Ecology Fence for Eco-Conscious SpacesPVC Ecology Fence for Eco-Conscious Spaces
PVC Ecology Fence for Eco-Conscious Spaces
professionalneonae
 
Chris Hilken on Navigating Parenting During Life Transitions
Chris Hilken on Navigating Parenting During Life TransitionsChris Hilken on Navigating Parenting During Life Transitions
Chris Hilken on Navigating Parenting During Life Transitions
Chris Hilken
 
Revista Ser Padres (Sección Mamá Bloguera)
Revista Ser Padres (Sección Mamá Bloguera)Revista Ser Padres (Sección Mamá Bloguera)
Revista Ser Padres (Sección Mamá Bloguera)
Karina Cortes
 
How the NGO Eurasia Supports Volunteering Efforts on the Black Sea
How the NGO Eurasia Supports Volunteering Efforts on the Black SeaHow the NGO Eurasia Supports Volunteering Efforts on the Black Sea
How the NGO Eurasia Supports Volunteering Efforts on the Black Sea
luciekhensamphanh
 
Discovering Your True Value by Rich Vibes Publication
Discovering Your True Value by Rich Vibes PublicationDiscovering Your True Value by Rich Vibes Publication
Discovering Your True Value by Rich Vibes Publication
Rich Vibes Publication
 
AHEPA Senior Living breaks ground on second South Bend community
AHEPA Senior Living breaks ground on second South Bend communityAHEPA Senior Living breaks ground on second South Bend community
AHEPA Senior Living breaks ground on second South Bend community
Ahepa Senior Living
 
What Defines A Crime Novel As A "Best Seller" In 2025?
What Defines A Crime Novel As A "Best Seller" In 2025?What Defines A Crime Novel As A "Best Seller" In 2025?
What Defines A Crime Novel As A "Best Seller" In 2025?
Nitish Bhushan
 
The Billionaires Illusion by Rich Vibes Publication
The Billionaires Illusion by Rich Vibes PublicationThe Billionaires Illusion by Rich Vibes Publication
The Billionaires Illusion by Rich Vibes Publication
Rich Vibes Publication
 
45 year old celebrities female​.pptx
45  year  old  celebrities  female​.pptx45  year  old  celebrities  female​.pptx
45 year old celebrities female​.pptx
richardwilliam20023
 
How Modern Lifestyle Trends Are Shaping Daily Life in the USA
How Modern Lifestyle Trends Are Shaping Daily Life in the USAHow Modern Lifestyle Trends Are Shaping Daily Life in the USA
How Modern Lifestyle Trends Are Shaping Daily Life in the USA
Raj Kumble
 
Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...
Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...
Bucket Hats: From Practical Accessory to Fashion Icon – A Style That Never Fa...
3Cube
 
Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...
Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...
Why Multitasking Fails: The Hidden Costs of Dividing Your Attention and the P...
Rich Vibes Publication
 
10. Material Lifecycle Office to Outdoor Seating.pdf
10. Material Lifecycle  Office to Outdoor Seating.pdf10. Material Lifecycle  Office to Outdoor Seating.pdf
10. Material Lifecycle Office to Outdoor Seating.pdf
diyasocial123
 
10.Durability and Vandal Resistance in Public Chairs.pdf
10.Durability and Vandal Resistance in Public Chairs.pdf10.Durability and Vandal Resistance in Public Chairs.pdf
10.Durability and Vandal Resistance in Public Chairs.pdf
diyasocial123
 
Someshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdf
Someshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdfSomeshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdf
Someshwar Srivastava’s Guide to the CBI’s Modern-Day Struggles.pdf
SomeshwarSrivastava1
 
Ad

Drupal 7 ci and testing

  • 1. Drupal 7 Continuous Integration and Testing Smashing Phing and Behat for fun & profit
  • 2. Heya! |°▿▿▿▿°|/ • Claudio Beatrice • @omissis • 7+ years experience in PHP • Founder of the Drupal Italia Association • Worked in Italy, France and Germany
  • 3. So: D7, CI and Testing Yeah! Nowadays it’s possible to leverage the power of a tool or two to get a seamless continuous integration process not much different to the one we’re used to when developing with lower-level frameworks.
  • 4. Continuous Integration Continuous integration (CI) is the practice, in software engineering, of merging all developer workspaces with a shared mainline several times a day. - Wikipedia
  • 5. Testing History tldr BDD Combining TDD with Domain-Driven Design Unit testing Testing code automatically TDD Writing tests first
  • 6. Agile Testing Matrix by Briack Marick Acceptance Testing Usability Testing Unit Testing Performance Testing Technology-facing Business-facing Critiqueproduct Support programming
  • 7. What is that about? Basically, a collection of softwares sporting the ugliest set of icons in the known universe!
  • 8. Jenkins Jenkins is a Java application that monitors executions of repeated jobs, such as building a software project or jobs run by cron.
  • 9. Jenkins In a nutshell, Jenkins provides an easy-to-use so-called continuous integration system, making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. The automated, continuous build increases the productivity.
  • 10. Phing A cross-platform build tool for PHP based on Apache Ant It offers a standard, declarative way(XML) of writing scripts to handle operations such as packaging, deploying and testing web application. It features a rich set of tasks for dealing with file system operations, SQL executions, code analysis and linting, documentation generation and much, much more.
  • 11. Phing
  • 12. Drush Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.
  • 13. PHPUnit It’s the de-facto standard unit testing framework for PHP and part of the larger xUnit family. Its primary goal is to take the smallest piece of testable software in the application, isolate it from the rest of the code, and determine whether it behaves exactly as you expect.
  • 14. PHPUnit It provides a very useful set of tools for testing code units such as: • Assertions • Fixtures • Database testing • Mock Objects • Code coverage analysis • Several kind of logging formats
  • 15. Behat Behat is a tool for writing human-readable tests in the form of a story, using a language called Gherkin, that describe the behavior of your application. By writing stories, it is possible to define acceptance criteria that can be actually executed for testing the behavior of a web application.
  • 16. Ambiguity and miscommunication between developers, business owners and testers can be greatly reduced. Behat One vocabulary to rule them all
  • 17. Behat Feature: front page In order to access the website As an anonymous user I need to be able to see the login form Every feature comes with a name, followed by three lines describing the benefit, the role and the feature itself. This section is required but not important to Behat in terms of execution, it’s just there for reading purposes.
  • 18. Behat Scenario: Login page shows the correct buttons Given I am on “/” Then I should not see the link “register” And I should see the link “login” And I should see the link “forgot password” Every scenario describes how a feature acts under different conditions and it’s composed by three parts: the context, the event and the outcome This is the part that will be transformed into a test.
  • 19. Behat /** * @Then /^I should not see the link "(?P<link>[^"]*)"$/ */ public function iShouldNotSeeTheLink($link) { $element = $this->getSession()->getPage(); $result = $element->findLink($link); if ($result) { throw new Exception(sprintf( "The link '%s' was present on the page %s and was not supposed to be", $link, $this->getSession()->getCurrentUrl() )); } }
  • 20. A few more little pieces... • Git, for versioning code • Drush Phing Task, for integrating Drush commands into Phing targets • Drupal Behat extension, needed to leverage the power of Drush into our Behat features • Migrate Module, for importing fixtures and migrating data whenever needed • Features Module, for exporting configuration into code
  • 21. ...and files! • .gitignore, for not tracking a good bunch of files we don’t need • drush make, for keeping track of the modules, themes and libraries to ues • build.xml, for describing all the actions Phing will have to take to build the website • build.ENV.properties, for storing environments variables used during the build process • behat.yml.dist, for storing Behat’s configurations
  • 22. Save the environment(s)! • local, the developer’s machine, where everyday work is done. • dev, a server where the CI actually happens. It gets rebuilt from scratch and throughly tested every time(ideally after every push on the repository) • stage, a server used to deploy “stable” dev snapshots at a given point in time, usually for letting the client tests on a more stable environment
  • 23. Save the environment(s)! • debug, a copy of the production environment (as faithful as possible), used for easily reproducing bugs happening on production and also to test deploys. • prod, the environment that hosts the final product, tuned and optimized for best performances.
  • 24. Let’s sum up a second Jenkins takes those logs and publishes the results Jenkins clones the repository and invokes Phing Phing performs the build of the website, upload the files and the database and finally launches the tests PHPUnit and Behat run the tests and log the results in JUnit format
  • 25. Time for some action! Go grab the code at http://github.com/agavee/drupal7-base
  • 26. You deserve some moar • http://www.slideshare.net/everzet/bdd-in-symfony2/ • http://www.slideshare.net/headrevision/web- acceptance-testing-with-behat/ • http://www.exampler.com/old-blog/2003/08/21/ • http://www.phpunit.de/manual/current/en/index.html • http://dannorth.net/whats-in-a-story/