|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| .ci/ | H | 25-Feb-2018 | - | 71 | 61 |
| behave/ | H | 25-Feb-2018 | - | 12,901 | 9,689 |
| behave.egg-info/ | H | 03-May-2022 | - | 150 | 111 |
| behave4cmd0/ | H | 25-Feb-2018 | - | 2,178 | 1,450 |
| bin/ | H | 25-Feb-2018 | - | 5,511 | 5,048 |
| docs/ | H | 25-Feb-2018 | - | 7,689 | 5,299 |
| etc/ | H | 25-Feb-2018 | - | 367 | 321 |
| examples/ | H | 25-Feb-2018 | - | 200 | 142 |
| features/ | H | 07-May-2022 | - | 15,067 | 12,921 |
| issue.features/ | H | 03-May-2022 | - | 6,856 | 5,953 |
| more.features/ | H | 25-Feb-2018 | - | 69 | 52 |
| py.requirements/ | H | 03-May-2022 | - | | |
| tasks/ | H | 03-May-2022 | - | 5,104 | 3,725 |
| test/ | H | 25-Feb-2018 | - | 6,721 | 5,126 |
| tests/ | H | 03-May-2022 | - | 3,045 | 2,214 |
| tools/test-features/ | H | 25-Feb-2018 | - | 283 | 220 |
| .bumpversion.cfg | H A D | 25-Feb-2018 | 260 | 10 | 8 |
| .coveragerc | H A D | 25-Feb-2018 | 1 KiB | 44 | 34 |
| .editorconfig | H A D | 25-Feb-2018 | 564 | 27 | 20 |
| .pycheckrc | H A D | 25-Feb-2018 | 5.5 KiB | 243 | 165 |
| .pylintrc | H A D | 25-Feb-2018 | 12.6 KiB | 387 | 264 |
| .travis.yml | H A D | 25-Feb-2018 | 1.3 KiB | 56 | 47 |
| CHANGES.rst | H A D | 25-Feb-2018 | 24.9 KiB | 513 | 382 |
| LICENSE | H A D | 25-Feb-2018 | 1.3 KiB | 24 | 20 |
| MANIFEST.in | H A D | 25-Feb-2018 | 1.1 KiB | 38 | 36 |
| PKG-INFO | H A D | 25-Feb-2018 | 6.2 KiB | 150 | 111 |
| PROJECT_INFO.rst | H A D | 25-Feb-2018 | 1.1 KiB | 25 | 19 |
| README.rst | H A D | 25-Feb-2018 | 4 KiB | 123 | 84 |
| behave.ini | H A D | 25-Feb-2018 | 1.4 KiB | 43 | 39 |
| conftest.py | H A D | 25-Feb-2018 | 703 | 28 | 18 |
| invoke.yaml | H A D | 25-Feb-2018 | 537 | 26 | 21 |
| pytest.ini | H A D | 25-Feb-2018 | 815 | 25 | 22 |
| setup.cfg | H A D | 25-Feb-2018 | 402 | 30 | 22 |
| setup.py | H A D | 25-Feb-2018 | 4.2 KiB | 129 | 103 |
| setuptools_behave.py | H A D | 25-Feb-2018 | 4.7 KiB | 131 | 107 |
| tox.ini | H A D | 25-Feb-2018 | 5.5 KiB | 162 | 148 |
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