---
title: "Behat Tests: Acceptance Testing for Drupal"
lang: en
type: knowledge
canonical: https://www.arocom.de/en/knowledge/drupal/behat-tests
alternate: https://www.arocom.de/wissen/drupal/behat-tests
author: "Axel Roth"
last_updated: 2026-07-29
---

# Behat Tests: Acceptance Testing for Drupal

Behat is a PHP framework for Behavior-Driven Development (BDD) that
formulates tests in natural language. The Drupal Extension provides a
specialized integration for Drupal. arocom has relied on automated
acceptance tests in Drupal projects since 2012 to ensure quality and
prevent regressions during updates.

## Behat Tests: Automated Acceptance Testing for Drupal

"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](https://www.arocom.de/en/future-check) evaluates
the quality assurance of your platform. From 2,500 EUR
plus VAT, creditable toward the follow-up project.

**From arocom projects:**

- Academic textbooks have their own structure, volumes, chapters, learning units, and live in a publisher's workflow that isn't identical to the web platform. For UTB Publios we wired Drupal 10 with Paragraphs and Feeds so both worlds stay cleanly in sync.
- [werbemax](https://www.arocom.de/en/references/werbemax) switched to us in 2023 after an agency change, we took over 28 custom modules, documented them, and migrated them to Drupal 11 without breaking a single feature.

### 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](https://www.arocom.de/en/knowledge/development/codeception): Automated testing for PHP
- [DevOps](https://www.arocom.de/en/knowledge/development/devops): Automation in development
- [Git Hooks](https://www.arocom.de/en/knowledge/development/git-hooks): Workflow automation
