CLAUDE LABJP
2.1.278 — The auto mode classifier now runs server-side by default on the Claude API, Enterprise, Bedrock, Vertex and Foundry. You are not billed for the classifier, and /status gained an Auto mode server lineTASKOUT — The TaskOutput tool is gone. taskOutputMaxChars and TASK_MAX_OUTPUT_LENGTH no longer do anything, and background output is read with Read instead10/07 — The old management-configuration key spellings are accepted until noon PT on October 7, seventeen days from now. After that, entries that still use them stop working until you rewrite themBUNPANIC — Reports are coming in of the newest build crashing on launch alone. Earlier builds still run on the same machine, which points at the release rather than the environmentNEW — Deciding what belongs in Cowork and what belongs in Claude Code, using the approval boundary as the lineSONNET4.5 — A date in a deprecation table is a floor, not an end date. Sonnet 4.5 is still active and no deprecation notice has been posted2.1.278 — The auto mode classifier now runs server-side by default on the Claude API, Enterprise, Bedrock, Vertex and Foundry. You are not billed for the classifier, and /status gained an Auto mode server lineTASKOUT — The TaskOutput tool is gone. taskOutputMaxChars and TASK_MAX_OUTPUT_LENGTH no longer do anything, and background output is read with Read instead10/07 — The old management-configuration key spellings are accepted until noon PT on October 7, seventeen days from now. After that, entries that still use them stop working until you rewrite themBUNPANIC — Reports are coming in of the newest build crashing on launch alone. Earlier builds still run on the same machine, which points at the release rather than the environmentNEW — Deciding what belongs in Cowork and what belongs in Claude Code, using the approval boundary as the lineSONNET4.5 — A date in a deprecation table is a floor, not an end date. Sonnet 4.5 is still active and no deprecation notice has been posted
Articles/Claude Code
Claude Code/2026-05-05Advanced

BDD with Claude Code in Production— From Gherkin Scenario Generation to Cross-Team Test Culture

A production-ready guide to Behavior-Driven Development with Claude Code. Learn how to auto-generate Gherkin scenarios, implement step definitions, integrate with Playwright/Cucumber, and build a cross-team test culture — all with working code examples.

Claude Code255BDDTesting2GherkinPlaywrightQuality AssuranceAutomation45

Premium Article

Have you ever tried introducing BDD (Behavior-Driven Development), only to hit a wall — scenarios you couldn't write, an explosion of step definitions to maintain, and a framework that only engineers ended up touching?

I've been there. Across multiple projects, I've attempted and then abandoned BDD. Learning Gherkin syntax was manageable, but writing scenarios that genuinely reflected business value from scratch was harder than expected, and the maintenance cost never felt worth it.

That changed when I started using Claude Code seriously. When you delegate scenario generation, step definitions, and test code automation to Claude Code, BDD transforms from something you write to something you cultivate. What follows is that implementation, with code I actually ran to confirm it works.

What BDD Is, and Why It Pairs Well with Claude Code

BDD (Behavior-Driven Development) is a development methodology that describes application behavior in natural language, then uses that language as the specification for test code. Where TDD verifies code correctness, BDD documents business intent.

Using a DSL called Gherkin, scenarios look like this:

Feature: User Login
  Value: Only authenticated users can access the dashboard
 
  Scenario: Login succeeds with valid credentials
    Given the user has a registered account
    When they enter email "test@example.com" and password "SecurePass123"
    And they click the Login button
    Then they are redirected to the dashboard
    And the message "Welcome, Test User" is displayed
 
  Scenario: Login fails with incorrect password
    Given the user has a registered account
    When they enter email "test@example.com" and the wrong password "WrongPass"
    And they click the Login button
    Then the error message "Incorrect email or password" is displayed
    And they are not redirected to the dashboard

Writing these scenarios by hand becomes impractical as features grow in complexity. With Claude Code, you can auto-generate scenarios from requirements documents or user stories, and then automate the step definitions as well.

Project Setup

Installing Required Packages

Set up a BDD environment in your Next.js project:

# Build a BDD environment with Playwright + Cucumber.js
npm install --save-dev \
  @cucumber/cucumber \
  @playwright/test \
  playwright \
  @types/node
 
# Install Playwright browsers
npx playwright install chromium

Organize your project structure like this:

project-root/
├── features/                    # Gherkin scenario files
│   ├── auth/
│   │   └── login.feature
│   ├── dashboard/
│   │   └── overview.feature
│   └── support/
│       └── world.ts             # Cucumber World setup
├── steps/                       # Step definitions
│   ├── auth/
│   │   └── login.steps.ts
│   └── common/
│       └── navigation.steps.ts
└── cucumber.config.ts           # Cucumber configuration

Basic cucumber.config.ts configuration:

// cucumber.config.ts — verified against @cucumber/cucumber 13.x
// defineConfig is not exported, so we default-export a plain object
const config = {
  default: {
    requireModule: ['ts-node/register'],
    require: ['steps/**/*.ts', 'features/support/**/*.ts'],
    format: [
      'progress-bar',
      'json:reports/cucumber-report.json',
      'html:reports/cucumber-report.html'
    ],
    formatOptions: { snippetInterface: 'async-await' },
    worldParameters: {
      baseUrl: process.env.BASE_URL || 'http://localhost:3000',
    },
    retry: 1,
    // timeout is NOT read here. The next section explains why
  },
};
 
export default config;

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Developers stuck on BDD scenario design will be able to auto-generate Gherkin with Claude Code and start integrating it into real projects today
You'll gain a production-ready quality assurance system that integrates step definitions, E2E tests, and CI/CD pipelines in a single workflow
You'll learn how to design a test culture where non-engineers (POs, QA, designers) can actively participate — plus real team operating patterns
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $15 for lifetime access
View Membership →

Related Articles

Claude Code2026-09-01
Drop the quotes on a heredoc and the prices in your log quietly change
An unquoted heredoc runs the variables and backticks inside its body. Here are the four ways my log got rewritten, how the three quoting forms compare, a safe placeholder-and-sed pattern, and a small script for auditing what you already have.
Claude Code2026-08-22
Handing a long job to another session — and the completion marker for when the notification never arrives
How to use notify_when_idle to hear when another Claude Code session finishes, and a small completion marker that keeps you from waiting forever when the notification is dropped.
Claude Code2026-08-03
Existence Checks Pass, Writes Fail — Probing Capabilities Before an Unattended Run
A directory existing and a directory being writable are two different facts. Measured results from five broken-environment cases, why static clues cannot predict the worst of them, and a capability-probe preflight for unattended Claude Code runs.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links