Behat (computer science)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Behat
Behat-11.png
Developer(s) Konstantin Kudryashov
Initial release 10 September 2010; 7 years ago (2010-09-10)[1]
Stable release
3.3.0 / 25 December 2016; 18 months ago (2016-12-25)[2]
Written in PHP
Operating system Cross-platform
Type Behavior-driven development
License MIT License
Website behat.org

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.

Purpose[edit]

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,[3] a business-readable domain-specific language following defined patterns.[4]

Benefits[edit]

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.[5]

Examples[edit]

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
        ...

References[edit]

External links[edit]