Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
BDD, Python style.
Python Cucumber Other

Merge pull request #343 from mixxorz/update-badges

Updated/fix badges (pypi, pypi downloads, license).
latest commit 41448087cf
@jenisys jenisys authored
Failed to load latest commit information.
behave Prefer language comment in feature files over --lang option (related …
behave4cmd0 Provide more context (command.output)
bin FIX issue #309: behave --lang-list fails on Python3 (and Python2)
docs Fix typo in Django doc
etc Issue #161: JSONFormatter: Should use a slightly different output sch…
features CR issue #299: Runner can continue after a failed step (same as: #314).
issue.features FIX issue #309: behave --lang-list fails on Python3 (and Python2)
more.features Add documented tutorial related to issue #233 problems.
requirements FIX issue #319: python-version specific requirements in behave.whl fo…
test Prefer language comment in feature files over --lang option (related …
tools/test-features FIX issue #309: behave --lang-list fails on Python3 (and Python2)
.bumpversion.cfg BUMP-VERSION: 1.2.6.dev0 (was: 1.2.5)
.coveragerc Issue #113: Cleanup some typos, unneeded party (cherry-picked).
.editorconfig Provide generic editor configuration description for this project.
.gitignore Various unicode related fixes (#226, #230, #251).
.pycheckrc Provide configfile for pychecker.
.travis.yml travis config: enable pip caching (to speed up builds)
CHANGES.rst Prefer language comment in feature files over --lang option (related …
LICENSE UPDATE: Increase year to 2014.
MANIFEST.in FIX: typo in api doc.
PROJECT_INFO.rst readthedocs: Renamed http://python-behave.readthedocs.org (was: http:…
README.rst Updated badges
VERSION.txt BUMP-VERSION: 1.2.6.dev0 (was: 1.2.5)
behave.ini Issue #301: Add support for default tags in configfile.
pylintrc Pull-Request #79: Provide Support for Scenario Descriptions
setup.cfg VERSION: 1.2.5
setup.py FIX issue #319: python-version specific requirements in behave.whl fo…
setuptools_behave.py Tweak related to #310
tox.ini cleanromm3: Ensure that python3 is used.

README.rst

Behave

Join the chat at https://gitter.im/behave/behave Travis CI Build Status Latest Version Downloads License

behave is behavior-driven development, Python style.

logo

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 "features/". In that directory create a file called "example.feature" containing:

# -- FILE: features/example.feature
Feature: Showing off behave

  Scenario: Run a simple test
    Given we have behave installed
     When we implement 5 tests
     Then behave will test them for us!

Make a new directory called "features/steps/". In that directory create a file called "example_steps.py" containing:

# -- FILE: features/steps/example_steps.py
from behave import given, when, then, step

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

@when('we implement {number:d} tests')
def step_impl(context, number):  # -- NOTE: number is converted into integer
    assert number > 1 or number == 0
    context.tests_count = number

@then('behave will test them for us!')
def step_impl(context):
    assert context.failed is False
    assert context.tests_count >= 0

Run behave:

$ behave
Feature: Showing off behave # features/example.feature:2

  Scenario: Run a simple test          # features/example.feature:4
    Given we have behave installed     # features/steps/example_steps.py:4
    When we implement 5 tests          # features/steps/example_steps.py:8
    Then behave will test them for us! # features/steps/example_steps.py:13

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.

More Information

Something went wrong with that request. Please try again.