Skip to main content

The road to zero friction testing with Drupal Test Traits

Video: Testing can seem complicated, too much effort or a waste of time. It doesn’t have to be! I’ll show you how to reduce friction and get the most out of Drupal Test Traits.

by michael.strelan /

Drupal Test Traits is a composer package that allows you to run tests against an existing Drupal site with user content in place. This approach differs from traditional PHPUnit tests that require you to mock up an environment to test individual functionality.

In the video, I take you through the following ways to reduce the friction commonly experienced with traditional testing processes:

  • Getting started with Drupal Test Traits
  • Writing your first test
  • Building a library of project-specific traits
  • Maximising your test suite’s performance and reliability
  • Fostering a test culture in your development team

Watch the video

Questions? Let’s chat!

Drupal Slack: @mstrelan

Drupal.org: mstrelan

Related Articles

Introducing Drupal Testing Traits: Drupal extension for testing existing sites

Drupal allows writing tests for installation profiles. A profile can have sample content which is created during installation, like umami in Drupal core. Drupal allows writing tests for modules as well. A module can also have sample content which is created during installation or config import.

Drupal Testing Traits allows writing tests for an already installed site. A site with content types and content. You can write tests for the all the pages in your site in different viewports and test user interactions aka JavaScript tests.

DrupalCon Sydney: Writing Automated Tests for Drupal

Want to keep ahead of bugs and regressions in your code?
Want to stop other members on the team accidentally breaking your code?
Want to make deployments nice and smooth?
Perhaps you want to ramp up your core commits but are overwhelmed by testing?

Automated Drupal Testing with Github Pull Requests

We are passionate about code quality. We want to make sure our code is well tested and confirms to standards at all times. If there is a bug, we want to know as soon as possible, so we can fix it and keep our code stable, well tested and bug free, even in early development versions.

Typical workflows use a git topic branch for development of each feature, and require code to be merged into a development branch before automated tests are run. The problem with this approach is it tests code after it has been reviewed and merged.

Using Jenkins for automated testing of Github pull requests, we can get one step closer to code quality nirvana.