Behave Restful
Behave Restful is a Behavior Driven Development (BDD) framework based on behave, that implements a language suitable to test and validate REST APIs and Services. It leverages the power of the gherkin language to write business readable tests that validate the behavior of REST APIs.
Although, Behave Restful is implemented in python and uses behave as underlying framework, it can test services implemented in any language as easy as:
Feature: API to add a new book to our collection
As a user, I want to add a new book to my "to-read" collection.
Scenario: Add a new book to collection.
Given a request url http://my.reads/api/books
And a request json payload
"""
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95,
"status": "to-read"
}
"""
When the request sends POST
Then the response status is CREATED
And the response json matches
"""
{
"title": "BookObject",
"type": "object"
"properties": {
"id": {"type": "number"},
"category": {"type": "string"},
"author": {"type": "string"},
"title": {"type": "string"},
"price": {"type": "number"},
"status": {"type": "string", "enum": ["to-read", "reading", "read"]}
},
"required": ["id", "category", "title"]
}
"""
And the response json at $.id is equal to 100
And the response json at $.category is equal to "reference"
And the response json at $.title is equal to "Sayings of the Century"
As you can see in the example, we send a POST request to the specified url with a JSON payload, and we can validate the result very easy. First, we verify that the status of the response is CREATED (it succeeds). Then we validate the response JSON body using the expected JSON Schema. Finally, we validate specific values in the response using JSONPath
Installation
Use pip to install behave-restful in your project
pip install behave-restful
Setup
To add support for behave-restful steps in your .feature files, you need to include behave-restful’s environment and step definitions.
You can do this simply by adding two boilerplate files to your project:
In the root of your features directory, add this environment.py file:
# {your_project}/features/en/__init__.py
import os
import behave_restful.app as br_app
def before_all(context):
this_directory = os.path.abspath(os.path.dirname(__file__))
br_app.BehaveRestfulApp().initialize_context(context, this_directory)
context.hooks.invoke(br_app.BEFORE_ALL, context)
def after_all(context):
context.hooks.invoke(br_app.AFTER_ALL, context)
def before_feature(context, feature):
context.hooks.invoke(br_app.BEFORE_FEATURE, context, feature)
def after_feature(context, feature):
context.hooks.invoke(br_app.AFTER_FEATURE, context, feature)
def before_scenario(context, scenario):
context.hooks.invoke(br_app.BEFORE_SCENARIO, context, scenario)
def after_scenario(context, scenario):
context.hooks.invoke(br_app.AFTER_SCENARIO, context, scenario)
def before_step(context, step):
context.hooks.invoke(br_app.BEFORE_STEP, context, step)
def after_step(context, step):
context.hooks.invoke(br_app.AFTER_STEP, context, step)
def before_tag(context, tag):
context.hooks.invoke(br_app.BEFORE_TAG, context, tag)
def after_tag(context, tag):
context.hooks.invoke(br_app.AFTER_TAG, context, tag)
And under features/steps add this __init__.py file:
# {your_project}/features/steps/__init__.py
from behave_restful.lang import *
Metadata
Release files for behave-restful 0.4.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| behave_restful-0.4.8.tar.gz | 24.1 kB | With provenance | Details for behave_restful-0.4.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| behave_restful-0.4.8-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for behave_restful-0.4.8-py2.py3-none-any.whl |
Total release size: 45.2 kB
Release files / behave_restful-0.4.8.tar.gz
| Download URL | behave_restful-0.4.8.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d37815871395c88d9d9cd6c04d8f6b4879514d136aa06d08b72e7ea330665387
|
|
BLAKE2b-256 checksum How to use checksums |
d532b5a1bddfd763a3db833d35cf1d0150af37258830c4efdb88216fd3f06594
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / behave_restful-0.4.8-py2.py3-none-any.whl
| Download URL | behave_restful-0.4.8-py2.py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
91e8c4d83a7d674589ecf61ea076f4aece62e959d51337454d6d4340c4d7836d
|
|
BLAKE2b-256 checksum How to use checksums |
82bc91cd366688379fd0eae484fa46e6afa2bff4e9c886f326dbba719f7c2bdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for behave-restful 0.4.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for behave_restful-0.4.8.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.