Examples and Tutorials for "behave" to simplify use for new developers.
Clone or download
Failed to load latest commit information.
.extra/packages FIX: sphinxcontrib-ansi seems to be no longer in PyPI (and not instal… Oct 22, 2016
.github Activate STALE-BOT Feb 13, 2018
bin Remove paver as project build tool (superceded by: invoke). Oct 23, 2016
datatype.features PREPARE: Update to behave 1.2.4a1 and parse_type Oct 24, 2013
docs.html UPDATE TO: behave-1.2.6 Feb 25, 2018
docs docs: Add behave-pytest as assertion matcher library. Nov 18, 2017
features FIX: Provide support for Python3. Local libdir=lib/python should now … Feb 16, 2016
lib/python UPDATE TO: behave-1.2.6 Feb 25, 2018
step_matcher.features CLEANUP: Old convention to use register_type(). Jul 10, 2014
tasks Improve compatibility w/ Windows cmd-shell Sep 22, 2017
.gitignore * Use sphinx ifconfig extensions: Add ansiterm_supported Nov 12, 2012
.pycheckrc INITIAL Feb 26, 2012
.pylintrc FIX #8: pylint no longer allows multiple 'ignore' options. Sep 6, 2018
.pythonrc.py INITIAL Feb 26, 2012
.travis.yml language: python May 16, 2012
MANIFEST.in INITIAL Feb 26, 2012
README.rst Update README.rst Feb 27, 2018
VERSION.txt Increment VERSION to (was: 1.2.5) Feb 16, 2016
behave.ini VERSION: 1.2.5 (was: 1.2.5a1) Jan 31, 2015
index.html Redirect to docs.html/index.html Feb 29, 2012
invoke.yaml Use invoke (to replace paver later-on) Oct 22, 2016
py.requirements.txt UPDATE TO: behave-1.2.6 Feb 25, 2018
setup.cfg PREPARE: Update to behave 1.2.4a1 and parse_type Oct 24, 2013
setup.py UPDATE TO: behave-1.2.6 Feb 25, 2018
setuptools_behave.py UPDATE to behave-1.2.5 Jan 31, 2015
tox.ini UPDATE: Make tox usable for next behave version Oct 23, 2016


behave.example: Examples and Tutorials

Date: 2016-10-22
Category:BDD, testing

behave is a BDD test framework and cucumber-clone for Python. This project provides tutorials and examples how to use behave. It should extends the excellent documentation of behave.



The project provides tutorials and examples. Therefore, it should not be installed. To prepare the local installation, use the following command to install all prerequisites:

pip install -r py.requirements.txt

Snapshots of the behave and parse_type implementations are provided in the directory lib/python/. This directory is automatically used when you use bin/behave to run behave.


Cleanup local workspace:

invoke clean

Run behave tests:

invoke test


bin/behave features/
bin/behave datatype.features/
bin/behave step_matcher.features/

Build Sphinx-based documentation with tutorials:

invoke docs

If invoke is not installed, use the following canned script instead:

bin/invoke command ...


  • The behave PrettyFormatter is replaced with pretty2.SimplePrettyFormatter.

    This formatter implementation avoids cursor-ups while processing steps. ANSI escape cursor-up sequences do not work with sphinxcontrib-ansi when the sphinx-based documentation is generated (experimental feature for colorized behave output support).

  • sphinxcontrib-ansi does not process the following ANSI escape sequences correctly (set-color, set-bold):


    The color is reset in HTML output when set-bold is detected. The following ANSI escape sequence should be used instead:


    The behave runner, that is used here, patches the original functionality to use the second solution ("use_ansi_escape_colorbold_composites()").

  • The coloring schema in behave is adapted by setting the environment variable ("grey" is replaced with "white"):

  • To disable "ANSI coloring" support for Sphinx, set "ansiterm_supported = False" in "docs/conf.py". Note that this is not necessary on Windows.