behave-steplib¶
Reusable step libraries for Behave — share, discover and install step definitions across projects. Zero mandatory dependencies; each technology is an optional extra.
behave-steplib provides a modular, auto-registered collection of BDD step
definitions for HTTP APIs, web browsers, databases, Kafka and generic data
management. Steps are defined in English with Spanish (es) and Portuguese
(pt) translations, fully typed, and discoverable via Python entry points.
Getting Started
Reference
Features at a glance¶
Modular —
api,web,db,kafka,data,io,climodules activated via extras and lazy imports.Auto-registered —
autoload(context)registers every installed step in one line.Multilingual — steps defined in English with
esandpttranslations; all patterns are registered with behave so matching works regardless of active language.Typed — full type hints,
mypy --strictclean,py.typedmarker included.CLI —
steplib list / show / validate / initpowered by Typer.Pluggable — third-party packages can register steps via the
steplib.pluginsentry point group.Ecosystem — integrates with
behave-kit,behave-tablesandbehave-datawhen installed.Backends — each module supports multiple backends (e.g. stdlib/httpx/requests for API, selenium for web) selectable at autoload time.
Three adoption levels¶
Level 1 — Automatic wiring:
from steplib.behave import autoload
def before_all(context):
context.steplib = autoload(context)
def before_scenario(context, scenario):
context.steplib.reset()
def after_scenario(context, scenario):
context.steplib.cleanup()
Level 2 — Explicit load:
from steplib.behave import load
def before_all(context):
context.steplib = load(context, "steplib.modules.api.steps")
Level 3 — Filtered autoload:
from steplib.behave import autoload
def before_all(context):
context.steplib = autoload(
context,
categories=["api"],
backends={"api": "httpx"},
)
Installation¶
pip install behave-steplib
With optional extras:
pip install "behave-steplib[api,requests,web,db,kafka,data]"
License¶
MIT — see LICENSE.