Simple testing your Drupal site using Behat

BTMash

I don't know about you but I've had this conversation with clients many times where:

  • We have a dev site with stale outdated data. The developer asks if the changes look good. When the PM responds to deploy the changes and they are deployed, the developer is asked to live-fix the live website because the feature is no longer working correctly.
  • We are developing some new features for the website. The developer asks if the changes look good. When the PM responds to deploy the changes and they are deployed, the developer is asked to fix an unrelated feature because the new feature broke existing functionality on the website.

 

And when the developer asks if we can add testing to the site, the budget to add testing does not exist.

Now imagine:

  • Instead of 2 feature requests above, we have over 4000 requested features over the lifetime of the project.
  • Instead of a site with a few pages and administrative users, we are dealing with over 100,000 pieces of content and over 50,000 customers.
  • In the span of trying to release a fix for your feature requests, over 40 hours get spent debugging the underlying issue.

 

I'm here to show how *not* testing chews up more budget, resources, and sanity than not adding any testing. And I want to show how easy it is to add testing to a drupal website (including a short demo of how I was able to perform a basic response check of over 400 links on my site) in under 20 minutes. We'll go through how to integrate drupal with behat (and headless chrome), how to write basic scenarios, and how to extend with your own custom checks. You will hopefully come out with a better appreciation for why testing is so important and the knowledge to start at it for your own projects.

Program tags

back end development, culture, testing

Experience Level

Beginner

Drupal Version