Behat (computer science)

Print Print
Reading time 3:25

Developer(s)Konstantin Kudryashov
Initial release8 September 2010; 10 years ago (2010-09-08)[1]
Stable release
3.8.1 / 7 November 2020; 7 months ago (2020-11-07)[1]
Repository Edit this at Wikidata
Written inPHP
Operating systemCross-platform
TypeBehavior-driven development
LicenseMIT License

Behat is a test framework for behavior-driven development written in the PHP programming language. Behat was created by Konstantin Kudryashov and its development is hosted on GitHub.


Behat is intended to aid communication between developers, clients and other stakeholders during a software development process. It allows the clear documentation of testable examples of the software's intended behaviour. Behat test scenarios are written with Gherkin,[2] a business-readable domain-specific language following defined patterns.


Tests can be run at any point new code is introduced into a codebase to confirm no regressions within the existing test coverage are introduced. It can be integrated with Selenium and other browser emulators to generate screenshots of failures. Like other BDD frameworks, Behat scenarios are a series of Given, When, and Then steps that explain a business case. The definition of these steps exist within method annotations of a class that extends the BehatContext.[3]


The preconditions after "Given" correspond to the PHP method name to execute:

Feature: Function to test description

    Free text

    Scenario: Scenario 1
        Given preconditions
        When actions
        Then results

    Scenario: Scenario 2


  1. ^ a b "Behat/ at master · Behat/Behat". Retrieved 2021-03-27.
  2. ^
  3. ^ BDD With Behat - Tuts+ Code Tutorial. (2013-12-23). Retrieved on 2015-03-19.

External links

Edited: 2021-06-18 14:11:54