Skip to content

Latest commit

 

History

History
66 lines (53 loc) · 2.06 KB

File metadata and controls

66 lines (53 loc) · 2.06 KB
Behat Drupal Extension Logo

Drupal Extension Documentation

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.

Contents

  1. Installation - Requirements, Composer install, first run.
  2. Configuration - behat.yml options, profiles, BEHAT_PARAMS environment variables.
  3. 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.
  4. Contexts - Available context classes and how to compose them.
  5. Hooks - @beforeNodeCreate, @beforeTermCreate, @beforeUserCreate.
  6. Writing tests - @api tagging, regions, custom contexts.

Reference material

  • Step definitions - Generated reference for every step shipped with the extension.
  • Upgrading guide - Breaking changes and upgrade instructions for 5.x to 6.x.
  • Contributing - Development setup and contribution guidelines.

Quick start

composer require --dev drupal/drupal-extension

Create 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 -di

For full setup details, see Installation.