Acceptance & Integration Testing Using Behat

Behat is a behaviour driven development framework for PHP. It can be used to write integration and acceptance tests in a language that non developers can understand. Behat is capable of testing the response from API calls, driving selenium or even testing the output from PHP scripts. It isn’t a replacement to unit testing, but the logical next step to ensure your code plays well with others.

At SkyBet we have used Behat to streamline the process of defining acceptance criteria, creating acceptance tests and using them to drive our development. Behat co-ordinates our BAs, testers and developers and focuses them on producing the required software in a testable way.

This talk starts with a brief introduction to behaviour driven development followed by a look at Gherkin, the language used by Behat to write human readable test scenarios. Also included is an overview of how to write ‘steps’: the PHP that powers the testing of scenarios. Finally some ideas are presented on how to display the data gained from running the tests in interesting ways..