The Drupal Extension is an integration layer between Behat, Mink Extension, and Drupal. It provides step definitions for common testing scenarios specific to Drupal sites.
The Drupal Extension 5.x supports Drupal 9 and 10, utilizes Behat 3.2+ and runs on:
If you're new to the Drupal Extension, we recommend starting with the Full documentation
Install using Composer:
mkdir projectdir
cd projectdir
curl -sS https://getcomposer.org/installer | php
COMPOSER_BIN_DIR=bin php composer.phar require drupal/drupal-extension='~5.0'
In the projectdir, create a file called behat.yml
. Below is the
minimal configuration. Many more options are covered in the
Full documentation
default:
suites:
default:
contexts:
- Drupal\DrupalExtension\Context\DrupalContext
extensions:
Drupal\MinkExtension:
# Guzzle is used as HTTP client. You can configure the Guzzle request
# options by setting `browserkit_http.guzzle_request_options`. For
# instance the following configuration will disable SSL peer verification:
# browserkit_http:
# guzzle_request_options:
# verify: false
# See \GuzzleHttp\RequestOptions for all built-in Guzzle request options
browserkit_http: ~
base_url: http://example.org/ # Replace with your site's URL
Drupal\DrupalExtension:
blackbox: ~
In the projectdir, run
bin/behat --init
Find pre-defined steps to work with using:
bin/behat -di
Define your own steps in projectdir\features\FeatureContext.php
Start adding your feature files
to the features
directory of your repository.
See CHANGELOG.
Features and bug fixes are welcome! First-time contributors can jump in with the issues tagged good first issue.
See CONTRIBUTING.md for more information.