Click to build, type to test: The surprisingly pleasant inverse world of Drupal 8 with Behat testing

Track: 
Site Building
Experience Level: 
Beginner

Writing tests with Behat and its Drupal Extension (which do not require you writing any code) can be an easy way to add powerful confirmation of features working as expected and peace of mind that they'll stay that way.

Also, I find I much prefer writing:

Given I am logged in as a user with the 'content_editor' role
When I go to "/node/add/page"
Then the response status code should be 200"

Rather than opening a new browser or private session window, logging in, clicking Add content, etc.

More importantly, I am more likely to actually do it before a client tries out the site and— "oh yeah sorry I just need to give you this permission OK hit reload".

Most importantly, each test stays and can be rerun regularly, on every push to the repository or even with continuous deployment as a step that must be passed successfully for the site to deploy.

This test only scratches the surface of what can be done.

Learning Objectives & Outcomes: 

We will learn how to set up Behat and Drupal Extension (with Composer of course), how to learn what steps are available to build tests out of, and how to write and run the tests.

Platinum Sponsors

Gold Sponsors