◉CLAUDE LABJP
●CC 2.1.330 — Claude Code 2.1.330 fixes the multi-minute freeze right after compacting a long conversation●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 8 days left. The suggested replacement is claude-sonnet-5-5●MCP 401 — Users report MCP servers that return 401 time out silently instead of showing an error●NEW — New: Desktop creates a worktree for every session? Three places to check●OPUS 4.5 — The 11/24 date for Opus 4.5 is a not-sooner-than floor, not a retirement notice●SCHEMA — Same schema, different shape: compare structured output from the Agent SDK and the Messages API●CC 2.1.330 — Claude Code 2.1.330 fixes the multi-minute freeze right after compacting a long conversation●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 8 days left. The suggested replacement is claude-sonnet-5-5●MCP 401 — Users report MCP servers that return 401 time out silently instead of showing an error●NEW — New: Desktop creates a worktree for every session? Three places to check●OPUS 4.5 — The 11/24 date for Opus 4.5 is a not-sooner-than floor, not a retirement notice●SCHEMA — Same schema, different shape: compare structured output from the Agent SDK and the Messages API
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 Code291BDDTestingGherkinPlaywright3Quality AssuranceAutomation44

✦ 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 $10 for lifetime access
View Membership →

Related Articles

⟐ Claude Code2026-10-28
Back From Checkout, the Button Stayed on Processing: Why I Fixed It With pageshow, and the 3 Files My Audit Still Found
When you press Back from Stripe or another external page, a checkout button can stay stuck on Processing. I reproduce the bfcache cause in a real browser, compare pageshow with no-store, and add a repo audit script and a CLAUDE.md rule.
⟐ Claude Code2026-10-19
The Page Was 90px Too Wide at 375px, and the Culprit Never Showed Up in querySelectorAll
When a pseudo-element causes horizontal overflow on phones, scanning elements finds nothing. A probe script that confirms the culprit by diff, and overflow fixes that keep sticky intact, with measurements.
⟐ 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.