The Drupal Extension is an integration layer between Behat, Mink Extension, and Drupal. It provides step definitions for testing Drupal sites with Behavior-Driven Development.
- Installation - Requirements, Composer install, first run.
- Configuration -
behat.ymloptions, profiles,BEHAT_PARAMSenvironment variables. - Drivers - Capability matrix and choosing a driver.
- Blackbox - No privileged access; UI only.
- Drush - User and content creation via Drush.
- Drupal API - Direct Drupal API access.
- Contexts - Available context classes and how to compose them.
- Hooks -
@beforeNodeCreate,@beforeTermCreate,@beforeUserCreate. - Writing tests -
@apitagging, regions, custom contexts.
- Step definitions - Generated reference for every step shipped with the extension.
- Upgrading guide - Breaking changes and upgrade
instructions for
5.xto6.x. - Contributing - Development setup and contribution guidelines.
composer require --dev drupal/drupal-extensionCreate a minimal behat.yml:
default:
autoload: ['%paths.base%/tests/bootstrap']
suites:
default:
paths: ['%paths.base%/tests/features']
contexts:
- Drupal\DrupalExtension\Context\DrupalContext
extensions:
Drupal\MinkExtension:
browserkit_http: ~
base_url: http://example.org/
Drupal\DrupalExtension:
blackbox: ~Initialise Behat and list available steps:
vendor/bin/behat --init
vendor/bin/behat -diFor full setup details, see Installation.
