← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Acceptance Testing / BDD (Behat)

Testing PHP 5.0+ Intermediate
debt(d7/e5/b5/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The absence of acceptance tests is not something a compiler or standard linter catches. Tools like Behat, Codeception, Playwright, or Cypress exist but they don't automatically detect *missing* acceptance tests — they only run tests that already exist. Detecting that critical user journeys lack acceptance test coverage requires manual code review, process audits, or custom CI checks. The detection_hints confirm automated=no.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix suggests writing Behat scenarios for 5-10 critical user journeys, which is not a one-line patch — it requires creating test infrastructure (Behat configuration, feature files, step definitions, context classes), setting up a production-like test environment, and writing multiple scenario files. This is a significant but localized effort within the testing layer, not an architectural rework.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Acceptance tests impose ongoing maintenance costs: they are slow (as noted in common_mistakes), require production-like environments, are prone to flakiness, and must be updated whenever critical user journeys change. They apply across the web context and affect CI/CD pipelines, release processes, and multiple team workflows. However, they don't define the system's architecture — they sit alongside it as a testing layer.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap (a documented gotcha most devs eventually learn)' (t5). The misconception field explicitly states the trap: developers commonly believe acceptance tests are just end-to-end tests with a different name, confusing technical scope with business intent. This leads to common mistakes like writing tests with technical assertions instead of business-readable scenarios, over-testing every feature instead of critical journeys, and not involving stakeholders. It's a well-documented gotcha but not catastrophic — most teams learn the distinction with experience.

About DEBT scoring →

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"

Added 15 Mar 2026
Edited 28 Mar 2026
Views 72
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 1 ping W 2 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 1 ping F 2 pings S 1 ping S 0 pings M 2 pings T 1 ping W 2 pings T 1 ping F 1 ping S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Perplexity 14 Amazonbot 14 ChatGPT 7 Google 5 Unknown AI 4 Ahrefs 4 Bing 4 Scrapy 4 SEMrush 3 Meta AI 2 Claude 2 Majestic 1 PetalBot 1
crawler 58 crawler_json 6 pre-tracking 1
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


✓ schema.org compliant