Automated testing and test driven development in Drupal 8

Profile picture for user oliver

Oliver Davies (@opdavies) has been building websites since 2007, and speaking at meetups and conferences since 2012. He is a Full Stack Developer and an Acquia certified Drupal Grand Master, who also has experience developing with Symfony, Laravel, Sculpin and Vue.js, as well as with DevOps and systems administration.

He is a Senior Software Engineer and Technical Team Lead at Inviqa, a Drupal core contributor and mentor, and an open source and contribution advocate.

He regularly blogs and gives talks on various topics, maintains and contributes to various open source projects, and organises the PHP South Wales user group.

Starts at
Ends at

Testing is important... Why? It allows developers to add new features and edit and refactor existing code without the worry of adding regressions, reduces the reliance on manual testing to discover bugs, and by taking a test driven approach, your implementation code is leaner and easier to maintain.

Since Drupal 8, Drupal has shipped with PHPUnit and uses it for its unit, integration and functional tests. Also, with testing as one of the Drupal core gates, with tests needing to be included with every new feature or bug fix, and core’s 100% pass rate policy, testing has become an essential skill when contributing to core, or when working on your own projects.

In this workshop, we’ll cover the methodology, approaches and terminology involved with automated testing, look at some examples and work through some exercises, and then take a test driven development approach to creating a new Drupal module.

Following this workshop, attendees should:

  • Know what types of tests are available in Drupal 8
  • Understand the different approaches to testing
  • Know how to add tests to existing code
  • Understand the concepts of test driven development (TDD) and how to use apply them when writing new code


  • A good working knowledge of Drupal and PHP
  • A laptop with a local copy of Drupal 8 for running tests locally
  • Recommended: PhpStorm or Visual Studio Code for editing code
Courtesy of