PHPackages                             drupal/drupal-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. drupal/drupal-extension

ActiveBehat-extension[Testing &amp; Quality](/categories/testing)

drupal/drupal-extension
=======================

Drupal extension for Behat

v6.0.0(1w ago)21215.5M↓44.4%192[8 issues](https://github.com/jhedstrom/drupalextension/issues)20GPL-2.0-or-laterPHPPHP &gt;=8.2CI passing

Since Jul 26Pushed 1w ago24 watchersCompare

[ Source](https://github.com/jhedstrom/drupalextension)[ Packagist](https://packagist.org/packages/drupal/drupal-extension)[ Docs](http://drupal.org/project/drupalextension)[ GitHub Sponsors](https://github.com/jhedstrom)[ RSS](/packages/drupal-drupal-extension/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (164)Versions (157)Used By (20)

  ![Behat Drupal Extension Logo](docs/assets/beehat.png)

Behat Drupal Extension
======================

[](#behat-drupal-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/78d3fbcdfc4a717a18d3b5d0cfe05e5d2703b59fac7288c29afdd2ad4cfcc40f/68747470733a2f2f706f7365722e707567782e6f72672f64727570616c2f64727570616c2d657874656e73696f6e2f762f737461626c652e737667)](https://packagist.org/packages/drupal/drupal-extension)[![Total Downloads](https://camo.githubusercontent.com/f2e1e51a961b3d1af80d631bf65c0d3f90a4aa01eadcee890af5ae5dbc316add/68747470733a2f2f706f7365722e707567782e6f72672f64727570616c2f64727570616c2d657874656e73696f6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/drupal/drupal-extension)[![Latest Unstable Version](https://camo.githubusercontent.com/3a58d1bf91b187a7374ef25a8f2e7f8617aa59d32c1d286d0036b856c6e34c70/68747470733a2f2f706f7365722e707567782e6f72672f64727570616c2f64727570616c2d657874656e73696f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/drupal/drupal-extension)[![License](https://camo.githubusercontent.com/4e468b66f72b1e9a1e7305d0b7966316e51708487ab71855e6577727140d22f6/68747470733a2f2f706f7365722e707567782e6f72672f64727570616c2f64727570616c2d657874656e73696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/drupal/drupal-extension)

[![ci](https://github.com/jhedstrom/drupalextension/actions/workflows/ci.yml/badge.svg)](https://github.com/jhedstrom/drupalextension/actions/workflows/ci.yml)[![GitHub Issues](https://camo.githubusercontent.com/8d695f92ef0811b29f5e7b756b0eed83b3174597bcc7f74c9f27818d1565b770/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6a6865647374726f6d2f64727570616c657874656e73696f6e2e737667)](https://github.com/jhedstrom/drupalextension/issues)[![GitHub Pull Requests](https://camo.githubusercontent.com/41a0f66a5955ed56cafd589216c10b9d1b92ec85473f4b494ce4f2798d9b0616/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6a6865647374726f6d2f64727570616c657874656e73696f6e2e737667)](https://github.com/jhedstrom/drupalextension/pulls)[![Join our community](https://camo.githubusercontent.com/d0bc3521ba40d2b454138bc886ecbd5236834d0ffbcc3b1bad5a66aac5b31c0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a6f696e2532306f7572253230636f6d6d756e6974792d536c61636b2d3441313534423f7374796c653d666f722d7468652d6261646765266c6f676f3d736c61636b266c6f676f436f6c6f723d7768697465)](https://drupal.slack.com/archives/C4T2JHG9K)

The Drupal Extension is an integration layer between [Behat](http://behat.org), [Mink Extension](https://github.com/Behat/MinkExtension), and [Drupal](https://www.drupal.org/). It provides step definitions for common testing scenarios specific to Drupal sites.

> **Note:** v6 supports Drupal 10 and 11 on PHP 8.2+ and runs on DrupalDriver `3.x`. Sites that need Drupal 7 or PHP 8.1 should pin to the [`5.x` branch](https://github.com/jhedstrom/drupalextension/tree/5.x). See [`UPGRADING.md`](UPGRADING.md) for the v5 to v6 migration guide.

Use it for testing your Drupal site.
------------------------------------

[](#use-it-for-testing-your-drupal-site)

If you're new to the Drupal Extension, we recommend starting with the [full documentation](docs/README.md).

### Quick start

[](#quick-start)

1. Install using [Composer](https://getcomposer.org/):

    ```
    composer require --dev drupal/drupal-extension
    ```
2. Create a file called `behat.yml` with a minimal configuration. For more information on configuration options, see the [configuration guide](docs/configuration.md).

    ```
    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/  # Replace with your site's URL
        Drupal\DrupalExtension:
          blackbox: ~
    ```
3. Initialize Behat in your project:

    ```
    vendor/bin/behat --init
    ```
4. Find pre-defined steps to work with using:

    ```
    vendor/bin/behat -di
    ```
5. Optionally, define your own steps in `tests/bootstrap/FeatureContext.php`
6. Start adding your [feature files](http://behat.org/en/latest/user_guide/gherkin.html)to the `tests/features` directory of your repository.

Available steps
---------------

[](#available-steps)

ClassDescription[ConfigContext](STEPS.md#configcontext)Provides pre-built step definitions for interacting with Drupal config.[DrupalContext](STEPS.md#drupalcontext)Provides pre-built step definitions for interacting with Drupal.[DrushContext](STEPS.md#drushcontext)Provides step definitions for interacting directly with Drush commands.[MailContext](STEPS.md#mailcontext)Provides pre-built step definitions for interacting with mail.[MarkupContext](STEPS.md#markupcontext)Extensions to the Mink Extension.[MessageContext](STEPS.md#messagecontext)Provides step-definitions for interacting with Drupal messages.[MinkContext](STEPS.md#minkcontext)Extensions to the Mink Extension.Writing tests with AI assistants
--------------------------------

[](#writing-tests-with-ai-assistants)

Copy and paste below into your project's `CLAUDE.md` or `AGENTS.md` file.

```
## Writing Behat Tests

Available step definitions are listed in `STEPS.md`.
Read this file before writing or modifying Behat tests.
Use only step patterns from this file. Do not invent steps.

If `STEPS.md` does not exist or is outdated, regenerate it:

    vendor/bin/behat -di > STEPS.md

Regenerate after adding new Context classes or updating dependencies.

For detailed step documentation, see: vendor/drupal/drupal-extension/STEPS.md

```

Credits
-------

[](#credits)

- Originally developed by [Jonathan Hedstrom](https://github.com/jhedstrom) with great help from [eliza411](https://github.com/eliza411)
- Maintainers
    - [Alex Skrypnyk](https://github.com/AlexSkrypnyk)
    - [Pieter Frenssen](https://github.com/pfrenssen)
    - [Ricardo Sanz](https://github.com/rsanzante)
    - [All these great contributors](https://github.com/jhedstrom/drupalextension/graphs/contributors)

Additional resources
--------------------

[](#additional-resources)

- [Behat Drupal Extension documentation](docs/README.md)
- [Behat documentation](http://docs.behat.org)
- [Mink documentation](http://mink.behat.org)
- [Drupal Behat group](http://groups.drupal.org/behat)

Examples and code snippets
--------------------------

[](#examples-and-code-snippets)

- [Complex node creation, with field collections and entity references](https://gist.github.com/jhedstrom/5708233)
- [Achievements module support](https://gist.github.com/jhedstrom/9633067)
- [Drupal form element visibility](https://gist.github.com/pbuyle/7698675)
- [Track down PHP notices](https://www.godel.com.au/blog/use-behat-track-down-php-notices-they-take-over-your-drupal-site-forever)
- [Support for sites using basic HTTP authentication](https://gist.github.com/jhedstrom/5bc5192d6dacbf8cc459)

Release notes
-------------

[](#release-notes)

See [GitHub Releases](https://github.com/jhedstrom/drupalextension/releases).

Contributing
------------

[](#contributing)

Features and bug fixes are welcome!

See [CONTRIBUTING.md](https://github.com/jhedstrom/drupalextension/blob/master/CONTRIBUTING.md) for more information.

###  Health Score

80

—

ExcellentBetter than 100% of packages

Maintenance97

Actively maintained with recent releases

Popularity67

Solid adoption and visibility

Community52

Growing community involvement

Maturity94

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~61 days

Recently: every ~10 days

Total

83

Last Release

12d ago

Major Versions

v3.4.1 → v4.0.0alpha12017-12-06

3.4.x-dev → v4.0.0beta22018-12-19

3.1.x-dev → v4.0.0rc12019-07-25

4.2.x-dev → v5.0.0alpha12022-12-27

v5.4.0 → v6.0.0-alpha12026-05-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/a753aefee83a2962b5962cd13c64b377eaeb1e5950e4e2ecc11f773bdebac440?d=identicon)[jhedstrom](/maintainers/jhedstrom)

---

Top Contributors

[![jhedstrom](https://avatars.githubusercontent.com/u/76833?v=4)](https://github.com/jhedstrom "jhedstrom (884 commits)")[![pfrenssen](https://avatars.githubusercontent.com/u/442924?v=4)](https://github.com/pfrenssen "pfrenssen (164 commits)")[![AlexSkrypnyk](https://avatars.githubusercontent.com/u/378794?v=4)](https://github.com/AlexSkrypnyk "AlexSkrypnyk (125 commits)")[![claudiu-cristea](https://avatars.githubusercontent.com/u/473868?v=4)](https://github.com/claudiu-cristea "claudiu-cristea (63 commits)")[![eliza411](https://avatars.githubusercontent.com/u/216054?v=4)](https://github.com/eliza411 "eliza411 (31 commits)")[![ademarco](https://avatars.githubusercontent.com/u/153362?v=4)](https://github.com/ademarco "ademarco (23 commits)")[![jonathanjfshaw](https://avatars.githubusercontent.com/u/3512385?v=4)](https://github.com/jonathanjfshaw "jonathanjfshaw (22 commits)")[![dawehner](https://avatars.githubusercontent.com/u/29678?v=4)](https://github.com/dawehner "dawehner (19 commits)")[![Berdir](https://avatars.githubusercontent.com/u/40826?v=4)](https://github.com/Berdir "Berdir (18 commits)")[![greg-1-anderson](https://avatars.githubusercontent.com/u/612191?v=4)](https://github.com/greg-1-anderson "greg-1-anderson (13 commits)")[![cboyden](https://avatars.githubusercontent.com/u/725267?v=4)](https://github.com/cboyden "cboyden (13 commits)")[![jose-carmona](https://avatars.githubusercontent.com/u/2102206?v=4)](https://github.com/jose-carmona "jose-carmona (10 commits)")[![webflo](https://avatars.githubusercontent.com/u/123946?v=4)](https://github.com/webflo "webflo (9 commits)")[![subhojit777](https://avatars.githubusercontent.com/u/1435641?v=4)](https://github.com/subhojit777 "subhojit777 (6 commits)")[![xurizaemon](https://avatars.githubusercontent.com/u/105608?v=4)](https://github.com/xurizaemon "xurizaemon (5 commits)")[![aronbeal](https://avatars.githubusercontent.com/u/2242035?v=4)](https://github.com/aronbeal "aronbeal (5 commits)")[![clemens-tolboom](https://avatars.githubusercontent.com/u/371014?v=4)](https://github.com/clemens-tolboom "clemens-tolboom (5 commits)")[![tanarurkerem](https://avatars.githubusercontent.com/u/1073944?v=4)](https://github.com/tanarurkerem "tanarurkerem (5 commits)")[![haringsrob](https://avatars.githubusercontent.com/u/866743?v=4)](https://github.com/haringsrob "haringsrob (4 commits)")[![LionsAd](https://avatars.githubusercontent.com/u/354804?v=4)](https://github.com/LionsAd "LionsAd (4 commits)")

---

Tags

behatbehat-extensiondrupalphptestwebdrupal

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/drupal-drupal-extension/health.svg)

```
[![Health](https://phpackages.com/badges/drupal-drupal-extension/health.svg)](https://phpackages.com/packages/drupal-drupal-extension)
```

###  Alternatives

[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.0M321](/packages/drupal-core-dev)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[drevops/behat-steps

Collection of steps for Behat

26409.9k4](/packages/drevops-behat-steps)[zenstruck/browser

A fluent interface for your Symfony functional tests.

2262.5M37](/packages/zenstruck-browser)[friends-of-behat/mink-extension

Mink extension for Behat

14035.9M549](/packages/friends-of-behat-mink-extension)[drupal/drupal-driver

A collection of reusable Drupal drivers

6816.2M23](/packages/drupal-drupal-driver)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
