Behat for Beginners: Automated Testing in 5 Easy Steps

Cameron Hall, a product owner at Bixal, gave a Behat session at the 2017 Drupal GovCon in Bethesda, Maryland. At the session, attendees gained a run-down of Behat testing: what can it be used for? Is it right for my situation? Helping answer these key questions will work towards assessing their baseline. The presentation worked with attendees to answer other essential components of defining their baseline, such as how builds play out, main components of the site, how user roles and permissions are structured, etc.

 

Cameron Hall in his Behat session

 

For successful testing, remember to:

1. Define your baseline, and what you need to test

Is your site a series of forms? Should you run a submission with each code change? Is your site heavily permissions based? Should you check all roles with each code change?

2. Define how you will manage this

Will you be using a build service like Jenkins or TFS? Or are you one developer pushing code through environments?

3. Define how you need your results

Would you like results with every change that you commit, when packages are built for deployment, hourly, monthly?

4. Build it into your process

If you work in sprints, build it into your integration and user acceptance testing time. If you work in waterfall, it is an excellent tool for regression throughout the phases of the project

5. Share and interact with the community

Take advantage of the hard work of others who have mastered Selenium, or give away a test case that you're proud of so others can benefit

 

An example of Behat test steps and scenarios for a standard content type feature from the command line.
An example of Behat test steps and scenarios for a standard content type feature from the command line.

 

HELPFUL LINKS:

 

PRESENTATION:

Behat for Beginners: Automated Testing in 5 Easy Steps

RECORDED SESSION:

Watch here