CheckOps
behave
behave is a BSD-licensed behaviour-driven development framework for Python that runs Gherkin feature files with step definitions written in Python.
- Unit Testing
- Python
- Open source
- Free
- Bdd
- Integration Testing
- Unit testing
- Integration testing
- End-to-end & functional
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
behave describes itself as “BDD, Python style”. Behaviour-driven development uses plain-language scenarios, written in Gherkin with Given/When/Then steps, as shared specifications between product, QA and engineering. behave reads .feature files and matches each step to a Python function decorated with @given, @when or @then.
Projects follow a convention: a features/ directory holding feature files, a steps/ subdirectory for step implementations, and an optional environment.py for hooks such as before_all, before_scenario and after_step, often used to start browsers or reset databases. Step patterns can use the parse library’s syntax ({count:d}) or regular expressions, and scenarios support outlines with example tables, backgrounds, tags for selection (--tags=@smoke) and multiple formatters, including pretty, plain, JSON and JUnit XML for CI. The latest release, v1.3.3, was published on 4 September 2025, and the repository remains active with commits in November 2026.
The source code is at behave/behave on GitHub under the BSD-2-Clause licence, with about 3,500 stars; the most recent commit was on 6 November 2026.
Features
- Gherkin scenarios: Readable specifications shared with non-developers.
- Python step definitions: Decorated functions with parse or regex patterns.
- Hooks: Environment hooks for setup and teardown.
- Tags and formatters: Select scenarios and output JUnit XML or JSON.
Pros
- Free to use: Open source under the BSD-2-Clause licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 6 November 2026.
- Community: About 3,500 GitHub stars.
Cons
- Separate from pytest: Does not use pytest fixtures; pytest-bdd integrates with pytest instead.
- BDD overhead: Gherkin adds value only when stakeholders read the scenarios.
Usage and Links (Example)
# features/cart.feature
Feature: Cart
Scenario: Add an item
Given an empty cart
When I add 2 apples
Then the cart contains 2 items
# features/steps/cart_steps.py
from behave import given, when, then
@given("an empty cart")
def step_empty(context):
context.cart = []
@when("I add {count:d} apples")
def step_add(context, count):
context.cart += ["apple"] * count
@then("the cart contains {count:d} items")
def step_check(context, count):
assert len(context.cart) == count
pip install behave
behave --tags=@smoke --junit
Resources:
Pricing
behave is free and open source under the BSD-2-Clause licence.
Recommended for?
- Teams practising BDD in Python with business-readable scenarios.
- QA teams writing acceptance tests outside pytest.
Conclusion
behave is the classic Python BDD framework, straightforward and well documented, ideal when Gherkin scenarios are a genuine collaboration tool.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with behave side by side.
Ppytest-bddpytest-bdd is an MIT-licensed BDD plugin for pytest that runs Gherkin feature files as pytest tests, with steps implemented as fixtures-aware Python functions.Compare with behave
CCucumberCucumber is the open-source BDD tool that runs Gherkin feature files against step definitions. It is not CucumberStudio.Compare with behave
RRobot FrameworkGeneric automation framework for acceptance testing and RPA.Compare with behave
BBehatBehat is an MIT-licensed behaviour-driven development framework for PHP that runs Gherkin feature files against PHP context classes, often paired with Mink for browser testing.Compare with behave- Ppytestpytest is the usual Python test runner: plain asserts, fixtures, parametrization, and a large plugin set.Compare with behave
SSerenity BDDSerenity BDD is an Apache-2.0 Java library for writing automated acceptance tests with rich living-documentation reports, integrating with JUnit, Cucumber and Selenium and supporting the Screenplay pattern.Compare with behave