CLAUDE LABJP
WWDC — WWDC 2026 confirms Siri runs on Google Gemini; third-party handoff to ChatGPT is dropped, and Siri AI won't ship in the EU under the DMA at iOS 27BILLING — 6 days until the Jun 15 change: Agent SDK, headless Claude Code, GitHub Actions, and third-party agents move to API-rate monthly creditOUTAGE — claude.ai, Claude Code, and Cowork saw an outage (Jun). Scheduled runs are safest when built around fallbackModel and retriesDYNAMIC-WORKFLOWS — Dynamic workflows are on by default on Max/Team and the API, for codebase-wide bug hunts and independent verificationULTRACODE — Claude Code's new ultracode setting sits in the effort menu, fixing effort to xhigh while Claude decides when to run a workflowOPUS4.8 — Claude Opus 4.8 is settled in as the default across major plans, with stronger coding, agentic, and reasoning skillsWWDC — WWDC 2026 confirms Siri runs on Google Gemini; third-party handoff to ChatGPT is dropped, and Siri AI won't ship in the EU under the DMA at iOS 27BILLING — 6 days until the Jun 15 change: Agent SDK, headless Claude Code, GitHub Actions, and third-party agents move to API-rate monthly creditOUTAGE — claude.ai, Claude Code, and Cowork saw an outage (Jun). Scheduled runs are safest when built around fallbackModel and retriesDYNAMIC-WORKFLOWS — Dynamic workflows are on by default on Max/Team and the API, for codebase-wide bug hunts and independent verificationULTRACODE — Claude Code's new ultracode setting sits in the effort menu, fixing effort to xhigh while Claude decides when to run a workflowOPUS4.8 — Claude Opus 4.8 is settled in as the default across major plans, with stronger coding, agentic, and reasoning skills
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 Code219BDDTesting2GherkinPlaywrightQuality AssuranceAutomation30

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. This guide walks you through that implementation with working, production-tested code.

What BDD Is — and Why Claude Code Changes Everything

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
import { defineConfig } from '@cucumber/cucumber';
 
export default defineConfig({
  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',
    },
    timeout: 30000,
    retry: 1,
  },
});

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
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-05-23
Skill, Subagents, and Rules in Claude Code: A One-Hour Implementation Loop That Fits a Solo Operator
Misaki Ito at SonicGarden wrote about wiring Claude Code's Skill, Subagents, and Rules to close a week's worth of low-priority work in one meeting. Here is how I adapted that pattern as a solo developer running a 50M-download app business.
Claude Code2026-05-20
Claude Code Says 'All Tests Pass' but CI Goes Red — Designing Around Exit Code Pitfalls
Locally, Claude Code reports 'all tests pass.' You push it, and GitHub Actions turns red within minutes. The root cause is usually not Claude Code itself but how the shell and the test runner interpret exit codes. Here is a practical, experience-backed walkthrough.
Claude Code2026-05-18
Why Your `cd` and `export` Vanish Between Claude Code Bash Calls
Claude Code's Bash tool runs each call in a fresh shell, so cd and export never persist. Here's the symptom, the cause, and five practical patterns I use across my Dolice Labs pipelines.
📚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
See all →