Skip to main content

Behavior-driven development (or BDD) is an agile software development technique that encourages collaboration between developers, QA and non-technical or business participants in a software project.

behave uses tests written in a natural language style, backed up by Python code.

First, install *behave*.

Now make a directory called “example”. In that directory create a file called “example.feature” containing:

Feature: showing off behave

  Scenario: run a simple test
     Given we have behave installed
      when we implement a test
      then behave will test it for us!

Make a new directory called “example/steps”. In that directory create a file called “example.py” containing:

from behave import *

@given('we have behave installed')
def step(context):
    pass

@when('we implement a test')
def step(context):
    assert True is not False

@then('behave will test it for us!')
def step(context):
    assert context.failed is False

Run behave:

% behave
Feature: showin off behave # example/example.feature:1

  Scenario: run a simple test        # example/example.feature:3
    Given we have behave installed   # example/steps/example.py:3
    When we implement a test         # example/steps/example.py:7
    Then behave will test it for us! # example/steps/example.py:11

1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
3 steps passed, 0 failed, 0 skipped, 0 undefined

Now, continue reading to learn how to the most of behave. To get started, we recommend the tutorial and then the feature testing language and api references.

Download from http://pypi.python.org/pypi/behave

Metadata

Release files for behave 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for behave 1.0.0
File Size Uploaded Provenance Actions
behave-1.0.0.tar.gz 41.8 kB Without provenance Details for behave-1.0.0.tar.gz

Release files / behave-1.0.0.tar.gz

Download URL behave-1.0.0.tar.gz
Size 41.8 kB
Tags Source
SHA-256 checksum
How to use checksums
da538524bf43e464d37b57a9b4515a88e3d062d653096f649f573df48a7dbb1e
BLAKE2b-256 checksum
How to use checksums
e2ad6ee5e8a1038758ab443f8ae3898e6789d60018d2f8631f774b4a117c1461
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for behave 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page