behat
BDD testing framework for PHP
TLDR
SYNOPSIS
behat [options] [featurefile_]
DESCRIPTION
behat is a BDD (Behavior-Driven Development) framework for PHP that tests business expectations using human-readable scenarios. It is the PHP implementation of Cucumber, using Gherkin syntax to define test scenarios.Behat allows teams to describe application behavior in plain language that developers, QA, and stakeholders can all understand. Scenarios are written in feature files and executed against step definitions implemented in PHP.
PARAMETERS
--init
Initialize a new Behat project with the necessary directory structure--tags value
Run only scenarios with matching tags (e.g., @smoke, @regression)--name value
Run only feature elements whose name matches the given string or regex-f, --format value
Output formatter: pretty (default), progress, junit--out value
Write output to a file or directory--snippets-for value
Generate step definition snippets for undefined steps--append-snippets
Append generated snippets to context files-v, --verbose
Increase verbosity of output--colors / --no-colors
Force colored or non-colored output-s, --suite value
Run only the specified test suite-p, --profile value
Use a specific configuration profile-c, --config value
Use a specific configuration file (default: behat.yml or behat.yml.dist)--dry-run
Invoke formatters without actually executing tests or hooks--stop-on-failure
Stop processing on the first failed scenario--rerun
Re-run only the scenarios that failed in the previous run--strict
Fail the run unless every test explicitly passes (treat undefined/pending as failures)
CAVEATS
Current Behat 3.x requires PHP 8.2 or higher (older 3.x releases ran on PHP 5.3.1+). Feature files must use Gherkin syntax with proper indentation. Step definitions must be unique; duplicate definitions cause ambiguity errors. The default context file is FeatureContext.php in features/bootstrap/.
HISTORY
Behat was created by Konstantin Kudryashov (everzet) in 2010 as the PHP port of Cucumber. It became the de facto BDD testing framework for PHP, widely adopted in the Symfony and Drupal communities for acceptance testing.
