Skip to main content
ClaudeWave
Skill145 estrellas del repoactualizado yesterday

BDD/Cucumber Patterns

Behavior-Driven Development skill using Cucumber, covering feature files, step definitions, Gherkin best practices, data tables, scenario outlines, and hooks.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/PramodDutta/qaskills /tmp/bdd-cucumber-patterns && cp -r /tmp/bdd-cucumber-patterns/seed-skills/bdd-cucumber ~/.claude/skills/bdd-cucumber-patterns
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# BDD/Cucumber Patterns Skill

You are an expert QA engineer specializing in Behavior-Driven Development (BDD) with Cucumber. When the user asks you to write, review, or improve Cucumber feature files and step definitions, follow these detailed instructions.

## Core Principles

1. **Business language** -- Feature files must use domain language that non-technical stakeholders understand.
2. **Declarative over imperative** -- Describe what the user does, not how the UI works.
3. **Single scenario, single behavior** -- Each scenario tests exactly one business rule.
4. **Reusable step definitions** -- Steps should be generic enough to reuse across features.
5. **Living documentation** -- Feature files are the single source of truth for behavior.

## Project Structure (TypeScript)

```
features/
  auth/
    login.feature
    registration.feature
    password-reset.feature
  products/
    product-listing.feature
    product-search.feature
  checkout/
    cart.feature
    payment.feature
  step-definitions/
    auth.steps.ts
    products.steps.ts
    checkout.steps.ts
    common.steps.ts
  support/
    world.ts
    hooks.ts
    custom-parameter-types.ts
  pages/
    login.page.ts
    products.page.ts
cucumber.js
tsconfig.json
```

## Project Structure (Java)

```
src/
  test/
    java/com/example/
      steps/
        AuthSteps.java
        ProductSteps.java
        CommonSteps.java
      pages/
        LoginPage.java
        ProductsPage.java
      hooks/
        Hooks.java
      runners/
        TestRunner.java
    resources/
      features/
        auth/
          login.feature
          registration.feature
        products/
          product-listing.feature
```

## Writing Feature Files

### Good Feature File

```gherkin
Feature: User Login
  As a registered user
  I want to log into the application
  So that I can access my personalized dashboard

  Background:
    Given the login page is displayed

  @smoke @auth
  Scenario: Successful login with valid credentials
    When I log in with valid credentials
    Then I should see the dashboard
    And I should see a welcome message

  @auth @negative
  Scenario: Login fails with incorrect password
    When I log in with an incorrect password
    Then I should see an error message "Invalid email or password"
    And I should remain on the login page

  @auth @negative
  Scenario: Login fails with non-existent email
    When I log in with a non-registered email
    Then I should see an error message "Invalid email or password"

  @auth @security
  Scenario: Account locks after multiple failed attempts
    When I attempt to log in 5 times with incorrect passwords
    Then my account should be temporarily locked
    And I should see a message about account lockout
```

### Scenario Outline (Data-Driven)

```gherkin
Feature: Form Validation
  As a user
  I want to see clear validation messages
  So that I can correct my input

  @validation
  Scenario Outline: Email validation
    Given I am on the registration page
    When I enter "<email>" in the email field
    And I submit the form
    Then I should see the validation message "<message>"

    Examples:
      | email               | message                     |
      |                     | Email is required           |
      | not-an-email        | Please enter a valid email  |
      | @missing.com        | Please enter a valid email  |
      | valid@example.com   |                             |

  @validation
  Scenario Outline: Password strength validation
    Given I am on the registration page
    When I enter "<password>" in the password field
    And I move to the next field
    Then the password strength indicator should show "<strength>"

    Examples:
      | password        | strength |
      | abc             | weak     |
      | abcdef12        | medium   |
      | SecurePass123!  | strong   |
```

### Data Tables

```gherkin
Scenario: Create multiple users
  Given the following users exist:
    | email               | name       | role   |
    | admin@example.com   | Admin User | admin  |
    | user1@example.com   | User One   | user   |
    | user2@example.com   | User Two   | viewer |
  When I navigate to the user management page
  Then I should see 3 users in the list

Scenario: Verify user profile details
  Given I am logged in as "admin@example.com"
  When I view my profile
  Then my profile should contain:
    | Field    | Value              |
    | Name     | Admin User         |
    | Email    | admin@example.com  |
    | Role     | Administrator      |

Scenario: Add items to cart
  When I add the following items to my cart:
    | product     | quantity | price  |
    | Widget A    | 2        | 29.99  |
    | Widget B    | 1        | 49.99  |
  Then my cart total should be "$109.97"
```

## Step Definitions (TypeScript)

```typescript
// step-definitions/auth.steps.ts
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from '@playwright/test';
import { CustomWorld } from '../support/world';

Given('the login page is displayed', async function (this: CustomWorld) {
  await this.page.goto('/login');
  await expect(this.page.getByRole('heading', { name: 'Sign In' })).toBeVisible();
});

When('I log in with valid credentials', async function (this: CustomWorld) {
  await this.loginPage.login('user@example.com', 'SecurePass123!');
});

When('I log in with an incorrect password', async function (this: CustomWorld) {
  await this.loginPage.login('user@example.com', 'wrongpassword');
});

When('I log in with a non-registered email', async function (this: CustomWorld) {
  await this.loginPage.login('nonexistent@example.com', 'SomePass123!');
});

Then('I should see the dashboard', async function (this: CustomWorld) {
  await expect(this.page).toHaveURL(/\/dashboard/);
});

Then('I should see a welcome message', async function (this: CustomWorld) {
  await expect(this.page.getByText(/welcome/i)).toBeVisible();
});

Then('I should see an error message {str
axe-core Accessibility AutomationSkill

Automated accessibility testing with axe-core integrated into CI pipelines, including custom rule configuration, issue prioritization, and remediation guidance.

A/B Test ValidationSkill

Validating A/B test implementations including traffic splitting accuracy, statistical significance calculation, metric tracking, and experiment cleanup.

Accessibility A11y EnhancedSkill

Comprehensive WCAG compliance and accessibility testing covering ARIA, keyboard navigation, screen readers, color contrast, and automated a11y validation.

Accessibility AuditorSkill

Comprehensive WCAG 2.1 AA compliance testing combining automated axe-core scans with manual keyboard navigation, screen reader compatibility, and focus management verification

AFL++ Fuzzing TestingSkill

American Fuzzy Lop Plus Plus mutation-based fuzz testing for finding crashes, hangs, and security vulnerabilities in binary programs.

Agent Browser AutomationSkill

Fast Rust-based headless browser automation CLI with Node.js fallback for AI agents, featuring navigation, clicking, typing, snapshots, and structured commands optimized for agent workflows.

Agentic Testing PatternsSkill

AI-first testing methodology where autonomous agents plan, generate, execute, and maintain test suites with minimal human intervention, covering agent orchestration, feedback loops, and intelligent test prioritization.

AI Agent EvaluationSkill

Comprehensive evaluation patterns for AI agents including multi-turn conversation testing, LLM-as-judge frameworks, benchmark suites, regression detection, and systematic eval pipelines for measuring agent quality and safety.