• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.ci/H25-Feb-2018-7161

behave/H25-Feb-2018-12,9019,689

behave.egg-info/H03-May-2022-150111

behave4cmd0/H25-Feb-2018-2,1781,450

bin/H25-Feb-2018-5,5115,048

docs/H25-Feb-2018-7,6895,299

etc/H25-Feb-2018-367321

examples/H25-Feb-2018-200142

features/H07-May-2022-15,06712,921

issue.features/H03-May-2022-6,8565,953

more.features/H25-Feb-2018-6952

py.requirements/H03-May-2022-

tasks/H03-May-2022-5,1043,725

test/H25-Feb-2018-6,7215,126

tests/H03-May-2022-3,0452,214

tools/test-features/H25-Feb-2018-283220

.bumpversion.cfgH A D25-Feb-2018260 108

.coveragercH A D25-Feb-20181 KiB4434

.editorconfigH A D25-Feb-2018564 2720

.pycheckrcH A D25-Feb-20185.5 KiB243165

.pylintrcH A D25-Feb-201812.6 KiB387264

.travis.ymlH A D25-Feb-20181.3 KiB5647

CHANGES.rstH A D25-Feb-201824.9 KiB513382

LICENSEH A D25-Feb-20181.3 KiB2420

MANIFEST.inH A D25-Feb-20181.1 KiB3836

PKG-INFOH A D25-Feb-20186.2 KiB150111

PROJECT_INFO.rstH A D25-Feb-20181.1 KiB2519

README.rstH A D25-Feb-20184 KiB12384

behave.iniH A D25-Feb-20181.4 KiB4339

conftest.pyH A D25-Feb-2018703 2818

invoke.yamlH A D25-Feb-2018537 2621

pytest.iniH A D25-Feb-2018815 2522

setup.cfgH A D25-Feb-2018402 3022

setup.pyH A D25-Feb-20184.2 KiB129103

setuptools_behave.pyH A D25-Feb-20184.7 KiB131107

tox.iniH A D25-Feb-20185.5 KiB162148

README.rst

1======
2Behave
3======
4
5.. image:: https://img.shields.io/travis/behave/behave/master.svg
6    :target: https://travis-ci.org/behave/behave
7    :alt: Travis CI Build Status
8
9.. image:: https://readthedocs.org/projects/behave/badge/?version=latest
10    :target: http://behave.readthedocs.io/en/latest/?badge=latest
11    :alt: Documentation Status
12
13.. image:: https://img.shields.io/pypi/v/behave.svg
14    :target: https://pypi.python.org/pypi/behave
15    :alt: Latest Version
16
17.. image:: https://img.shields.io/pypi/dm/behave.svg
18    :target: https://pypi.python.org/pypi/behave
19    :alt: Downloads
20
21.. image:: https://img.shields.io/pypi/l/behave.svg
22    :target: https://pypi.python.org/pypi/behave/
23    :alt: License
24
25.. image:: https://badges.gitter.im/Join%20Chat.svg
26   :alt: Join the chat at https://gitter.im/behave/behave
27   :target: https://gitter.im/behave/behave?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
28
29
30.. |logo| image:: https://raw.github.com/behave/behave/master/docs/_static/behave_logo1.png
31
32behave is behavior-driven development, Python style.
33
34|logo|
35
36Behavior-driven development (or BDD) is an agile software development
37technique that encourages collaboration between developers, QA and
38non-technical or business participants in a software project.
39
40*behave* uses tests written in a natural language style, backed up by Python
41code.
42
43First, `install *behave*.`_
44
45
46Now make a directory called "features/".
47In that directory create a file called "example.feature" containing:
48
49.. code-block:: gherkin
50
51    # -- FILE: features/example.feature
52    Feature: Showing off behave
53
54      Scenario: Run a simple test
55        Given we have behave installed
56         When we implement 5 tests
57         Then behave will test them for us!
58
59Make a new directory called "features/steps/".
60In that directory create a file called "example_steps.py" containing:
61
62.. code-block:: python
63
64    # -- FILE: features/steps/example_steps.py
65    from behave import given, when, then, step
66
67    @given('we have behave installed')
68    def step_impl(context):
69        pass
70
71    @when('we implement {number:d} tests')
72    def step_impl(context, number):  # -- NOTE: number is converted into integer
73        assert number > 1 or number == 0
74        context.tests_count = number
75
76    @then('behave will test them for us!')
77    def step_impl(context):
78        assert context.failed is False
79        assert context.tests_count >= 0
80
81Run behave:
82
83.. code-block:: bash
84
85    $ behave
86    Feature: Showing off behave # features/example.feature:2
87
88      Scenario: Run a simple test          # features/example.feature:4
89        Given we have behave installed     # features/steps/example_steps.py:4
90        When we implement 5 tests          # features/steps/example_steps.py:8
91        Then behave will test them for us! # features/steps/example_steps.py:13
92
93    1 feature passed, 0 failed, 0 skipped
94    1 scenario passed, 0 failed, 0 skipped
95    3 steps passed, 0 failed, 0 skipped, 0 undefined
96
97Now, continue reading to learn how to get the most out of *behave*. To get started,
98we recommend the `tutorial`_ and then the `feature testing language`_ and
99`api`_ references.
100
101
102.. _`Install *behave*.`: http://pythonhosted.org/behave/install.html
103.. _`tutorial`: http://pythonhosted.org/behave/tutorial.html#features
104.. _`feature testing language`: http://pythonhosted.org/behave/gherkin.html
105.. _`api`: http://pythonhosted.org/behave/api.html
106
107
108More Information
109-------------------------------------------------------------------------------
110
111* `behave documentation`_: `latest edition`_, `stable edition`_, `PDF`_
112* `behave.example`_: Behave Examples and Tutorials (docs, executable examples).
113* `changelog`_ (latest changes)
114
115
116.. _behave documentation: http://behave.readthedocs.io/
117.. _changelog:      https://github.com/behave/behave/blob/master/CHANGES.rst
118.. _behave.example: https://github.com/behave/behave.example
119
120.. _`latest edition`: http://behave.readthedocs.io/en/latest/
121.. _`stable edition`: http://behave.readthedocs.io/en/stable/
122.. _PDF:              https://media.readthedocs.org/pdf/behave/latest/behave.pdf
123