Acceptance Testing / BDD (Behat)
Also Known As
acceptance tests
UAT
end-to-end acceptance
TL;DR
Testing that the system meets business requirements from a user perspective — written in plain language (Gherkin) and automated with Behat in PHP.
Explanation
Acceptance testing verifies that a feature behaves correctly from the end user's perspective, not just unit-level correctness. Behaviour-Driven Development (BDD) uses Gherkin syntax (Given/When/Then) to write human-readable scenarios that are both documentation and automated tests. Behat is PHP's primary BDD framework — Gherkin feature files are executed against step definitions written in PHP, often driving a real browser via Mink (Selenium, Playwright). Acceptance tests sit at the top of the Test Pyramid — they are slow, brittle if UI-dependent, but catch integration gaps that unit tests miss. Write them for critical user journeys: checkout flow, user registration, payment processing.
Diagram
flowchart TD
subgraph BDD_Cycle
STORY[User story<br/>As a user I want to...]
SCENARIO2[Gherkin scenario<br/>Given When Then]
BEHAT[Behat runs scenario]
FEATURE[Feature works end-to-end]
STORY --> SCENARIO2 --> BEHAT --> FEATURE
end
subgraph Layers
UNIT2[Unit tests - fast isolated]
INTEGRATION2[Integration - real DB]
ACCEPTANCE[Acceptance - full user journey<br/>slowest most valuable]
UNIT2 --> INTEGRATION2 --> ACCEPTANCE
end
style FEATURE fill:#238636,color:#fff
style ACCEPTANCE fill:#6e40c9,color:#fff
style UNIT2 fill:#1f6feb,color:#fff
Watch Out
⚠ UI-driven acceptance tests can become flaky due to timing, network, or browser issues — prefer API-level scenarios where possible to improve stability.
Common Misconception
✗ Acceptance tests are just end-to-end tests with a different name. Acceptance tests verify that the system meets business requirements from the user's perspective — they can be UI-level or API-level. End-to-end tests describe the technical scope; acceptance tests describe the business intent.
Why It Matters
Acceptance tests verify that the system meets business requirements from the user's perspective — they are the final safety net before release, testing real workflows end-to-end through the UI or API.
Common Mistakes
- Too many acceptance tests — they are slow; use them for critical user journeys, not every feature.
- Acceptance tests with no domain language — technical assertions instead of business-readable scenarios.
- Not running acceptance tests against a production-like environment — passing on dev, failing on prod.
- Flaky acceptance tests that are sometimes ignored — a test suite that is sometimes ignored provides no safety net.
Avoid When
- Testing low-level logic that can be covered by unit or integration tests.
- Verifying UI implementation details like CSS, HTML attributes, or layout.
- Running on every small code change where faster test layers provide sufficient coverage.
When To Use
- Validating critical user journeys like checkout, authentication, and payment flows.
- Ensuring business requirements are correctly implemented before release.
- Creating shared understanding between developers, QA, and non-technical stakeholders.
Code Examples
💡 Note
Shows how acceptance tests describe user-visible behavior instead of low-level implementation details.
✗ Vulnerable
// Acceptance test that's too granular — should be a unit test:
// Test: verify that the password field has a 'required' attribute
// This is a unit/integration concern, not an acceptance concern
// Acceptance test should be: 'User cannot log in without providing a password'
// — the business requirement, not the HTML implementation detail
✓ Fixed
# Behat feature file — written in Gherkin, readable by stakeholders
Feature: User login
Scenario: Successful login
Given I am on "/login"
When I fill in "email" with "user@example.com"
And I fill in "password" with "secret"
And I press "Log in"
Then I should see "Welcome back"
And I should be on "/dashboard"
Scenario: Invalid credentials
Given I am on "/login"
When I fill in "email" with "wrong@example.com"
And I fill in "password" with "wrong"
And I press "Log in"
Then I should see "Invalid credentials"
Tags
🤝 Adopt this term
£79/year · your link shown here
Added
15 Mar 2026
Edited
28 Mar 2026
Views
46
🤖 AI Guestbook educational data only
|
|
Last 30 days
Agents 0
No pings yet today
No pings yesterday
Perplexity 14
Amazonbot 12
ChatGPT 4
Unknown AI 4
Google 2
Ahrefs 2
Majestic 1
Meta AI 1
Also referenced
How they use it
crawler 37
crawler_json 2
pre-tracking 1
Related categories
⚡
DEV INTEL
Tools & Severity
🔵 Info
⚙ Fix effort: High
⚡ Quick Fix
Write Behat scenarios in business language (Given/When/Then) for the 5-10 most critical user journeys — not every feature needs an acceptance test
📦 Applies To
PHP 5.0+
web
🔗 Prerequisites
🔍 Detection Hints
No end-to-end or acceptance test suite for critical user journeys (checkout, signup, payment)
Auto-detectable:
✗ No
behat
codeception
playwright
cypress
⚠ Related Problems
🤖 AI Agent
Confidence: Low
False Positives: High
✗ Manual fix
Fix: High
Context: File
Tests: Update