Examples

July 26, 2026 ยท View on GitHub

This directory contains ready-to-run example projects generated by behave-gen. Each example demonstrates a different workflow.

Projects

DirectoryWorkflowDescription
basic-project/init + add feature + add stepsA Behave project with HTTP and auth step libraries, login and checkout features.
openapi-project/init + from-openapiFeatures and HTTP steps generated from a Petstore OpenAPI 3.0 spec.
migrated-project/init + migrateA Cucumber (Java) project migrated to Behave feature files.

Usage

Each example is a self-contained Behave project.

basic-project

cd examples/basic-project
pip install -e ..
behave --dry-run
behave

openapi-project

cd examples/openapi-project/gen
pip install -e ..
behave --dry-run
behave

migrated-project

Java step definitions are not migrated. Add Python step libraries first:

cd examples/migrated-project/migrated
behave-gen add steps --lib http
behave-gen add steps --lib auth
behave --dry-run
behave

How these were generated

basic-project

behave-gen init basic-project
cd basic-project
behave-gen add feature login --tags smoke,auth
behave-gen add feature checkout --tags smoke,regression
behave-gen add steps --lib http
behave-gen add steps --lib auth
behave-gen add environment

Feature files were then edited to use the HTTP and auth step definitions instead of the placeholder templates.

openapi-project

behave-gen init openapi-project
cd openapi-project
# spec.yaml is a copy of the Petstore OpenAPI 3.0 spec
behave-gen from-openapi spec.yaml --out-dir gen --step-lib http --tag api

migrated-project

behave-gen init migrated-project
cd migrated-project
behave-gen migrate path/to/cucumber-project --out-dir migrated

The migrated/ directory contains the converted .feature files. Java step definitions are not auto-converted โ€” use behave-gen add steps --lib <http|auth> to generate Python step definitions.