Behat - a collaborative specification tool¶
Feature: Prove that software meets my business expectations In order to know when I have correctly implemented a feature As a PHP developer I want a tool to execute tests based on the agreed specificationsBackground: GivenI have discussed a feature with the product teamAnd we have agreed a set of requirements in plain languageScenario: Work is complete GivenI have correctly implemented the featureWhen I run Behat with our specificationsThen I should see that the software behaves as expected
Behat is an open sourceBehaviour Driven Development tool for building software thatmeets your business expectations.
It is the PHP implementation ofCucumber, to execute specifications inplain languagethatanyone on your team can read. This improvescommunication,collaborationandtrust, giving you the confidence to build the right system from the start and tomaintain it over time.
Read the quick start guide Explore the documentationCover your whole application¶
Behat helps you to focus on business expectations and user-facing behaviour. This isvery different to many test runners, where tests become tied to implementations andto individual layers of your stack.
With Behat, your feature files can describe the whole behaviour of your application.You then have total freedom to decide how to implement the code that provesthe application works as expected.
This allows you to “mix and match” different testing approaches and technologies.Browser automation; HTTP API calls; running shell commands; communicating directlywith your database, filesystem or PHP code: anything is possible.
You can even use profiles, tags and suites to test the same features in different ways.For example, a quick regression test that directly calls your API handlers in PHP,or a more thorough test over HTTP when you’ve made bigger changes. It’s all up to you!
Built for PHP, for any framework¶
Behat is a well structured PHP library designed for use with any framework (or none).Internally, the codebase uses Symfony components, but you will find it easy to use inany PHP project.
Behat provides flexible and developer-friendly interfaces for your tests, followsmodern coding standards and scores high ratings in static analysis tools.
And of course, all ofBehat’s features are specified in plain language and tested with Behat!
Extensible to the core¶
Behat was built from the ground up to be extensible. Almost every part of Behat’s functionalitycan be enhanced or replaced through the extension system.
There are a wide range ofextensions already available. These include integrations withcommon PHP application frameworks, browser automation, test result reporters, data fixturesand many more.
Behat