Behat (software)

Last updated
Developer(s) Konstantin Kudryashov
Initial release8 September 2010;13 years ago (2010-09-08) [1]
Stable release
3.13.0 / 18 April 2023;12 months ago (2023-04-18) [1]
Repository
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.

Contents

Purpose

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.

Benefits

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 used to directly test php code and is often used with Selenium to remote control browsers as part of the scenarios. The browsers under remote control can take videos [3] or screenshots of failures. Using selenium or tools like selenoid [4] a "grid" of browsers can be remote controlled for parallel test execution. There is also a module for running php only scenarios. [5]

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

Behat can output test results in a number of different formats, including JUnit XML and HTML [7]

Examples

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

Feature: Simple description of this feature’s story  Describe benefit, role and feature or user story  Use as many lines as neededBackground:    Given some step run for all scenariosScenario: Scenario or example description    Given I setup preconditions with:      | data column 1 | data column 2 |      | alice         | bob           |When I press the "blue" buttonThen the result is:"""    A multiple line    string of data"""    #comments can be added as neededScenario Outline: Scenario or example description    Given I setup config with "<setting>"When I push button "<button>"Then "<result>" happensExamples:      | setting | button | result           |      | a       | red    | there is a beep  |      | b       | blue   | there is no beep |

Related Research Articles

<span class="mw-page-title-main">Acceptance testing</span> Test to determine if the requirements of a specification or contract are met

In engineering and its various subdisciplines, acceptance testing is a test conducted to determine if the requirements of a specification or contract are met. It may involve chemical tests, physical tests, or performance tests.

In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program to process HTTP or HTTPS user requests.

<span class="mw-page-title-main">Design by contract</span> Approach for designing software

Design by contract (DbC), also known as contract programming, programming by contract and design-by-contract programming, is an approach for designing software.

In software testing, test automation is the use of software separate from the software being tested to control the execution of tests and the comparison of actual outcomes with predicted outcomes. Test automation can automate some repetitive but necessary tasks in a formalized testing process already in place, or perform additional testing that would be difficult to do manually. Test automation is critical for continuous delivery and continuous testing.

gPHPedit is a discontinued UTF-8-compatible IDE for web development in PHP using the GNOME desktop environment. gPHPedit is built using Scintilla. It was originally written by Andy Jeffries, and was maintained by Anoop John. It is similar to gedit with the difference that it is designed for PHP and HTML text editing. The last version is 0.9.91, released on July 5, 2006. It is free software licensed under the terms of the GNU General Public License (GPL),

Zend Studio is a commercial, proprietary integrated development environment (IDE) for PHP developed by Zend Technologies, based on the PHP Development Tools (PDT) plugin for the Eclipse platform.

Behavior-driven development (BDD) involves naming software tests using domain language to describe the behavior of the code.

Selenium is an open source umbrella project for a range of tools and libraries aimed at supporting browser automation. It provides a playback tool for authoring functional tests across most modern web browsers, without the need to learn a test scripting language. It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including JavaScript (Node.js), C#, Groovy, Java, Perl, PHP, Python, Ruby and Scala. Selenium runs on Windows, Linux, and macOS. It is open-source software released under the Apache License 2.0.

Azure DevOps Server, formerly known as Team Foundation Server (TFS) and Visual Studio Team System (VSTS), is a Microsoft product that provides version control, reporting, requirements management, project management, automated builds, testing and release management capabilities. It covers the entire application lifecycle and enables DevOps capabilities. Azure DevOps can be used as a back-end to numerous integrated development environments (IDEs) but is tailored for Microsoft Visual Studio and Eclipse on all platforms.

EGroupware is free open-source groupware software intended for businesses from small to enterprises. Its primary functions allow users to manage contacts, appointments, projects and to-do lists. The project releases its software under the terms of GNU General Public License (GPL).

Cucumber is a software tool that supports behavior-driven development (BDD). Central to the Cucumber BDD approach is its ordinary language parser called Gherkin. It allows expected software behaviors to be specified in a logical language that customers can understand. As such, Cucumber allows the execution of feature documentation written in business-facing text. It is often used for testing other software. It runs automated acceptance tests written in a behavior-driven development (BDD) style.

ownCloud Free software for cloud computing

ownCloud is a free and open-source software project for content collaboration and sharing and syncing of files in distributed and federated enterprise scenarios. It allows companies and remote end-users to organize their documents on servers, computers, and mobile devices and work with them collaboratively while keeping a centrally organized and synchronized state.

<span class="mw-page-title-main">Robot Framework</span> Type of test automation framework

Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD). It is a keyword-driven testing framework that uses tabular test data syntax.

<span class="mw-page-title-main">Kivy (framework)</span> Free and multi-platform graphical library for Python

Kivy is a free and open source Python framework for developing mobile apps and other multitouch application software with a natural user interface (NUI). It is distributed under the terms of the MIT License, and can run on Android, iOS, Linux, macOS, and Windows.

Acceptance test–driven development (ATDD) is a development methodology based on communication between the business customers, the developers, and the testers. ATDD encompasses many of the same practices as specification by example (SBE), behavior-driven development (BDD), example-driven development (EDD), and support-driven development also called story test–driven development (SDD). All these processes aid developers and testers in understanding the customer's needs prior to implementation and allow customers to be able to converse in their own domain language.

A headless browser is a web browser without a graphical user interface.

Capybara is a web-based test automation software that simulates scenarios for user stories and automates web application testing for behavior-driven software development. It is written in the Ruby programming language.

gRPC is a cross-platform open source high performance remote procedure call (RPC) framework. gRPC was initially created by Google, which used a single general-purpose RPC infrastructure called Stubby to connect the large number of microservices running within and across its data centers from about 2001. In March 2015, Google decided to build the next version of Stubby and make it open source. The result was gRPC, which is now used in many organizations aside from Google to power use cases from microservices to the "last mile" of computing. It uses HTTP/2 for transport, Protocol Buffers as the interface description language, and provides features such as authentication, bidirectional streaming and flow control, blocking or nonblocking bindings, and cancellation and timeouts. It generates cross-platform client and server bindings for many languages. Most common usage scenarios include connecting services in a microservices style architecture, or connecting mobile device clients to backend services.

<span class="mw-page-title-main">Katalon Studio</span> Automation testing software tool

Katalon Platform is an automation testing software tool developed by Katalon, Inc. The software is built on top of the open-source automation frameworks Selenium, Appium with a specialized IDE interface for web, API, mobile and desktop application testing. Its initial release for internal use was in January 2015. Its first public release was in September 2016. In 2018, the software acquired 9% of market penetration for UI test automation, according to The State of Testing 2018 Report by SmartBear.

References

  1. 1 2 "Behat/CHANGELOG.md at master · Behat/Behat". github.com. Retrieved 2021-03-27.
  2. "Cucumber Common Components". GitHub . 14 November 2021.
  3. community, Alexander Andryashin, Ivan Krutov, Kirill Merkushev and the Aerokube. "Aerokube Selenoid | A cross browser Selenium solution for Docker". aerokube.com. Retrieved 2024-02-19.{{cite web}}: CS1 maint: multiple names: authors list (link)
  4. aerokube/selenoid, Aerokube, 2024-02-17, retrieved 2024-02-19
  5. Marynicz, Daniel (2023-11-17), Daniel-Marynicz/BehatParallelExtension , retrieved 2024-02-19
  6. BDD With Behat - Tuts+ Code Tutorial. Code.tutsplus.com (2013-12-23). Retrieved on 2015-03-19.
  7. Vanmeert, Neal (2024-01-24), dutchiexl/BehatHtmlFormatterPlugin , retrieved 2024-02-19