Skip to main content

Behat - Behavior Driven Development - Automated Testing

Proposed by John Bickar

Notes

Automated testing tool for websites.
Write user stories in plain english and run against a site.
Was useful in the recent Drupal security update patch.
Run on a machine with PHP and Behat
Write tests like:
FEATURE:
    ASA
    I WANT TO
    SO THAT
Run in 3 ways:
Black box: run on any website
Javascript: allows you to interact with elements on page
API: Drupal extension, allows behat to log into website and assume a role; integrates with Drush
AS AN ADMINISTRATOR
   I WANT TO COMPLETE ADMINISTRATION TASK
   SO THAT THE SITE DOESN”T BREAK
Testing is done with "step definitions" in the form:
SCENARIO: EDIT CONTENT
     GIVEN:
     AND:
     WHEN:
     THEN:
SWS Test Plans are available on github to use as starters.
SU-SWS/linky_clicky - old SWS QA
Use yml files to configure a test.
See SU-SWS/linky_clicky/provost for example
John B. ran through several example tests.
John B. will post some getting started notes with links and instructions.
John B. will also post on su-webmasters list.
Behat Installation Instructions
The easiest/best way to install is using the system-wide installation. These instructions include installing the Drupal extension, but should be valid just for using Behat as a standalone again. (from John B.)
SWS Behat Tests
Freely available on github