Behat lets you write tests as plain-English scenarios, then runs them against your site:
Feature: Contact page
Scenario: Visitor finds the contact page
When I visit "/contact"
Then the response status code should be 200
And I should see the heading "Contact"Behat can only run a step once some PHP code stands behind it, and Behat Steps is that code, already written and tested. It ships steps that work on any website and steps that only mean something on a Drupal site. Every step is a thin wrapper over named helpers, which your own steps can call too.
- Web and Drupal steps for pages, forms, APIs, email, caches, content and more, with an example for each.
- Helpers behind every step, for the steps you write in your project's own words.
- Backends picked by capability, so a step runs in-process or through Drush.
- Support for Behat 3.33+ and Behat 4, Drupal 11 and 12, and PHP 8.3 to 8.5.
- BrowserKit, Selenium and Chrome DevTools browser drivers.
- Cleanup of the entities a scenario creates.
- Step and helper references that ship with the package, for AI coding agents, and a skill that has the agent write a step of your own on the helpers.
composer require --dev drevops/behat-steps:^4Composer installs Behat, Mink and the rest of what the steps run on along with it. A few steps need a package of their own, which Behat Steps suggests rather than requires:
softcreatr/jsonpathandjustinrainbow/json-schemafor the JSON path and JSON schema steps.lullabot/mink-selenium2-driverordmore/behat-chrome-extensionfor@javascriptscenarios, which drive a real browser.
The Quick start takes you from here to a passing scenario, and Installation covers the optional dependencies and the JavaScript browser drivers. New to Behat? Key concepts explains its moving parts in plain words.
MIGRATION.md takes a project from 3.14 to 4.0, and an AI coding agent can apply it for you. Migrating from 3.x shows how.
The step and helper references ship with the package as STEPS.md and HELPERS.md, so a coding agent in your project reads them from vendor/drevops/behat-steps/. The create-behat-step skill ships beside them: describe a step, and your agent writes it on the helpers, in a trait your FeatureContext uses. Writing tests with AI assistants has a snippet for your CLAUDE.md or AGENTS.md, and shows how to install the skill.
Contributions are welcome. CONTRIBUTING.md holds the rules for code in this repository and the local development setup. The documentation site's Contributing section walks through a code change and writing the docs.
This repository was created using the Scaffold project template
