Behat Tests: Automated Acceptance Testing for Drupal
Last updated: March 2026 · Reading time: 7 minutes
"As an editor, I want to create and publish an article." That is not a requirements document — that is a Behat test. Behat formulates tests in natural language and runs them automatically against your Drupal website.
What Behat Is and How It Works
Behat implements the Gherkin syntax: tests are written as scenarios in Given-When-Then form. "Given I am logged in as an editor, When I create a new article, Then I see the success message."
These scenarios are readable for all project stakeholders — not just developers. Product owners, project managers, and editors immediately understand what is being tested.
The Drupal Extension for Behat comes with pre-built step definitions: create users, log in, create content, check regions, and fill out forms.
Behat in Drupal Practice
Login and permissions. Test whether different roles see the right pages and can perform the right actions. An administrator sees different options than an editor.
Content workflows. Creating, editing, approving, and deleting content — automatically verified after each deployment.
Forms. Contact forms, application forms, and other input masks are tested for correct validation and processing.
Multilingual. Test whether language switching, URL aliases, and translated content work correctly.
Integration into CI/CD Pipelines
Behat tests deliver their full value when they run automatically on every code push. In the CI/CD pipeline, a Drupal test instance is built, the Behat suite is executed, and the result is reported. Failed tests prevent deployment — errors do not reach production.
Test Strategy for Your Platform?
arocom implements Behat tests as part of the development methodology. The Future Check evaluates the quality assurance of your platform. From 2,500 EUR plus VAT, creditable toward the follow-up project.
What is the difference between Behat and PHPUnit?
PHPUnit tests individual code units (unit tests). Behat tests the behavior of the entire application from the user's perspective (acceptance tests). Both complement each other and cover different test levels.
Can non-technical team members write Behat tests?
The Gherkin syntax is intentionally close to natural language. Product owners can formulate scenarios that developers then turn into executable tests. This makes collaboration more direct.
How many Behat tests does a Drupal project need?
There is no fixed number. The important thing is to cover the critical user journeys: login, content creation, search, forms. arocom recommends starting with the most important scenarios and expanding gradually.
Read more
- Codeception — Automated testing for PHP
- DevOps — Automation in development
- Git Hooks — Workflow automation
Discover a random article
Questions about this topic? We'd love to help.
Drupal Future Check
Checklist: Is your Drupal installation future-proof? 15 checkpoints.
Was this article helpful?