Automated testing with Drupal and PHPSpec

Session speaker(s): Kevin McCulloch

Like many Drupal teams, the CSRA/New Target web team at the Administrative Office of the US Courts is working to bring automated testing into our development and maintenance workflow. In this talk, I'll share our current thinking on the following issues:

1. Why behavior-driven development is essential
2. Limits of using the Behat Drupal Extension for behavior-driven development
3. Why even the best behavior-driven development practices will not guarantee full regression test coverage

I will then demonstrate our behavior-driven development tool of choice, PHPSpec, and explain how to write Drupal 7 hooks that can be tested without bootstrapping Drupal.

This presentation was first given at 2016's Drupal GovCon in Washington, DC and it has evolved as I've spoken to other test-writers in the Drupal development community. Are you doing automated testing? What kinds of tests do you write? Have you found some tests to be more helpful than others? Does the benefit of writing tests offset the expense of maintaining them? Please come and share your experiences!

Slides:
https://docs.google.com/presentation/d/1hyIL9Jl6ZmKm0boyUqEKUVu3zDmvFAIC...

Code:
https://github.com/kmcculloch/block_example_phpspec

https://2016.badcamp.net/session/automated-testing-drupal-and-phpspec

Drupal is a registered trademark of Dries Buytaert.