BDDgen: Automate Your BDD Scenarios with Smart Generation

What is BDDgen?

BDDgen (Behavior-Driven Development Generator) is a tool designed to automatically generate BDD (Behavior-Driven Development) feature files and test scenarios from system specifications, API documentation, or business logic inputs. It eliminates the repetitive and manual task of writing .feature files by interpreting structured input — such as OpenAPI/Swagger files, user stories, or requirement docs — and transforming them into Gherkin-based test cases.

By integrating with BDD frameworks such as Cucumber, SpecFlow, or Behave, BDDgen brings automation and speed to the test development lifecycle. This allows QA teams, developers, and business analysts to maintain a living documentation of application behavior without spending hours drafting test steps.

BDDgen is ideal for teams practicing agile or DevOps, where rapid iteration, consistent documentation, and executable specifications are essential for delivery velocity and software quality.


What are the Major Use Cases of BDDgen?

BDDgen helps bridge communication between stakeholders and testers, and enables fast test authoring in a variety of practical scenarios. Key use cases include:

1. Automated BDD Scenario Generation from APIs

  • Given an OpenAPI/Swagger specification, BDDgen generates Gherkin-based .feature files for testing RESTful endpoints automatically.
  • Ideal for contract testing and regression coverage.

2. Transforming User Stories into Executable Scenarios

  • Converts structured user stories into BDD scenarios using AI or NLP parsing, saving manual writing time.

3. Generating Skeleton Test Suites for Microservices

  • For microservices with defined inputs/outputs, BDDgen can scaffold feature files and step definitions quickly.

4. Onboarding New Projects

  • Teams can bootstrap testing frameworks with auto-generated scenarios in new domains without deep manual research.

5. Creating Gherkin Tests from Business Rules

  • When rules or decision tables are provided, BDDgen converts them into readable and testable BDD flows.

6. CI/CD-Ready Documentation

  • Integrate BDDgen into CI pipelines to always keep tests aligned with API evolution or product updates.

How BDDgen Works (with Architecture)

BDDgen relies on structured inputs like OpenAPI specs, use case models, or templates and uses parsing engines or AI/NLP models to analyze the data. It then transforms this information into valid .feature files based on user-defined templates or default BDD structures.

High-Level Architecture Overview:

[Input Layer]
 → User Story / Swagger / OpenAPI / CSV / Excel
       ↓
[Parser & Analyzer]
 → NLP / JSON Schema / Regex / AI Parser
       ↓
[Scenario Generator Engine]
 → BDD Template Builder + Parameter Resolver
       ↓
[Output Layer]
 → Gherkin Feature Files + Optional Step Definitions
  • Input Layer: Accepts APIs, business rules, or text-based requirements.
  • Parser/Analyzer: Interprets structure using syntax models, schema parsing, or AI-based recognition.
  • Scenario Generator: Converts data into Given-When-Then formatted test cases.
  • Output Layer: Generates .feature files and optionally stubs for steps.js or steps.py.

This modular setup allows BDDgen to be plugged into various workflows — from CLI tools to web interfaces or API-driven SaaS platforms.


What is the Basic Workflow of BDDgen?

  1. Input Preparation
    • Provide OpenAPI specs, user stories, or structured rules as JSON, YAML, or plain text.
  2. Parsing and Mapping
    • BDDgen reads and understands the input through parsing engines, schema matchers, or NLP.
  3. Scenario Construction
    • The tool automatically creates Feature, Scenario, Given, When, Then steps for each functional flow.
  4. Template Customization
    • Users can apply templates to control language structure, parameter naming, or output style.
  5. Output Generation
    • The generated .feature files are saved to a chosen directory or exported via API.
  6. Integration and Execution
    • Use the feature files in Cucumber, Behave, or any BDD framework for test automation or living documentation.

Step-by-Step Getting Started Guide for BDDgen

Step 1: Install BDDgen (CLI or SaaS version)

If you’re using a CLI:

npm install -g bddgen

Or access a web-based tool if BDDgen is provided as a SaaS platform.

Step 2: Prepare Your Input File

Use OpenAPI/Swagger:

{
  "paths": {
    "/login": {
      "post": {
        "summary": "User logs into the system",
        "parameters": [{ "name": "email", "in": "body" }]
      }
    }
  }
}

Step 3: Run BDDgen

bddgen generate --input openapi.json --output ./features/

You’ll now have:

Feature: User Authentication

  Scenario: Login with valid credentials
    Given the user sends a POST request to /login
    When the body contains "email" and "password"
    Then the response status should be 200

Step 4: Customize Output

Use a bddgen.config.json to apply templates or format options:

{
  "language": "en",
  "template": "gherkin",
  "includeExamples": true
}

Step 5: Use with Cucumber or Behave

Use the generated files directly in your test runner:

npx cucumber-js
# or
behave

Step 6: CI/CD Integration (Optional)

Add BDDgen to your pipeline to regenerate features automatically on API changes:

# GitHub Actions
- name: Generate BDD Features
  run: bddgen generate --input openapi.yaml --output ./features