Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 544992 Details for
Bug 664576
dev-python/behave-1.2.5-r1 : [TEST] ValueError: cannot use LOCALE flag with a str pattern
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
dev-python:behave-1.2.5-r1:20180825-131615.log
dev-python:behave-1.2.5-r1:20180825-131615.log (text/plain), 776.58 KB, created by
Toralf Förster
on 2018-08-25 13:34:54 UTC
(
hide
)
Description:
dev-python:behave-1.2.5-r1:20180825-131615.log
Filename:
MIME Type:
Creator:
Toralf Förster
Created:
2018-08-25 13:34:54 UTC
Size:
776.58 KB
patch
obsolete
> * Package: dev-python/behave-1.2.5-r1 > * Repository: gentoo > * USE: abi_x86_64 amd64 elibc_glibc kernel_linux python_targets_python2_7 python_targets_python3_6 test userland_GNU > * FEATURES: network-sandbox preserve-libs sandbox test userpriv usersandbox >>>> Unpacking source... >>>> Unpacking behave-1.2.5.tar.gz to /var/tmp/portage/dev-python/behave-1.2.5-r1/work >>>> Source unpacked in /var/tmp/portage/dev-python/behave-1.2.5-r1/work >>>> Preparing source in /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5 ... >>>> Source prepared. >>>> Configuring source in /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5 ... >>>> Source configured. >>>> Compiling source in /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5 ... > * python2_7: running distutils-r1_run_phase distutils-r1_python_compile >python2.7 setup.py build >running build >running build_py >copying setuptools_behave.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/userdata.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/textutil.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/tag_matcher.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/tag_expression.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/step_registry.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/runner_util.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/runner.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/parser.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/model_describe.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/model.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/matchers.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/log_capture.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/json_parser.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/importer.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/i18n.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/configuration.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/_types.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/__main__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >copying behave/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/reporter >copying behave/reporter/summary.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/reporter >copying behave/reporter/junit.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/reporter >copying behave/reporter/base.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/reporter >copying behave/reporter/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/reporter >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/tags.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/steps.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/sphinx_util.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/sphinx_steps.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/rerun.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/progress.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/pretty.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/plain.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/null.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/json.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/formatters.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/base.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/ansi_escapes.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/_registry.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/_builtins.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/__filters.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >copying behave/formatter/__filter_formatter.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/formatter >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/compat >copying behave/compat/os_path.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/compat >copying behave/compat/importlib.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/compat >copying behave/compat/collections.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/compat >copying behave/compat/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python2_7/lib/behave/compat >warning: build_py: byte-compiling is disabled, skipping. > > * python3_6: running distutils-r1_run_phase distutils-r1_python_compile >python3.6 setup.py build >running build >running build_py >copying setuptools_behave.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/userdata.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/textutil.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/tag_matcher.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/tag_expression.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/step_registry.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/runner_util.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/runner.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/parser.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/model_describe.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/model.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/matchers.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/log_capture.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/json_parser.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/importer.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/i18n.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/configuration.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/_types.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/__main__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >copying behave/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter >copying behave/reporter/summary.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter >copying behave/reporter/junit.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter >copying behave/reporter/base.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter >copying behave/reporter/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/tags.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/steps.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/sphinx_util.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/sphinx_steps.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/rerun.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/progress.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/pretty.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/plain.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/null.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/json.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/formatters.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/base.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/ansi_escapes.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/_registry.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/_builtins.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/__filters.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >copying behave/formatter/__filter_formatter.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter >creating /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat >copying behave/compat/os_path.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat >copying behave/compat/importlib.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat >copying behave/compat/collections.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat >copying behave/compat/__init__.py -> /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat >Fixing /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/setuptools_behave.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/userdata.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/textutil.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/tag_matcher.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/tag_expression.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/step_registry.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/runner_util.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/runner.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/parser.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/model_describe.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/model.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/matchers.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/log_capture.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/json_parser.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/importer.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/i18n.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/configuration.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/_types.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/__main__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/__init__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/summary.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/junit.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/base.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/__init__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/tags.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/steps.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/sphinx_util.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/sphinx_steps.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/rerun.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/progress.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/pretty.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/plain.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/null.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/json.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/formatters.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/base.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/ansi_escapes.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/_registry.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/_builtins.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/__init__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/__filters.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/__filter_formatter.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/os_path.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/importlib.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/collections.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/__init__.py >Skipping optional fixer: buffer >Skipping optional fixer: idioms >Skipping optional fixer: set_literal >Skipping optional fixer: ws_comma >Fixing /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/setuptools_behave.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/userdata.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/textutil.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/tag_matcher.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/tag_expression.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/step_registry.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/runner_util.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/runner.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/parser.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/model_describe.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/model.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/matchers.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/log_capture.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/json_parser.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/importer.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/i18n.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/configuration.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/_types.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/__main__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/__init__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/summary.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/junit.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/base.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/reporter/__init__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/tags.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/steps.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/sphinx_util.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/sphinx_steps.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/rerun.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/progress.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/pretty.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/plain.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/null.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/json.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/formatters.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/base.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/ansi_escapes.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/_registry.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/_builtins.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/__init__.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/__filters.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/formatter/__filter_formatter.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/os_path.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/importlib.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/collections.py /var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5-python3_6/lib/behave/compat/__init__.py >Skipping optional fixer: buffer >Skipping optional fixer: idioms >Skipping optional fixer: set_literal >Skipping optional fixer: ws_comma >warning: build_py: byte-compiling is disabled, skipping. > > * python3_6: running distutils-r1_run_phase python_compile_all >>>> Source compiled. >>>> Test phase: dev-python/behave-1.2.5-r1 > * python2_7: running distutils-r1_run_phase python_test >....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... >---------------------------------------------------------------------- >Ran 615 tests in 1.013s > >OK >Feature: Active Tags # features/active_tags.feature:1 > As a test writer > I want that some tags are evaluated at runtime > So that some features/scenarios automatically excluded from the run-set. > | SPECIFICATION: Active tag > | * An active tag is evaluated at runtime. > | * An active tag is either enabled or disabled (decided by runtime decision logic). > | * A disabled active tag causes that its feature/scenario is excluded from the run-set. > | * If several active tags are used for a feature/scenario/scenario outline, > | the following tag logic is used: > | > | enabled = enabled1 and enabled2 and ... > | > | ACTIVE TAG SCHEMA (dialect1): > | @active.with_{category}={value} > | @not_active.with_{category}={value} > | > | ACTIVE TAG SCHEMA (dialect2): > | @use.with_{category}={value} > | @not.with_{category}={value} > | @only.with_{category}={value} > | > | RATIONALE: > | Some aspects of the runtime environment are only known > | when the tests are running. Therefore, it many cases it is simpler > | to use such a mechanism as "active tags" instead of moving this decision > | to the build-script that runs the tests. > | > | This allows to automatically skip some tests (scenarios, features) > | that would otherwise fail anyway. > | > | NOTE: > | * DRY-RUN MODE: Hooks are not called in dry-run mode. > @setup > Scenario: Feature Setup # features/active_tags.feature:39 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/pass_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > from behave.tag_matcher import ActiveTagMatcher > import sys > > # -- ACTIVE TAG SUPPORT: @use.with_{category}={value}, ... > active_tag_value_provider = { > "browser": "chrome", > "webserver": "apache", > } > active_tag_matcher = ActiveTagMatcher(active_tag_value_provider) > > def setup_active_tag_values(userdata): > for key in active_tag_value_provider.keys(): > if key in userdata: > active_tag_value_provider[key] = userdata[key] > > def before_all(context): > setup_active_tag_values(context.config.userdata) > > def before_scenario(context, scenario): > if active_tag_matcher.should_exclude_with(scenario.effective_tags): > sys.stdout.write("ACTIVE-TAG DISABLED: Scenario %s\n" % scenario.name) > scenario.skip(active_tag_matcher.exclude_reason) > """ > > Scenario: Use tag schema dialect2 with one category # features/active_tags.feature:75 > Given a file named "features/e1.active_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @use.with_browser=chrome > Scenario: Alice (Run only with Web-Browser Chrome) > Given a step passes > When another step passes > > @only.with_browser=safari > Scenario: Bob (Run only with Web-Browser Safari) > Given some step passes > """ > When I run "behave -f plain -T features/e1.active_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > ACTIVE-TAG DISABLED: Scenario Bob > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ACTIVE-TAG DISABLED: Scenario Alice > """ > > Scenario: Use tag schema dialect1 with several categories # features/active_tags.feature:105 > Given a file named "features/e2.active_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @active.with_webserver=apache > Scenario: Alice (Run only with Apache Web-Server) > Given a step passes > When another step passes > > @active.with_browser=safari > Scenario: Bob (Run only with Safari Web-Browser) > Given another step passes > """ > When I run "behave -f plain -D browser=firefox features/e2.active_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > ACTIVE-TAG DISABLED: Scenario Bob > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ACTIVE-TAG DISABLED: Scenario Alice > """ > > Scenario Outline: Use active tags with positive and negative logic: chrome -- @1.1 # features/active_tags.feature:165 > Given a file named "features/e3.active_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @active.with_browser=chrome > Scenario: Alice > Given a step passes > When another step passes > > @not_active.with_browser=opera > Scenario: Bob > Given another step passes > > @use.with_browser=safari > Scenario: Charly > Given some step passes > """ > When I run "behave -f plain -D browser=chrome features/e3.active_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > ACTIVE-TAG DISABLED: Scenario Charly > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ACTIVE-TAG DISABLED: Scenario Alice > """ > And note that "Bob is also enabled" # behave4cmd0/note_steps.py:15 > > Scenario Outline: Use active tags with positive and negative logic: firefox -- @1.2 # features/active_tags.feature:166 > Given a file named "features/e3.active_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @active.with_browser=chrome > Scenario: Alice > Given a step passes > When another step passes > > @not_active.with_browser=opera > Scenario: Bob > Given another step passes > > @use.with_browser=safari > Scenario: Charly > Given some step passes > """ > When I run "behave -f plain -D browser=firefox features/e3.active_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > ACTIVE-TAG DISABLED: Scenario Alice > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ACTIVE-TAG DISABLED: Scenario Bob > """ > And note that "Charly is also disabled" # behave4cmd0/note_steps.py:15 > > Scenario Outline: Use active tags with positive and negative logic: safari -- @1.3 # features/active_tags.feature:167 > Given a file named "features/e3.active_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @active.with_browser=chrome > Scenario: Alice > Given a step passes > When another step passes > > @not_active.with_browser=opera > Scenario: Bob > Given another step passes > > @use.with_browser=safari > Scenario: Charly > Given some step passes > """ > When I run "behave -f plain -D browser=safari features/e3.active_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > ACTIVE-TAG DISABLED: Scenario Alice > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ACTIVE-TAG DISABLED: Scenario Charly > """ > And note that "Bob is also enabled" # behave4cmd0/note_steps.py:15 > > Scenario: Tag logic with one active tag # features/active_tags.feature:170 > Given I setup the current values for active tags with # features/steps/behave_active_tags_steps.py:35 > | category | value | > | foo | xxx | > Then the following active tag combinations are enabled # features/steps/behave_active_tags_steps.py:51 > | tags | enabled? | > | @active.with_foo=xxx | yes | > | @active.with_foo=other | no | > | @not_active.with_foo=xxx | no | > | @not_active.with_foo=other | yes | > And the following active tag combinations are enabled # features/steps/behave_active_tags_steps.py:51 > | tags | enabled? | > | @use.with_foo=xxx | yes | > | @use.with_foo=other | no | > | @only.with_foo=xxx | yes | > | @only.with_foo=other | no | > | @not.with_foo=xxx | no | > | @not.with_foo=other | yes | > > Scenario: Tag logic with two active tags # features/active_tags.feature:190 > Given I setup the current values for active tags with # features/steps/behave_active_tags_steps.py:35 > | category | value | > | foo | xxx | > | bar | zzz | > Then the following active tag combinations are enabled # features/steps/behave_active_tags_steps.py:51 > | tags | enabled? | > | @use.with_foo=xxx @use.with_bar=zzz | yes | > | @use.with_foo=xxx @use.with_bar=other | no | > | @use.with_foo=other @use.with_bar=zzz | no | > | @use.with_foo=other @use.with_bar=other | no | > | @not.with_foo=xxx @use.with_bar=zzz | no | > | @not.with_foo=xxx @use.with_bar=other | no | > | @not.with_foo=other @use.with_bar=zzz | yes | > | @not.with_foo=other @use.with_bar=other | no | > | @use.with_foo=xxx @not.with_bar=zzz | no | > | @use.with_foo=xxx @not.with_bar=other | yes | > | @use.with_foo=other @not.with_bar=zzz | no | > | @use.with_foo=other @not.with_bar=other | no | > | @not.with_foo=xxx @not.with_bar=zzz | no | > | @not.with_foo=xxx @not.with_bar=other | no | > | @not.with_foo=other @not.with_bar=zzz | no | > | @not.with_foo=other @not.with_bar=other | yes | > > Scenario: Tag logic with unknown categories (case: ignored) # features/active_tags.feature:215 > Given I setup the current values for active tags with # features/steps/behave_active_tags_steps.py:35 > | category | value | > | foo | xxx | > When unknown categories are ignored in active tags # features/steps/behave_active_tags_steps.py:81 > Then the following active tag combinations are enabled # features/steps/behave_active_tags_steps.py:51 > | tags | enabled? | > | @use.with_unknown=xxx | yes | > | @use.with_unknown=zzz | yes | > | @not.with_unknown=xxx | yes | > | @not.with_unknown=zzz | yes | > But note that "the active tag with the unknown category acts like a passive tag" # behave4cmd0/note_steps.py:15 > > Scenario: Tag logic with unknown categories (case: not ignored) # features/active_tags.feature:234 > Given I setup the current values for active tags with # features/steps/behave_active_tags_steps.py:35 > | category | value | > | foo | xxx | > When unknown categories are not ignored in active tags # features/steps/behave_active_tags_steps.py:85 > Then the following active tag combinations are enabled # features/steps/behave_active_tags_steps.py:51 > | tags | enabled? | > | @use.with_unknown=xxx | no | > | @use.with_unknown=zzz | no | > | @not.with_unknown=xxx | yes | > | @not.with_unknown=zzz | yes | > But note that "the active tag with the unknown category is disabled" # behave4cmd0/note_steps.py:15 > >Feature: Background # features/background.feature:1 > As a test writer > I want to run a number of steps in each scenario > And I want to avoid duplicating these steps for each scenario > So that I write these steps only once (DRY principle). > | SPECIFICATION: > | * A feature can have an optional "Background" section > | * The Background must be specified before any Scenario/ScenarioOutline > | * The Background may occur at most once > | * The Background steps are executed in each Scenario/ScenarioOutline > | * The Background steps are executed before any Scenario steps > | * If a Background step fails then the is marked as scenario failed > | * If a Background fails in a scenario then other scenarios are still executed. > | > | RELATED: > | * parser.background.sad_cases.feature > | > | NOTE: > | Cucumber has a slightly different runtime behaviour. > | When a background step fails the first scenario is marked as failed. > | But the remaining scenarios are marked as skipped. > | > | This can lead to problems when you have sporadic background step failures. > | For this reason, behave retries the background steps for each scenario. > | But this may lead to an increased test duration if a systematic failure > | occurs in the failing background step. > | > | SEE ALSO: > | * https://github.com/cucumber/cucumber/blob/master/features/docs/gherkin/background.feature > @setup > Scenario: Feature Setup # features/background.feature:34 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/background_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word} background step passes') > def step_background_step_passes(context, word): > pass > > @step('{word} background step fails') > def step_background_step_fails(context, word): > assert False, "XFAIL: background step" > > @step('{word} background step fails sometimes') > def step_background_step_fails_sometimes(context, word): > should_fail = (context.scenarios_count % 2) == 0 > if should_fail: > step_background_step_fails(context, word) > """ > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word} step passes') > def step_passes(context, word): > pass > > @step('{word} step fails') > def step_fails(context, word): > assert False, "XFAIL" > """ > > Scenario: Feature with a Background and Scenarios # features/background.feature:67 > Given a file named "features/background_example1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Background: > Given a background step passes > And another background step passes > > Scenario: S1 > When a step passes > > Scenario: S2 > Then a step passes > And another step passes > """ > When I run "behave -f plain -T features/background_example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 7 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Background: > > Scenario: S1 > Given a background step passes ... passed > And another background step passes ... passed > When a step passes ... passed > > Scenario: S2 > Given a background step passes ... passed > And another background step passes ... passed > Then a step passes ... passed > And another step passes ... passed > """ > But note that "the Background steps are injected into each Scenario" # behave4cmd0/note_steps.py:15 > And note that "the Background steps are executed before any Scenario steps" # behave4cmd0/note_steps.py:15 > > Scenario: Failing Background Step causes all Scenarios to fail # features/background.feature:108 > Given a file named "features/background_fail_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > Background: B1 > Given a background step passes > And a background step fails > And another background step passes > > Scenario: S1 > When a step passes > > Scenario: S2 > Then a step passes > And another step passes > """ > When I run "behave -f plain -T features/background_fail_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 5 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Background: B1 > > Scenario: S1 > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > > Scenario: S2 > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > """ > And note that "the failing Background step causes all Scenarios to fail" # behave4cmd0/note_steps.py:15 > > Scenario: Failing Background Step does not prevent that other Scenarios are executed # features/background.feature:149 > Given a file named "features/background_fails_sometimes_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > Background: B2 > Given a background step fails sometimes > > Scenario: S1 > Given a step passes > > Scenario: S2 > When another step passes > > Scenario: S3 > Then another step passes > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > scenarios_count = 0 > > def before_scenario(context, scenario): > global scenarios_count > context.scenarios_count = scenarios_count > scenarios_count += 1 > """ > When I run "behave -f plain -T features/background_fails_sometimes_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 2 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Background: B2 > > Scenario: S1 > Given a background step fails sometimes ... failed > Assertion Failed: XFAIL: background step > > Scenario: S2 > Given a background step fails sometimes ... passed > When another step passes ... passed > > Scenario: S3 > Given a background step fails sometimes ... failed > Assertion Failed: XFAIL: background step > """ > > Scenario: Feature with a Background and ScenarioOutlines # features/background.feature:204 > Given a file named "features/background_outline_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Background: > Given a background step passes > And another background step passes > > Scenario Outline: SO1 > When a step <outcome1> > Then another step <outcome2> > > Examples: Alpha > | outcome1 | outcome2 | > | passes | passes | > | passes | passes | > > Scenario Outline: SO2 > Given <word1> step passes > Then <word2> step passes > > Examples: > | word1 | word2 | > | a | a | > | a | another | > | another | a | > """ > When I run "behave -f plain -T features/background_outline_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 5 scenarios passed, 0 failed, 0 skipped > 20 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Background: > > Scenario Outline: SO1 -- @1.1 Alpha > Given a background step passes ... passed > And another background step passes ... passed > When a step passes ... passed > Then another step passes ... passed > > Scenario Outline: SO1 -- @1.2 Alpha > Given a background step passes ... passed > And another background step passes ... passed > When a step passes ... passed > Then another step passes ... passed > > Scenario Outline: SO2 -- @1.1 > Given a background step passes ... passed > And another background step passes ... passed > Given a step passes ... passed > Then a step passes ... passed > > Scenario Outline: SO2 -- @1.2 > Given a background step passes ... passed > And another background step passes ... passed > Given a step passes ... passed > Then another step passes ... passed > > Scenario Outline: SO2 -- @1.3 > Given a background step passes ... passed > And another background step passes ... passed > Given another step passes ... passed > Then a step passes ... passed > """ > But note that "the Background steps are injected into each ScenarioOutline" # behave4cmd0/note_steps.py:15 > And note that "the Background steps are executed before any ScenarioOutline steps" # behave4cmd0/note_steps.py:15 > > Scenario: Failing Background Step causes all ScenarioOutlines to fail # features/background.feature:276 > Given a file named "features/background_fail_outline_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Background: > Given a background step passes > And a background step fails > But another background step passes > > Scenario Outline: SO1 > When a step <outcome1> > Then another step <outcome2> > > Examples: Alpha > | outcome1 | outcome2 | > | passes | passes | > | passes | fails | > | fails | passes | > | fails | fails | > > Scenario Outline: SO2 > When <word1> step passes > > Examples: Beta > | word1 | > | a | > | another | > """ > When I run "behave -f plain -T features/background_fail_outline_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 6 failed, 0 skipped > 6 steps passed, 6 failed, 16 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Background: > > Scenario Outline: SO1 -- @1.1 Alpha > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > > Scenario Outline: SO1 -- @1.2 Alpha > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > > Scenario Outline: SO1 -- @1.3 Alpha > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > > Scenario Outline: SO1 -- @1.4 Alpha > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > > Scenario Outline: SO2 -- @1.1 Beta > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > > Scenario Outline: SO2 -- @1.2 Beta > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > """ > But note that "the failing Background step causes each ScenarioOutline to be marked as skipped" # behave4cmd0/note_steps.py:15 > > Scenario: Feature with Background after first Scenario should fail (SAD CASE) # features/background.feature:348 > Given a file named "features/background_sad_example1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: S1 > When a step passes > > Background: B1 > Given a background step passes > > Scenario: S2 > Then a step passes > And another step passes > """ > When I run "behave -f plain -T features/background_sad_example1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Parser failure in state steps, at line 5: 'Background: B1' > REASON: Background may not occur after Scenario/ScenarioOutline. > """ > > Scenario: Feature with two Backgrounds should fail (SAD CASE) # features/background.feature:370 > Given a file named "features/background_sad_example2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Background: B1 > Given a background step passes > > Background: B2 (XFAIL) > Given another background step passes > > Scenario: S1 > When a step passes > > Scenario: S2 > Then a step passes > And another step passes > """ > When I run "behave -f plain -T features/background_sad_example2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Parser failure in state steps, at line 5: 'Background: B2 (XFAIL)' > REASON: Background should not be used here. > """ > >@sequential >Feature: Capture stderr output and show it in case of failures/errors # features/capture_stderr.feature:2 > As a tester > To simplify failure diagnostics > I want that: > - captured output is displayed only when failures/errors occur > - all output is displayed when capture is disabled > (but may clutter up formatter output) > @setup > Scenario: Test Setup # features/capture_stderr.feature:12 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/stderr_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step('a step writes "{text}" to stderr and passes') > def step_writes_to_stderr_and_passes(context, text): > sys.stderr.write("stderr:%s;\n" % text) > > @step('a step writes "{text}" to stderr and fails') > def step_writes_to_stderr_and_fails(context, text): > sys.stderr.write("stderr:%s;\n" % text) > assert False, "XFAIL, step with: %s;" % text > """ > And a file named "features/capture_stderr.example1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes > When a step writes "Bob" to stderr and passes > Then a step writes "Charly" to stderr and passes > """ > And a file named "features/capture_stderr.example2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes > When a step writes "Bob" to stderr and fails > Then a step writes "Charly" to stderr and fails > """ > > @capture > Scenario: Captured output is suppressed if scenario passes (CASE 1: --capture) # features/capture_stderr.feature:47 > When I run "behave -f plain -T --capture features/capture_stderr.example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes ... passed > When a step writes "Bob" to stderr and passes ... passed > Then a step writes "Charly" to stderr and passes ... passed > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stderr:Alice; > """ > > @capture > Scenario: Captured output is suppressed if scenario passes (CASE 2: --capture-stderr) # features/capture_stderr.feature:64 > When I run "behave -f plain -T --capture-stderr features/capture_stderr.example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes ... passed > When a step writes "Bob" to stderr and passes ... passed > Then a step writes "Charly" to stderr and passes ... passed > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stderr:Alice; > """ > > @capture > Scenario: Captured output is shown up to first failure if scenario fails (CASE 1: --capture) # features/capture_stderr.feature:81 > When I run "behave -f plain -T --capture features/capture_stderr.example2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes ... passed > When a step writes "Bob" to stderr and fails ... failed > Assertion Failed: XFAIL, step with: Bob; > Captured stderr: > stderr:Alice; > stderr:Bob; > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stderr:Charly; > """ > > @capture > Scenario: Captured output is shown if scenario fails up to first failure (CASE 2: --capture-stderr) # features/capture_stderr.feature:105 > When I run "behave -f plain -T --capture-stderr features/capture_stderr.example2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes ... passed > When a step writes "Bob" to stderr and fails ... failed > Assertion Failed: XFAIL, step with: Bob; > Captured stderr: > stderr:Alice; > stderr:Bob; > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stderr:Charly; > """ > > @no_capture > Scenario: All output is shown when --no-capture-stderr is used and all steps pass (CASE 1) # features/capture_stderr.feature:129 > When I run "behave -f plain -T --no-capture-stderr features/capture_stderr.example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > stderr:Alice; > stderr:Bob; > stderr:Charly; > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes ... passed > When a step writes "Bob" to stderr and passes ... passed > Then a step writes "Charly" to stderr and passes ... passed > """ > > @no_capture > Scenario: All output is shown up to first failing step when --no-capture-stderr is used (CASE 2) # features/capture_stderr.feature:149 > When I run "behave -f plain -T --no-capture-stderr features/capture_stderr.example2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stderr and passes ... passed > When a step writes "Bob" to stderr and fails ... failed > Assertion Failed: XFAIL, step with: Bob; > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > stderr:Alice; > stderr:Bob; > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stderr:Charly; > """ > >@sequential >Feature: Capture stdout output and show it in case of failures/errors # features/capture_stdout.feature:2 > As a tester > To simplify failure diagnostics > I want that: > - captured output is displayed only when failures/errors occur > - all output is displayed when capture is disabled > (but may clutter up formatter output) > @setup > Scenario: Test Setup # features/capture_stdout.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/stdout_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step('a step writes "{text}" to stdout and passes') > def step_writes_to_stdout_and_passes(context, text): > sys.stdout.write("stdout:%s;\n" % text) > > @step('a step writes "{text}" to stdout and fails') > def step_writes_to_stdout_and_fails(context, text): > sys.stdout.write("stdout:%s;\n" % text) > assert False, "XFAIL, step with: %s;" % text > """ > And a file named "features/capture_stdout.example1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step writes "Alice" to stdout and passes > When a step writes "Bob" to stdout and passes > Then a step writes "Charly" to stdout and passes > """ > And a file named "features/capture_stdout.example2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step writes "Alice" to stdout and passes > When a step writes "Bob" to stdout and fails > Then a step writes "Charly" to stdout and fails > """ > > @capture > Scenario: Captured output is suppressed if scenario passes # features/capture_stdout.feature:48 > When I run "behave -f plain -T --capture features/capture_stdout.example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stdout and passes ... passed > When a step writes "Bob" to stdout and passes ... passed > Then a step writes "Charly" to stdout and passes ... passed > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stdout:Alice; > """ > > @capture > Scenario: Captured output is shown up to first failure if scenario fails # features/capture_stdout.feature:65 > When I run "behave -f plain -T --capture features/capture_stdout.example2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step writes "Alice" to stdout and passes ... passed > When a step writes "Bob" to stdout and fails ... failed > Assertion Failed: XFAIL, step with: Bob; > Captured stdout: > stdout:Alice; > stdout:Bob; > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stdout:Charly; > """ > > @no_capture > Scenario: All output is shown when --no-capture is used and all steps pass (CASE 1) # features/capture_stdout.feature:89 > When I run "behave -f plain -T --no-capture features/capture_stdout.example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > stdout:Alice; > Given a step writes "Alice" to stdout and passes ... passed > stdout:Bob; > When a step writes "Bob" to stdout and passes ... passed > stdout:Charly; > Then a step writes "Charly" to stdout and passes ... passed > """ > > @no_capture > Scenario: All output is shown up to first failing step when --no-capture is used (CASE 2) # features/capture_stdout.feature:106 > When I run "behave -f plain -T --no-capture features/capture_stdout.example2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > stdout:Alice; > Given a step writes "Alice" to stdout and passes ... passed > stdout:Bob; > When a step writes "Bob" to stdout and fails ... failed > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > stdout:Charly; > """ > >@sequential >Feature: Default paths for features in behave configfile # features/configuration.default_paths.feature:2 > As a tester > I want to specify the default paths for features in the configuration file > That should be used if none are provided as command-line args > To support pre-pared/canned test environments > (and to support my laziness while using behave in a shell). > @setup > Scenario: Test Setup # features/configuration.default_paths.feature:12 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > When a step passes > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > When a step passes > """ > And a file named "more.features/charly.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Charly > Scenario: C1 > Then a step passes > """ > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > show_timings = false > paths = features/bob.feature > more.features/charly.feature > """ > > Scenario: Used default paths from behave configfile # features/configuration.default_paths.feature:50 > When I run "behave -f plain" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > Scenario: B1 > When a step passes ... passed > > Feature: Charly > Scenario: C1 > Then a step passes ... passed > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > """ > > Scenario: Command-line args can override default paths in configfile # features/configuration.default_paths.feature:72 > When I run "behave -f plain features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Bob > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Charly > """ > > Scenario: Command-line args are provided (CASE 2) # features/configuration.default_paths.feature:94 > When I run "behave -f plain features" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Charly > """ > >Feature: Global Context Parameters defined in "environment.py" # features/context.global_params.feature:1 > | Specification: > | * When a Context parameter is defined in "environment.py", > | its value is provided to all scenarios (steps). > | * Each scenario has the same global parameters (and values). > | * A scenario (step) may modify global parameters (values). > | * After a scenario is executed all changes to Context parameters are reverted. > Scenario: Test Setup Description (Example) # features/context.global_params.feature:10 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.global_name = "env:Alice" > context.global_age = 12 > """ > > Scenario: Modify global Context parameter in Scenario Step # features/context.global_params.feature:18 > Given the behave context contains # features/steps/behave_context_steps.py:65 > | Parameter | Value | > | global_name | "env:Alice" | > | global_age | 12 | > When I set the context parameter "global_name" to "step:Bob" # features/steps/behave_context_steps.py:25 > Then the behave context should contain # features/steps/behave_context_steps.py:53 > | Parameter | Value | > | global_name | "step:Bob" | > | global_age | 12 | > > Scenario: Ensure that Global Context parameter is reset for next Scenario # features/context.global_params.feature:29 > Then the behave context should have a parameter "global_name" # features/steps/behave_context_steps.py:45 > And the behave context should contain # features/steps/behave_context_steps.py:53 > | Parameter | Value | > | global_name | "env:Alice" | > | global_age | 12 | > >Feature: Local Context Parameters defined in Scenarios (Steps) # features/context.local_params.feature:1 > | Specification: > | * When a step adds/modifies an attribute in the Context object, > | then its value is only available to other steps in this scenario. > | * After a scenario is executed all Context object changes are undone. > Scenario: Add Local Context parameter in Scenario/Step # features/context.local_params.feature:8 > Given the behave context does not have a parameter "local_name" # features/steps/behave_context_steps.py:41 > When I set the context parameter "local_name" to "Alice" # features/steps/behave_context_steps.py:25 > Then the behave context should have a parameter "local_name" # features/steps/behave_context_steps.py:45 > And the behave context should contain # features/steps/behave_context_steps.py:53 > | Parameter | Value | > | local_name | "Alice" | > > Scenario: Ensure that Local Context parameter is not available to next Scenario # features/context.local_params.feature:16 > Then the behave context should not have a parameter "local_name" # features/steps/behave_context_steps.py:49 > >Feature: Advanced, more complex directory layout (Variant 2) # features/directory_layout.advanced.feature:1 > As a story/test writer > I want a deeper, more structured directory structure when many feature files exist > So that I have the parts better under control (more managable) > | ADVANCED, MORE COMPLEX DIRECTORY LAYOUT STRUCTURE: > | features/ > | +-- group1.features/ > | | +-- *.feature > | +-- group2.features/ > | | +-- *.feature > | +-- steps/*.py # Step definitions or step-library imports. > | +-- environment.py # OPTIONAL: environment setup/hooks. > | > | SEE ALSO: > | * http://pythonhosted.org/behave/gherkin.html#layout-variations > | > | RELATED: > | * issue #99: Layout variation "a directory containing your feature files" ... > @setup > Scenario: Setup directory structure # features/directory_layout.advanced.feature:23 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL-STEP" > """ > And a file named "features/steps/environment_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('environment setup was done') > def step_ensure_environment_setup(context): > assert context.setup_magic == 42 > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.setup_magic = 42 > """ > And a file named "features/group1/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > When another step passes > Then a step passes > > Scenario: A2 > Then environment setup was done > """ > And a file named "features/group1/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > When a step passes > Then another step passes > """ > And a file named "features/group2/charly.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Charly > Scenario: C1 > Given another step passes > Then a step passes > """ > > Scenario: Run behave with feature directory # features/directory_layout.advanced.feature:77 > When I run "behave -f progress features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 3 features passed, 0 failed, 0 skipped > 4 scenarios passed, 0 failed, 0 skipped > 8 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with feature subdirectory (CASE 1) # features/directory_layout.advanced.feature:86 > When I run "behave -f progress features/group1/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with feature subdirectory (CASE 2) # features/directory_layout.advanced.feature:95 > When I run "behave -f progress features/group2/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with one feature file # features/directory_layout.advanced.feature:104 > When I run "behave -f progress features/group1/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 4 steps passed, 0 failed, 0 skipped, 0 undefined > """ > When I run "behave -f progress features/group2/charly.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with two feature files (CASE 1) # features/directory_layout.advanced.feature:121 > Given a file named "one.featureset" with # behave4cmd0/command_steps.py:50 > """ > features/group1/alice.feature > features/group2/charly.feature > """ > When I run "behave -f progress @one.featureset" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with two feature files (CASE 2: different ordering) # features/directory_layout.advanced.feature:135 > Given a file named "two.featureset" with # behave4cmd0/command_steps.py:50 > """ > features/group2/charly.feature > features/group1/alice.feature > """ > When I run "behave -f progress @two.featureset" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >Feature: Basic directory layout (Variant 1) # features/directory_layout.basic.feature:1 > As a story/test writer > I want a simple, non-deep directory structure > So that I can easily get an overview which stories/tests exist > | BASIC DIRECTORY LAYOUT STRUCTURE: > | features/ > | +-- steps/*.py # Step definitions or step-library imports. > | +-- *.feature # Feature files. > | +-- environment.py # OPTIONAL: environment setup/hooks. > | > | SEE ALSO: > | * http://pythonhosted.org/behave/gherkin.html#layout-variations > @setup > Scenario: Setup directory structure # features/directory_layout.basic.feature:18 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL-STEP" > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > When another step passes > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > When a step passes > Then another step passes > """ > > Scenario: Run behave with feature directory # features/directory_layout.basic.feature:49 > When I run "behave -f progress features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 5 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with one feature file # features/directory_layout.basic.feature:58 > When I run "behave -f progress features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with two feature files # features/directory_layout.basic.feature:68 > When I run "behave -f progress features/alice.feature features/bob.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 5 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >Feature: Basic directory layout (Variant 1B) # features/directory_layout.basic2.feature:1 > As a story/test writer > I want a simple, non-deep directory structure > So that I can easily get an overview which stories/tests exist > | BASIC DIRECTORY LAYOUT STRUCTURE: > | testing/features/ > | +-- steps/*.py # Step definitions or step-library imports. > | +-- *.feature # Feature files. > | +-- environment.py # OPTIONAL: environment setup/hooks. > | > | SEE ALSO: > | * http://pythonhosted.org/behave/gherkin.html#layout-variations > @setup > Scenario: Setup directory structure # features/directory_layout.basic2.feature:18 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "testing/features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL-STEP" > """ > And a file named "testing/features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > When another step passes > Then a step passes > """ > And a file named "testing/features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > When a step passes > Then another step passes > """ > > Scenario: Run behave with testing directory # features/directory_layout.basic2.feature:49 > When I run "behave -f progress testing/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > ConfigError: No steps directory in "{__WORKDIR__}/testing" > """ > > Scenario: Run behave with feature subdirectory # features/directory_layout.basic2.feature:56 > When I run "behave -f progress testing/features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 5 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with one feature file # features/directory_layout.basic2.feature:65 > When I run "behave -f progress testing/features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run behave with two feature files # features/directory_layout.basic2.feature:75 > Given a file named "one.featureset" with # behave4cmd0/command_steps.py:50 > """ > testing/features/alice.feature > testing/features/bob.feature > """ > When I run "behave -f progress @one.featureset" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 5 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >Feature: Exploratory Testing with Tables and Table Annotations # features/exploratory_testing.with_table.feature:1 > As a tester > I want sometimes to explore a problem domain > And see not only the expected results > But also the actual results in a table. > | HINT: Does not work with monochrome format in pretty formatter: > | behave -f pretty --no-color ... > | behave -c ... > @setup > Scenario: Feature Setup # features/exploratory_testing.with_table.feature:14 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/explore_with_table_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then, step > > database = { > "Alice": { "age": 10 }, > "Bob": { "age": 11 }, > } > > @when('I query the database with') > def step_query_database_and_update_table(context): > assert context.table, "REQUIRE: table" > context.table.require_column("Name") > age_index = context.table.ensure_column_exists("Age") > for index, row in enumerate(context.table.rows): > name = row["Name"] > person = database.get(name, None) > if person: > row.cells[age_index] = str(person["age"]) > context.current_table = context.table > > @when('I add {number:n} to column "{column}"') > def step_query_and_annotate_database(context, number, column): > assert context.current_table, "REQUIRE: current_table" > age_index = context.current_table.ensure_column_exists("Age") > for row in context.current_table.rows: > value = int(row.cells[age_index]) or 0 > row.cells[age_index] = str(value + number) > > @step('note that the "{name}" column was added to the table') > def step_note_that_column_was_added(context, name): > assert context.current_table.has_column(name) > > @then('note that the "{name}" column was modified in the table') > def step_note_that_column_was_modified(context, name): > pass > > @then('I inspect the table') > def step_inspect_table(context): > assert context.current_table > context.table = context.current_table > > @then('the table contains') > def step_inspect_table(context): > assert context.table, "REQUIRE: table" > assert context.current_table, "REQUIRE: current_table" > assert context.table == context.current_table > """ > > Scenario: Add table column with new data in a step and ensure changes are shown # features/exploratory_testing.with_table.feature:66 > Given a file named "features/table.set_column_data.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When I query the database with: > | Name | > | Alice | > | Bob | > Then note that the "Age" column was added to the table > """ > When I run "behave -f plain features/table.set_column_data.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > | Name | Age | > | Alice | 10 | > | Bob | 11 | > """ > But note that "the Age table column was added by the step" # behave4cmd0/note_steps.py:15 > > Scenario: Modify table cells in a column and ensure changes are shown # features/exploratory_testing.with_table.feature:92 > Given a file named "features/table.modify_column.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When I query the database with: > | Name | Age | > | Alice | 222 | > | Bob | 333 | > Then note that the "Age" column was modified in the table > Then the table contains: > | Name | Age | > | Alice | 10 | > | Bob | 11 | > """ > When I run "behave -f plain features/table.modify_column.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > | Name | Age | > | Alice | 10 | > | Bob | 11 | > """ > But note that "the Age column was modified in the table" # behave4cmd0/note_steps.py:15 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > | Name | Age | > | Alice | 222 | > | Bob | 333 | > """ > > Scenario: Modify table cells in a column (formatter=pretty with colors) # features/exploratory_testing.with_table.feature:128 > When I run "behave -f pretty features/table.modify_column.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > | Name | Age | > | Alice | 10 | > | Bob | 11 | > """ > But note that "the Age column was modified in the table" # behave4cmd0/note_steps.py:15 > >Feature: Exclude Feature from Test Run # features/feature.exclude_from_run.feature:1 > As a test writer > I want sometimes to decide at runtime > that a feature is excluded from a test run > So that the command-line configuration becomes simpler > (and auto-configuration is supported). > | MECHANISM: > | The "before_feature()" hook can decide just before a feature should run > | that the feature should be excluded from the test-run. > | NOTE: Hooks are not called in dry-run mode. > | > | RATIONALE: > | There are certain situations where it is better to skip a feature > | than to run and fail the feature. > | > | Reasons for these cases are of often test environment related: > | * test environment does not fulfill the desired criteria > | * used testbed does not fulfill test requirements > | > | Instead of providing the exclude-feature selection on the command-line, > | the test (environment) and configuration logic should determine > | if a test should be excluded (as auto-configuration functionality). > | > | EXAMPLE: > | Certain features should not run on Windows (or Linux, ...). > | > | EVALUATION ORDER: > | Before the user can exclude a feature from a test-run, > | additional mechanisms decide, if the feature is part of the selected run-set. > | These are: > | * tags > | * ... > | > | RELATED: > | * features/scenario.exclude_from_run.feature > @setup > Scenario: # features/feature.exclude_from_run.feature:41 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: Alice in Wonderland > Given a step passes > When another step passes > Then some step passes > > Scenario: Alice and Bob > Given another step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: Bob in Berlin > Given some step passes > When another step passes > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > """ > > Scenario: Exclude a feature from the test run (using: before_feature() hook) # features/feature.exclude_from_run.feature:71 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > import sys > > def should_exclude_feature(feature): > if "Alice" in feature.name: > return True > return False > > def before_feature(context, feature): > if should_exclude_feature(feature): > sys.stdout.write("EXCLUDED-BY-USER: Feature %s\n" % feature.name) > feature.skip() > """ > When I run "behave -f plain -T features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 1 skipped > 1 scenario passed, 0 failed, 2 skipped > 2 steps passed, 0 failed, 4 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > EXCLUDED-BY-USER: Feature Alice > """ > >Feature: Help Formatter # features/formatter.help.feature:1 > As a tester > I want to know which formatter are supported > To be able to select one. > Scenario: # features/formatter.help.feature:7 > Given a new working directory # behave4cmd0/command_steps.py:30 > When I run "behave --format=help" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Available formatters: > json JSON dump of test run > json.pretty JSON dump of test run (human readable) > null Provides formatter that does not output anything. > plain Very basic formatter with maximum compatibility > pretty Standard colourised pretty formatter > progress Shows dotted progress for each executed scenario. > progress2 Shows dotted progress for each executed step. > progress3 Shows detailed progress for each step of a scenario. > rerun Emits scenario file locations of failing scenarios > sphinx.steps Generate sphinx-based documentation for step definitions. > steps Shows step definitions (step implementations). > steps.catalog Shows non-technical documentation for step definitions. > steps.doc Shows documentation for step definitions. > steps.usage Shows how step definitions are used by steps. > tags Shows tags (and how often they are used). > tags.location Shows tags and the location where they are used. > """ > >@sequential >Feature: JSON Formatter # features/formatter.json.feature:2 > In order to process data with other tools > As a tester > I want that behave generates test run data in JSON format. > @setup > Scenario: Feature Setup # features/formatter.json.feature:10 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL-STEP" > """ > > Scenario: Use JSON formatter on simple feature # features/formatter.json.feature:25 > Given a file named "features/simple_feature_with_name.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Simple, empty Feature > """ > When I run "behave -f json.pretty features/simple_feature_with_name.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 1 skipped > 0 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > [ > { > "keyword": "Feature", > "location": "features/simple_feature_with_name.feature:1", > "name": "Simple, empty Feature", > "status": "skipped", > "tags": [] > } > ] > """ > > Scenario: Use JSON formatter on simple feature with description # features/formatter.json.feature:49 > Given a file named "features/simple_feature_with_description.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Simple feature with description > > First feature description line. > Second feature description line. > > Third feature description line (following an empty line). > """ > When I run "behave -f json.pretty features/simple_feature_with_description.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 1 skipped > 0 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > [ > { > "description": [ > "First feature description line.", > "Second feature description line.", > "Third feature description line (following an empty line)." > ], > "keyword": "Feature", > "location": "features/simple_feature_with_description.feature:1", > "name": "Simple feature with description", > "status": "skipped", > "tags": [] > } > ] > """ > > Scenario: Use JSON formatter on simple feature with tags # features/formatter.json.feature:83 > Given a file named "features/simple_feature_with_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > @foo @bar > Feature: Simple feature with tags > """ > When I run "behave -f json.pretty features/simple_feature_with_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 1 skipped > 0 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > [ > { > "keyword": "Feature", > "location": "features/simple_feature_with_tags.feature:2", > "name": "Simple feature with tags", > "status": "skipped", > "tags": [ > "foo", > "bar" > ] > } > ] > """ > > Scenario: Use JSON formatter with feature and one scenario without steps # features/formatter.json.feature:111 > Given a file named "features/simple_scenario.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Simple scenario without steps > """ > When I run "behave -f json.pretty features/simple_scenario.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > [ > { > "elements": [ > { > "keyword": "Scenario", > "location": "features/simple_scenario.feature:2", > "name": "Simple scenario without steps", > "steps": [], > "tags": [], > "type": "scenario" > } > ], > "keyword": "Feature", > "location": "features/simple_scenario.feature:1", > "name": "", > "status": "passed", > "tags": [] > } > ] > """ > > Scenario: Use JSON formatter with feature and one scenario with description # features/formatter.json.feature:146 > Given a file named "features/simple_scenario_with_description.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Simple scenario with description but without steps > > First scenario description line. > Second scenario description line. > > Third scenario description line (after an empty line). > """ > When I run "behave -f json.pretty features/simple_scenario_with_description.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > [ > { > "elements": [ > { > "description": [ > "First scenario description line.", > "Second scenario description line.", > "Third scenario description line (after an empty line)." > ], > "keyword": "Scenario", > "location": "features/simple_scenario_with_description.feature:2", > "name": "Simple scenario with description but without steps", > "steps": [], > "tags": [], > "type": "scenario" > } > ], > "keyword": "Feature", > "location": "features/simple_scenario_with_description.feature:1", > "name": "", > "status": "passed", > "tags": [] > } > ] > """ > > Scenario: Use JSON formatter with feature and one scenario with tags # features/formatter.json.feature:191 > Given a file named "features/simple_scenario_with_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @foo > @bar > Scenario: Simple scenario with tags but without steps > """ > When I run "behave -f json.pretty features/simple_scenario_with_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > [ > { > "elements": [ > { > "keyword": "Scenario", > "location": "features/simple_scenario_with_tags.feature:5", > "name": "Simple scenario with tags but without steps", > "steps": [], > "tags": [ > "foo", > "bar" > ], > "type": "scenario" > } > ], > "keyword": "Feature", > "location": "features/simple_scenario_with_tags.feature:1", > "name": "", > "status": "passed", > "tags": [] > } > ] > """ > > Scenario: Use JSON formatter with type-converted step parameters # features/formatter.json.feature:233 > Given a file named "features/step_params_with_type_converter.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Use type converter > Given "1+2j" as complex number > And "red" as color > """ > And a file named "features/steps/type_converter_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, register_type > import parse > > # -- TYPES AND TYPE CONVERTERS: > class Color(object): > def __init__(self, color_name): > self.name = color_name > > @parse.with_pattern("\w+") > def parse_color(text): > return Color(text.strip()) > > @parse.with_pattern(".+") > def parse_complex(text): > return complex(text) > > register_type(Color=parse_color) > register_type(Complex=parse_complex) > > # -- STEPS: > @step('"{number:Complex}" as complex number') > def step_complex_number(context, number): > context.number = number > > @step('"{color:Color}" as color') > def step_color(context, color): > context.color = color > """ > When I run "behave -f json.pretty features/step_params_with_type_converter.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > "match": { > "arguments": [ > { > "name": "number", > "value": "1+2j" > } > ], > "location": "features/steps/type_converter_steps.py:21" > }, > "name": "\"1+2j\" as complex number", > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > "match": { > "arguments": [ > { > "name": "color", > "value": "red" > } > ], > "location": "features/steps/type_converter_steps.py:25" > }, > "name": "\"red\" as color", > """ > But note that "both matched arguments.values are provided as string" # behave4cmd0/note_steps.py:15 > > @wip > Scenario: Use JSON formatter with feature and two scenarios # features/formatter.json.feature:405 > > @wip > Scenario: Use JSON formatter with feature and background # features/formatter.json.feature:408 > > @wip > Scenario: Use JSON formatter with feature and scenario outline without steps # features/formatter.json.feature:411 > > Scenario: Use JSON formatter with feature and scenario outline with description # features/formatter.json.feature:412 > > Scenario: Use JSON formatter with feature and scenario outline with tags # features/formatter.json.feature:413 > > Scenario: Use JSON formatter with feature and scenario outline with steps # features/formatter.json.feature:414 > > Scenario: Use JSON formatter with feature and scenario outline with steps and examples # features/formatter.json.feature:415 > >@sequential >Feature: Progress3 Formatter # features/formatter.progress3.feature:2 > In order to effectively analyze output of many runs > As a tester > I want that behave generates to present results for each scenario > @setup > Scenario: Feature Setup # features/formatter.progress3.feature:9 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL-STEP" > > @step(u'a step raises an error "{message}"') > def step_raises_exception(context, message): > raise RuntimeError(message) > """ > > Scenario: Use Progress3 formatter on simple feature # features/formatter.progress3.feature:28 > Given a file named "features/simple_feature_with_name.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Simple, empty Feature > """ > When I run "behave -f progress3 features/simple_feature_with_name.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 1 skipped > 0 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Simple, empty Feature # features/simple_feature_with_name.feature > """ > > Scenario: Use Progress3 formatter with feature and one scenario without steps # features/formatter.progress3.feature:44 > Given a file named "features/simple_scenario.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Simple feature with one scenario > Scenario: Simple scenario without steps > """ > When I run "behave -f progress3 features/simple_scenario.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Simple feature with one scenario # features/simple_scenario.feature > Simple scenario without steps > """ > > Scenario: Use Progress3 formatter with feature and one scenario with all passing steps # features/formatter.progress3.feature:62 > Given a file named "features/scenario_with_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Feature with scenario > Scenario: Simple scenario with passing steps > Given a step passes > When another step passes > Then third step passes > And fourth step passes > But fifth step passes > """ > When I run "behave -f progress3 features/scenario_with_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature with scenario # features/scenario_with_steps.feature > Simple scenario with passing steps ..... > """ > > Scenario: Use Progress3 formatter with feature and one scenario with a failing step # features/formatter.progress3.feature:85 > Given a file named "features/scenario_with_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Feature with scenario > Scenario: Simple scenario with last failing step > Given a step passes > When second step passes > Then third step passes > And another step passes > But last step fails > """ > When I run "behave -f progress3 features/scenario_with_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature with scenario # features/scenario_with_steps.feature > Simple scenario with last failing step ....F > -------------------------------------------------------------------------------- > FAILURE in step 'last step fails' (features/scenario_with_steps.feature:7): > Assertion Failed: XFAIL-STEP > -------------------------------------------------------------------------------- > """ > > Scenario: Use Progress3 formatter with feature and one scenario with an exception in the step # features/formatter.progress3.feature:112 > Given a file named "features/scenario_with_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Feature with scenario > Scenario: Simple scenario with error in the step > Given a step passes > When second step passes > Then third step passes > And another step passes > But a step raises an error "Error message here" > """ > When I run "behave -f progress3 features/scenario_with_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature with scenario # features/scenario_with_steps.feature > Simple scenario with error in the step ....E > -------------------------------------------------------------------------------- > FAILURE in step 'a step raises an error "Error message here"' (features/scenario_with_steps.feature:7): > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > RuntimeError: Error message here > > -------------------------------------------------------------------------------- > """ > > Scenario: Use Progress3 formatter with feature and three scenarios with all passing steps # features/formatter.progress3.feature:143 > Given a file named "features/scenario_with_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Feature with three scenarios > Scenario: First scenario with passing steps > Given a step passes > When second step passes > Then third step passes > And another step passes > But last step passes > > Scenario: Second scenario with passing steps > Given a step passes > When second step passes > Then third step passes > And another step passes > But last step passes > > Scenario: Third scenario with passing steps > Given a step passes > When second step passes > Then third step passes > And another step passes > But last step passes > """ > When I run "behave -f progress3 features/scenario_with_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 0 skipped > 15 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature with three scenarios # features/scenario_with_steps.feature > First scenario with passing steps ..... > Second scenario with passing steps ..... > Third scenario with passing steps ..... > """ > > Scenario: Use Progress3 formatter with feature and three scenarios with a failing step # features/formatter.progress3.feature:183 > Given a file named "features/scenario_with_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Feature with various results in scenarios > Scenario: First scenario with passing steps > Given a step passes > When second step passes > Then third step passes > And another step passes > But last step passes > > Scenario: Second scenario with second failing step > Given a step passes > When second step fails > Then third step passes > And another step passes > But last step passes > > Scenario: Third scenario with fourth failing step > Given a step passes > When second step passes > Then third step passes > And fourth step fails > But last step passes > """ > When I run "behave -f progress3 features/scenario_with_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 2 failed, 0 skipped > 9 steps passed, 2 failed, 4 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature with various results in scenarios # features/scenario_with_steps.feature > First scenario with passing steps ..... > Second scenario with second failing step .F > -------------------------------------------------------------------------------- > FAILURE in step 'second step fails' (features/scenario_with_steps.feature:11): > Assertion Failed: XFAIL-STEP > -------------------------------------------------------------------------------- > > Third scenario with fourth failing step ...F > -------------------------------------------------------------------------------- > FAILURE in step 'fourth step fails' (features/scenario_with_steps.feature:20): > Assertion Failed: XFAIL-STEP > -------------------------------------------------------------------------------- > > > Failing scenarios: > features/scenario_with_steps.feature:9 Second scenario with second failing step > features/scenario_with_steps.feature:16 Third scenario with fourth failing step > """ > >@sequential >Feature: Rerun Formatter # features/formatter.rerun.feature:2 > To simplify to run the scenarios that have failed during the last test run > As a tester > I want that behave generates the necessary information for me. > | SOLUTION: > | > | Put RerunFormatter into "behave.ini" configuration file: > | > | # -- file:behave.ini > | [behave] > | format = rerun > | outfiles = rerun.txt > | > | Then a "rerun.txt" file is generated during each test run > | that contains the file locations of the failing scenarios, like: > | > | # -- file:rerun.txt > | # RERUN: Failing scenarios during last test run. > | features/alice.feature:10 > | features/alice.feature:42 > | > | To rerun the failing scenarios of the last test run, use: > | > | behave @rerun.txt > @setup > Scenario: Feature Setup # features/formatter.rerun.feature:31 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL-STEP" > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > > Scenario: Passing > Given a step passes > When a step passes > Then a step passes > > @xfail > Scenario: When-step fails > Given a step passes > When a step fails > Then a step passes > > @xfail > Scenario: Then-step fails > Given a step passes > When a step passes > Then a step fails > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > > @xfail > Scenario: Failing early > Given a step fails > When a step passes > Then a step fails > > Scenario: Passing > Given a step passes > > @xfail > Scenario: Failing > When a step passes > Then a step fails > """ > > @usecase.step1 > Scenario: Rerun file is generated when failures occur # features/formatter.rerun.feature:86 > When I run "behave -f rerun -o rerun.txt -f plain -T features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 2 failed, 0 skipped > 2 scenarios passed, 4 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Failing scenarios: > features/alice.feature:9 When-step fails > features/alice.feature:15 Then-step fails > features/bob.feature:4 Failing early > features/bob.feature:13 Failing > """ > And the file "rerun.txt" should contain # behave4cmd0/command_steps.py:399 > """ > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > """ > > @usecase.step2 > Scenario: Use rerun file during next test run to test only failing scenarios # features/formatter.rerun.feature:111 > Given a file named "rerun.txt" with # behave4cmd0/command_steps.py:50 > """ > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > """ > When I run "behave -f plain -T --no-skipped @rerun.txt" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 2 failed, 0 skipped > 0 scenarios passed, 4 failed, 2 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > > Scenario: When-step fails > Given a step passes ... passed > When a step fails ... failed > Assertion Failed: XFAIL-STEP > > Scenario: Then-step fails > Given a step passes ... passed > When a step passes ... passed > Then a step fails ... failed > Assertion Failed: XFAIL-STEP > > Feature: Bob > > Scenario: Failing early > Given a step fails ... failed > Assertion Failed: XFAIL-STEP > > Scenario: Failing > When a step passes ... passed > Then a step fails ... failed > Assertion Failed: XFAIL-STEP > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Failing scenarios: > features/alice.feature:9 When-step fails > features/alice.feature:15 Then-step fails > features/bob.feature:4 Failing early > features/bob.feature:13 Failing > """ > > Scenario: Rerun file is deleted when no failures occur # features/formatter.rerun.feature:162 > Given an empty file named "rerun.txt" # behave4cmd0/command_steps.py:66 > When I run "behave -f rerun -o rerun.txt -f plain -T --no-skipped --tags=~@xfail features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 4 skipped > """ > And a file named "rerun.txt" should not exist # behave4cmd0/command_steps.py:366 > > Scenario: Use RerunFormatter with output=stdout # features/formatter.rerun.feature:177 > When I run "behave -f rerun -f plain -T --no-skipped features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 2 failed, 0 skipped > 2 scenarios passed, 4 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > """ > > @with.behave_configfile > Scenario: Use rerun file with RerunFormatter in behave configuration file # features/formatter.rerun.feature:195 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > format = rerun > outfiles = rerun.txt > show_timings = false > show_skipped = false > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 2 failed, 0 skipped > 2 scenarios passed, 4 failed, 0 skipped > """ > And the file "rerun.txt" should contain # behave4cmd0/command_steps.py:399 > """ > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > """ > When I run "behave -f plain @rerun.txt" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 2 failed, 0 skipped > 0 scenarios passed, 4 failed, 2 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > > Scenario: When-step fails > Given a step passes ... passed > When a step fails ... failed > Assertion Failed: XFAIL-STEP > > Scenario: Then-step fails > Given a step passes ... passed > When a step passes ... passed > Then a step fails ... failed > Assertion Failed: XFAIL-STEP > > Feature: Bob > > Scenario: Failing early > Given a step fails ... failed > Assertion Failed: XFAIL-STEP > > Scenario: Failing > When a step passes ... passed > Then a step fails ... failed > Assertion Failed: XFAIL-STEP > """ > And the file "rerun.txt" should contain # behave4cmd0/command_steps.py:399 > """ > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > """ > > @sad.case @with.behave_configfile > Scenario: Two RerunFormatter use same output file # features/formatter.rerun.feature:261 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > format = rerun > outfiles = rerun.txt > """ > When I run "behave -f rerun -o rerun.txt -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 2 failed, 0 skipped > 2 scenarios passed, 4 failed, 0 skipped > """ > And the file "rerun.txt" should contain # behave4cmd0/command_steps.py:399 > """ > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > """ > But the file "rerun.txt" should not contain # behave4cmd0/command_steps.py:405 > """ > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > > # -- RERUN: 4 failing scenarios during last test run. > features/alice.feature:9 > features/alice.feature:15 > features/bob.feature:4 > features/bob.feature:13 > """ > And note that "the second RerunFormatter overwrites the output of the first one" # behave4cmd0/note_steps.py:15 > >@sequential >Feature: Steps Formatter (Step Definitions Formatter) # features/formatter.steps.feature:2 > As a test writer > I want to get a quick overview which step definitions exist > To simplify the writing of feature tests. > | SOLUTION: Use StepsFormatter in dry-run mode, like: > | > | behave --dry-run -f steps features/ > | > | NOTE: This formatter is similar to the "stepdefs" formatter in cucumber. > @setup > Scenario: Feature Setup # features/formatter.steps.feature:16 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL-STEP" > """ > And a file named "features/steps/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given('{person} lives in {city}') > def step_given_person_lives_in_city(context, person, city): > pass > > @when('I visit {person}') > def step_when_visit_person(context, person): > pass > > @then('I meet {person} in {city}') > def step_then_meet_person_in_city(context, person, city): > pass > """ > And a file named "features/steps/bob_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given('{person} works for {company}') > def step_given_person_works_for_company(context, person, company): > pass > > @when('I plan a meeting with {person}') > def step_when_plan_meeting_with_person(context, person): > pass > > @then('I meet him at the {company} office') > def step_then_meet_him_at_company_office(context, company): > pass > """ > And an empty file named "features/none.feature" # behave4cmd0/command_steps.py:66 > > @usecase.primary > Scenario: Show available step definitions in dry-run mode # features/formatter.steps.feature:66 > When I run "behave --dry-run -f steps features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > GIVEN STEP DEFINITIONS[4]: > Given {person} lives in {city} # features/steps/alice_steps.py:3 > Given {person} works for {company} # features/steps/bob_steps.py:3 > Given a step passes # features/steps/passing_steps.py:3 > Given a step fails # features/steps/passing_steps.py:7 > > WHEN STEP DEFINITIONS[4]: > When I visit {person} # features/steps/alice_steps.py:7 > When I plan a meeting with {person} # features/steps/bob_steps.py:7 > When a step passes # features/steps/passing_steps.py:3 > When a step fails # features/steps/passing_steps.py:7 > > THEN STEP DEFINITIONS[4]: > Then I meet {person} in {city} # features/steps/alice_steps.py:11 > Then I meet him at the {company} office # features/steps/bob_steps.py:11 > Then a step passes # features/steps/passing_steps.py:3 > Then a step fails # features/steps/passing_steps.py:7 > > GENERIC STEP DEFINITIONS[2]: > * a step passes # features/steps/passing_steps.py:3 > * a step fails # features/steps/passing_steps.py:7 > """ > But note that "the GENERIC STEP DEFINITIONS can be used as given/when/then steps" # behave4cmd0/note_steps.py:15 > > @usecase.secondary > Scenario: Show available step definitions in normal mode # features/formatter.steps.feature:96 > When I run "behave -f steps features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > GIVEN STEP DEFINITIONS[4]: > Given {person} lives in {city} # features/steps/alice_steps.py:3 > Given {person} works for {company} # features/steps/bob_steps.py:3 > Given a step passes # features/steps/passing_steps.py:3 > Given a step fails # features/steps/passing_steps.py:7 > > WHEN STEP DEFINITIONS[4]: > When I visit {person} # features/steps/alice_steps.py:7 > When I plan a meeting with {person} # features/steps/bob_steps.py:7 > When a step passes # features/steps/passing_steps.py:3 > When a step fails # features/steps/passing_steps.py:7 > > THEN STEP DEFINITIONS[4]: > Then I meet {person} in {city} # features/steps/alice_steps.py:11 > Then I meet him at the {company} office # features/steps/bob_steps.py:11 > Then a step passes # features/steps/passing_steps.py:3 > Then a step fails # features/steps/passing_steps.py:7 > > GENERIC STEP DEFINITIONS[2]: > * a step passes # features/steps/passing_steps.py:3 > * a step fails # features/steps/passing_steps.py:7 > """ > > @language > Scenario: Show available step definitions for language=de (German) # features/formatter.steps.feature:125 > When I run "behave --dry-run -f steps --lang=de features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > GIVEN STEP DEFINITIONS[4]: > Angenommen {person} lives in {city} # features/steps/alice_steps.py:3 > Angenommen {person} works for {company} # features/steps/bob_steps.py:3 > Angenommen a step passes # features/steps/passing_steps.py:3 > Angenommen a step fails # features/steps/passing_steps.py:7 > > WHEN STEP DEFINITIONS[4]: > Wenn I visit {person} # features/steps/alice_steps.py:7 > Wenn I plan a meeting with {person} # features/steps/bob_steps.py:7 > Wenn a step passes # features/steps/passing_steps.py:3 > Wenn a step fails # features/steps/passing_steps.py:7 > > THEN STEP DEFINITIONS[4]: > Dann I meet {person} in {city} # features/steps/alice_steps.py:11 > Dann I meet him at the {company} office # features/steps/bob_steps.py:11 > Dann a step passes # features/steps/passing_steps.py:3 > Dann a step fails # features/steps/passing_steps.py:7 > > GENERIC STEP DEFINITIONS[2]: > * a step passes # features/steps/passing_steps.py:3 > * a step fails # features/steps/passing_steps.py:7 > """ > But note that "this may fail depending on the language you use with your features" # behave4cmd0/note_steps.py:15 > > @language > Scenario: Show available step definitions for language=fr (French) # features/formatter.steps.feature:155 > When I run "behave --dry-run -f steps --lang=fr features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > GIVEN STEP DEFINITIONS[4]: > Soit {person} lives in {city} # features/steps/alice_steps.py:3 > Soit {person} works for {company} # features/steps/bob_steps.py:3 > Soit a step passes # features/steps/passing_steps.py:3 > Soit a step fails # features/steps/passing_steps.py:7 > > WHEN STEP DEFINITIONS[4]: > Quand I visit {person} # features/steps/alice_steps.py:7 > Quand I plan a meeting with {person} # features/steps/bob_steps.py:7 > Quand a step passes # features/steps/passing_steps.py:3 > Quand a step fails # features/steps/passing_steps.py:7 > > THEN STEP DEFINITIONS[4]: > Alors I meet {person} in {city} # features/steps/alice_steps.py:11 > Alors I meet him at the {company} office # features/steps/bob_steps.py:11 > Alors a step passes # features/steps/passing_steps.py:3 > Alors a step fails # features/steps/passing_steps.py:7 > > GENERIC STEP DEFINITIONS[2]: > * a step passes # features/steps/passing_steps.py:3 > * a step fails # features/steps/passing_steps.py:7 > """ > But note that "this may fail depending on the language you use with your features" # behave4cmd0/note_steps.py:15 > >@sequential >Feature: Steps Catalog Formatter # features/formatter.steps_catalog.feature:2 > As a test writer > I want to get a quick overview how to use a step definition > By reading the step definition documentation (doc-stings). > However I am not interested in technical details such as > source location and step function names. > Also, I would prefer to view the step as they appear in a feature file. > | SOLUTION: Use StepsDocFormatter in dry-run mode, like: > | > | behave --dry-run -f steps.catalog features/ > @setup > Scenario: Feature Setup # features/formatter.steps_catalog.feature:17 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > '''This step always passes.''' > pass > > @step('a step fails') > def step_fails(context): > '''This step is expected to fail.''' > assert False, "XFAIL-STEP" > """ > And a file named "features/steps/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given('{person} lives in {city}') > def step_given_person_lives_in_city(context, person, city): > ''' > Setup the data where a person lives and store in the database. > > :param person: Person's name (as string). > :param city: City where the person lives (as string). > ''' > database = getattr(context, "database", None) > if not database: > context.database = {} > context.database[person] = { "city": city } > > @when('I visit {person}') > def step_when_visit_person(context, person): > # -- NO DOC-STRING. > pass > > @then('I meet {person} in {city}') > def step_then_meet_person_in_city(context, person, city): > ''' > Checks if I can meet the person in the expected city. > > :param person: Person's name as key (as string). > :param city: Expected city (as string). > ''' > person_data = context.database.get(person, None) > assert person_data is not None, "Person %s not found" % person > assert person_data["city"] == city > """ > And an empty file named "features/none.feature" # behave4cmd0/command_steps.py:66 > > @usecase.primary > Scenario: Show documentation of available step definitions in dry-run mode # features/formatter.steps_catalog.feature:71 > When I run "behave --steps-catalog features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Given {person} lives in {city} > Setup the data where a person lives and store in the database. > > :param person: Person's name (as string). > :param city: City where the person lives (as string). > > When I visit {person} > > Then I meet {person} in {city} > Checks if I can meet the person in the expected city. > > :param person: Person's name as key (as string). > :param city: Expected city (as string). > > Given a step passes > When a step passes > Then a step passes > This step always passes. > > Given a step fails > When a step fails > Then a step fails > This step is expected to fail. > """ > But note that "the step definitions are ordered by step type" # behave4cmd0/note_steps.py:15 > And note that "'When I visit {person}' has no doc-string" # behave4cmd0/note_steps.py:15 > >@sequential >Feature: Steps Doc Formatter # features/formatter.steps_doc.feature:2 > As a test writer > I want to get a quick overview how to use a step definition > By reading the step definition documentation (doc-stings). > | SOLUTION: Use StepsDocFormatter in dry-run mode, like: > | > | behave --dry-run -f steps.doc features/ > @setup > Scenario: Feature Setup # features/formatter.steps_doc.feature:14 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > '''This step always passes.''' > pass > > @step('a step fails') > def step_fails(context): > '''This step is expected to fail.''' > assert False, "XFAIL-STEP" > """ > And a file named "features/steps/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given('{person} lives in {city}') > def step_given_person_lives_in_city(context, person, city): > ''' > Setup the data where a person lives and store in the database. > > :param person: Person's name (as string). > :param city: City where the person lives (as string). > ''' > database = getattr(context, "database", None) > if not database: > context.database = {} > context.database[person] = { "city": city } > > @when('I visit {person}') > def step_when_visit_person(context, person): > # -- NO DOC-STRING. > pass > > @then('I meet {person} in {city}') > def step_then_meet_person_in_city(context, person, city): > ''' > Checks if I can meet the person in the expected city. > > :param person: Person's name as key (as string). > :param city: Expected city (as string). > ''' > person_data = context.database.get(person, None) > assert person_data is not None, "Person %s not found" % person > assert person_data["city"] == city > """ > And an empty file named "features/none.feature" # behave4cmd0/command_steps.py:66 > > @usecase.primary > Scenario: Show documentation of available step definitions in dry-run mode # features/formatter.steps_doc.feature:68 > When I run "behave --dry-run -f steps.doc features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @given('{person} lives in {city}') > Function: step_given_person_lives_in_city() > Location: features/steps/alice_steps.py:3 > Setup the data where a person lives and store in the database. > > :param person: Person's name (as string). > :param city: City where the person lives (as string). > > @when('I visit {person}') > Function: step_when_visit_person() > Location: features/steps/alice_steps.py:16 > > @then('I meet {person} in {city}') > Function: step_then_meet_person_in_city() > Location: features/steps/alice_steps.py:21 > Checks if I can meet the person in the expected city. > > :param person: Person's name as key (as string). > :param city: Expected city (as string). > > @step('a step passes') > Function: step_passes() > Location: features/steps/passing_steps.py:3 > This step always passes. > > @step('a step fails') > Function: step_fails() > Location: features/steps/passing_steps.py:8 > This step is expected to fail. > """ > But note that "the step definitions are ordered by file location" # behave4cmd0/note_steps.py:15 > And note that "@when('I visit {person}') has no doc-string" # behave4cmd0/note_steps.py:15 > > @usecase.secondary > Scenario: Show documentation of available step definitions in normal mode # features/formatter.steps_doc.feature:107 > When I run "behave -f steps.doc features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @given('{person} lives in {city}') > Function: step_given_person_lives_in_city() > Location: features/steps/alice_steps.py:3 > Setup the data where a person lives and store in the database. > > :param person: Person's name (as string). > :param city: City where the person lives (as string). > > @when('I visit {person}') > Function: step_when_visit_person() > Location: features/steps/alice_steps.py:16 > > @then('I meet {person} in {city}') > Function: step_then_meet_person_in_city() > Location: features/steps/alice_steps.py:21 > Checks if I can meet the person in the expected city. > > :param person: Person's name as key (as string). > :param city: Expected city (as string). > > @step('a step passes') > Function: step_passes() > Location: features/steps/passing_steps.py:3 > This step always passes. > > @step('a step fails') > Function: step_fails() > Location: features/steps/passing_steps.py:8 > This step is expected to fail. > """ > >@sequential >Feature: Steps Usage Formatter # features/formatter.steps_usage.feature:2 > As a test writer > I want to get an overview which step definitions are used and where > To simplify the refactoring of step definitions (and features). > | SOLUTION: Use StepsUsageFormatter in dry-run mode, like: > | > | behave --dry-run -f steps.usage features/ > | > | NOTE: This formatter corresponds to the "usage" formatter in cucumber. > @setup > Scenario: Feature Setup # features/formatter.steps_usage.feature:16 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_passes(context, word): > assert False, "XFAIL-STEP" > """ > And a file named "features/steps/unused_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('an unused step') > def step_unused(context): > pass > > @step('another unused step') > def step_another_unused(context): > pass > """ > And a file named "features/steps/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given('{person} lives in {city}') > def step_given_person_lives_in_city(context, person, city): > pass > > @when('I visit {person}') > def step_when_visit_person(context, person): > pass > > @then('I meet {person} in {city}') > def step_then_meet_person_in_city(context, person, city): > pass > """ > And a file named "features/steps/charly_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given('{person} works for {company}') > def step_given_person_works_for_company(context, person, company): > pass > > @when('I plan a meeting with {person}') > def step_when_plan_meeting_with_person(context, person): > pass > > @then('I meet him at the {company} office') > def step_then_meet_him_at_company_office(context, company): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Visit Alice > Given Alice lives in Paris > When I visit Alice > Then I meet Alice in Paris > > Scenario: Visit Bob > Given Bob lives in Berlin > When I visit Bob > Then I meet Bob in Berlin > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Visit Bob > Given Bob lives in Barcelona > When I visit Bob > Then I meet Bob in Barcelona > And a step passes > """ > And a file named "features/charly.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Meeting with Charly > Given Charly works for ACME > When I plan a meeting with Charly > Then I meet him at the ACME office > """ > > @usecase.primary > Scenario: Show step definitions usage with all features in dry-run mode # features/formatter.steps_usage.feature:107 > When I run "behave --dry-run -f steps.usage features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @given('{person} lives in {city}') # features/steps/alice_steps.py:3 > Given Alice lives in Paris # features/alice.feature:3 > Given Bob lives in Berlin # features/alice.feature:8 > Given Bob lives in Barcelona # features/bob.feature:3 > > @when('I visit {person}') # features/steps/alice_steps.py:7 > When I visit Alice # features/alice.feature:4 > When I visit Bob # features/alice.feature:9 > When I visit Bob # features/bob.feature:4 > > @then('I meet {person} in {city}') # features/steps/alice_steps.py:11 > Then I meet Alice in Paris # features/alice.feature:5 > Then I meet Bob in Berlin # features/alice.feature:10 > Then I meet Bob in Barcelona # features/bob.feature:5 > > @given('{person} works for {company}') # features/steps/charly_steps.py:3 > Given Charly works for ACME # features/charly.feature:3 > > @when('I plan a meeting with {person}') # features/steps/charly_steps.py:7 > When I plan a meeting with Charly # features/charly.feature:4 > > @then('I meet him at the {company} office') # features/steps/charly_steps.py:11 > Then I meet him at the ACME office # features/charly.feature:5 > > @step('{word:w} step passes') # features/steps/passing_steps.py:3 > And a step passes # features/bob.feature:6 > > UNUSED STEP DEFINITIONS[3]: > @step('{word:w} step fails') # features/steps/passing_steps.py:7 > @step('an unused step') # features/steps/unused_steps.py:3 > @step('another unused step') # features/steps/unused_steps.py:7 > """ > And note that "the UNUSED STEP DEFINITIONS are ordered by file location" # behave4cmd0/note_steps.py:15 > But note that "step definitions from unused_steps.py are not used by any feature" # behave4cmd0/note_steps.py:15 > > @usecase.primary > Scenario: Show step definitions usage with one feature (dry-run mode) # features/formatter.steps_usage.feature:148 > When I run "behave --dry-run -f steps.usage features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @given('{person} lives in {city}') # features/steps/alice_steps.py:3 > Given Alice lives in Paris # features/alice.feature:3 > Given Bob lives in Berlin # features/alice.feature:8 > > @when('I visit {person}') # features/steps/alice_steps.py:7 > When I visit Alice # features/alice.feature:4 > When I visit Bob # features/alice.feature:9 > > @then('I meet {person} in {city}') # features/steps/alice_steps.py:11 > Then I meet Alice in Paris # features/alice.feature:5 > Then I meet Bob in Berlin # features/alice.feature:10 > > UNUSED STEP DEFINITIONS[7]: > @given('{person} works for {company}') # features/steps/charly_steps.py:3 > @when('I plan a meeting with {person}') # features/steps/charly_steps.py:7 > @then('I meet him at the {company} office') # features/steps/charly_steps.py:11 > @step('{word:w} step passes') # features/steps/passing_steps.py:3 > @step('{word:w} step fails') # features/steps/passing_steps.py:7 > @step('an unused step') # features/steps/unused_steps.py:3 > @step('another unused step') # features/steps/unused_steps.py:7 > """ > But note that "step definitions from charly_steps.py, passing_steps.py are now no longer used" # behave4cmd0/note_steps.py:15 > > @usecase.primary > Scenario: Show step definitions usage with two features (dry-run mode) # features/formatter.steps_usage.feature:177 > When I run "behave --dry-run -f steps.usage features/alice.feature features/charly.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @given('{person} lives in {city}') # features/steps/alice_steps.py:3 > Given Alice lives in Paris # features/alice.feature:3 > Given Bob lives in Berlin # features/alice.feature:8 > > @when('I visit {person}') # features/steps/alice_steps.py:7 > When I visit Alice # features/alice.feature:4 > When I visit Bob # features/alice.feature:9 > > @then('I meet {person} in {city}') # features/steps/alice_steps.py:11 > Then I meet Alice in Paris # features/alice.feature:5 > Then I meet Bob in Berlin # features/alice.feature:10 > > @given('{person} works for {company}') # features/steps/charly_steps.py:3 > Given Charly works for ACME # features/charly.feature:3 > > @when('I plan a meeting with {person}') # features/steps/charly_steps.py:7 > When I plan a meeting with Charly # features/charly.feature:4 > > @then('I meet him at the {company} office') # features/steps/charly_steps.py:11 > Then I meet him at the ACME office # features/charly.feature:5 > > UNUSED STEP DEFINITIONS[4]: > @step('{word:w} step passes') # features/steps/passing_steps.py:3 > @step('{word:w} step fails') # features/steps/passing_steps.py:7 > @step('an unused step') # features/steps/unused_steps.py:3 > @step('another unused step') # features/steps/unused_steps.py:7 > """ > But note that "step definitions from passing_steps.py, unused_steps.py are not used by any feature" # behave4cmd0/note_steps.py:15 > > @usecase.secondary > Scenario: Show step definitions usage with all features in normal mode # features/formatter.steps_usage.feature:212 > When I run "behave -f steps.usage features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @given('{person} lives in {city}') # features/steps/alice_steps.py:3 > Given Alice lives in Paris # features/alice.feature:3 > Given Bob lives in Berlin # features/alice.feature:8 > Given Bob lives in Barcelona # features/bob.feature:3 > > @when('I visit {person}') # features/steps/alice_steps.py:7 > When I visit Alice # features/alice.feature:4 > When I visit Bob # features/alice.feature:9 > When I visit Bob # features/bob.feature:4 > > @then('I meet {person} in {city}') # features/steps/alice_steps.py:11 > Then I meet Alice in Paris # features/alice.feature:5 > Then I meet Bob in Berlin # features/alice.feature:10 > Then I meet Bob in Barcelona # features/bob.feature:5 > > @given('{person} works for {company}') # features/steps/charly_steps.py:3 > Given Charly works for ACME # features/charly.feature:3 > > @when('I plan a meeting with {person}') # features/steps/charly_steps.py:7 > When I plan a meeting with Charly # features/charly.feature:4 > > @then('I meet him at the {company} office') # features/steps/charly_steps.py:11 > Then I meet him at the ACME office # features/charly.feature:5 > > @step('{word:w} step passes') # features/steps/passing_steps.py:3 > And a step passes # features/bob.feature:6 > > UNUSED STEP DEFINITIONS[3]: > @step('{word:w} step fails') # features/steps/passing_steps.py:7 > @step('an unused step') # features/steps/unused_steps.py:3 > @step('another unused step') # features/steps/unused_steps.py:7 > """ > > @corner.case > Scenario: StepsUsageFormatter shows undefined steps # features/formatter.steps_usage.feature:250 > Given a file named "features/undefined.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: With undefined steps > Scenario: > Given a step is undefined > Then another step is undefined > """ > When I run "behave --dry-run -f steps.usage features/alice.feature features/undefined.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 0 skipped, 3 untested > 0 steps passed, 0 failed, 0 skipped, 2 undefined, 6 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > @given('{person} lives in {city}') # features/steps/alice_steps.py:3 > Given Alice lives in Paris # features/alice.feature:3 > Given Bob lives in Berlin # features/alice.feature:8 > > @when('I visit {person}') # features/steps/alice_steps.py:7 > When I visit Alice # features/alice.feature:4 > When I visit Bob # features/alice.feature:9 > > @then('I meet {person} in {city}') # features/steps/alice_steps.py:11 > Then I meet Alice in Paris # features/alice.feature:5 > Then I meet Bob in Berlin # features/alice.feature:10 > > UNUSED STEP DEFINITIONS[7]: > @given('{person} works for {company}') # features/steps/charly_steps.py:3 > @when('I plan a meeting with {person}') # features/steps/charly_steps.py:7 > @then('I meet him at the {company} office') # features/steps/charly_steps.py:11 > @step('{word:w} step passes') # features/steps/passing_steps.py:3 > @step('{word:w} step fails') # features/steps/passing_steps.py:7 > @step('an unused step') # features/steps/unused_steps.py:3 > @step('another unused step') # features/steps/unused_steps.py:7 > > UNDEFINED STEPS[2]: > Given a step is undefined # features/undefined.feature:3 > Then another step is undefined # features/undefined.feature:4 > """ > > @corner.case > Scenario: StepsUsageFormatter shows all locations of undefined step usage # features/formatter.steps_usage.feature:295 > Given a file named "features/undefined_duplicates.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: With undefined steps > > Scenario: Same undefined step used twice > Given a step is undefined > And a step is undefined > Then a step passes > > Scenario: Same undefined step used again > Given a step passes > And a step is undefined > """ > When I run "behave --dry-run -f steps.usage features/undefined_duplicates.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > 0 steps passed, 0 failed, 0 skipped, 3 undefined, 2 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > UNDEFINED STEPS[3]: > Given a step is undefined # features/undefined_duplicates.feature:4 > And a step is undefined # features/undefined_duplicates.feature:5 > And a step is undefined # features/undefined_duplicates.feature:10 > """ > > @use_outline > Scenario: Scenario Outlines should not cause duplicated step entries # features/formatter.steps_usage.feature:327 > Given a file named "features/use_scenario_outline.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: > Given a step <outcome1> > When another step <outcome2> > > Examples: > | outcome1 | outcome2 | > | passes | passes | > | passes | fails | > """ > When I run "behave --dry-run -f steps.usage features/use_scenario_outline.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > 0 steps passed, 0 failed, 0 skipped, 0 undefined, 4 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > @step('{word:w} step passes') # features/steps/passing_steps.py:3 > Given a step passes # features/use_scenario_outline.feature:3 > When another step passes # features/use_scenario_outline.feature:4 > > @step('{word:w} step fails') # features/steps/passing_steps.py:7 > When another step fails # features/use_scenario_outline.feature:4 > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > @step('{word:w} step passes') # features/steps/passing_steps.py:3 > Given a step passes # features/use_scenario_outline.feature:3 > When another step passes # features/use_scenario_outline.feature:4 > Given a step passes # features/use_scenario_outline.feature:3 > """ > > @use_outline > Scenario: Scenario Outlines should not cause duplicated entries for undefined steps # features/formatter.steps_usage.feature:368 > Given a file named "features/scenario_outline_with_undefined.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: > Given a step is <status1> > When another step is <status2> > > Examples: > | status1 | status2 | > | undefined | undefined | > | undefined | undefined | > """ > When I run "behave --dry-run -f steps.usage features/scenario_outline_with_undefined.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > 0 steps passed, 0 failed, 0 skipped, 4 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > UNDEFINED STEPS[2]: > Given a step is undefined # features/scenario_outline_with_undefined.feature:3 > When another step is undefined # features/scenario_outline_with_undefined.feature:4 > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > UNDEFINED STEPS[2]: > Given a step is undefined # features/scenario_outline_with_undefined.feature:3 > Given a step is undefined # features/scenario_outline_with_undefined.feature:3 > When another step is undefined # features/scenario_outline_with_undefined.feature:4 > When another step is undefined # features/scenario_outline_with_undefined.feature:4 > """ > >@sequential >Feature: Tags Formatter (Tag Counts) # features/formatter.tags.feature:2 > As a tester > I want to obtain a quick overview which tags are used (and how often) > So that I can better use tags on command-line > NOTE: Primarily intended for dry-run mode. > @setup > Scenario: Feature Setup # features/formatter.tags.feature:11 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > @one > Feature: Alice > > @setup > Scenario: Setup Feature > Given a step passes > > @wip > Scenario: A1 with tags: @wip (inherited: @one) > Given a step passes > > @foo > @wip > Scenario: A2 with tags: @foo, @wip (inherited: @one) > When a step passes > > @foo @bar > Scenario: A3 with tags: @foo, @bar (inherited: @one) > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > @two > Feature: Bob > > Scenario: B1 without tags (inherited: @two) > Given a step passes > > @foo @one > Scenario: B2 with tags: @foo, @one (inherited: @two) > When a step passes > """ > > Scenario: Use Tags formatter to get an overview of used tags # features/formatter.tags.feature:57 > When I run "behave -f tags --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 0 skipped, 6 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > TAG COUNTS (alphabetically sorted): > @bar 1 (used for scenario) > @foo 3 (used for scenario) > @one 2 (used for feature: 1, scenario: 1) > @setup 1 (used for scenario) > @two 1 (used for feature) > @wip 2 (used for scenario) > """ > But note that "tags inherited from its feature are (normally) not counted." # behave4cmd0/note_steps.py:15 > > Scenario: Use Tags formatter together with another formatter # features/formatter.tags.feature:77 > When I run "behave -f tags -f plain -T features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 6 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > > Scenario: Setup Feature > Given a step passes ... passed > > Scenario: A1 with tags: @wip (inherited: @one) > Given a step passes ... passed > > Scenario: A2 with tags: @foo, @wip (inherited: @one) > When a step passes ... passed > > Scenario: A3 with tags: @foo, @bar (inherited: @one) > Then a step passes ... passed > > Feature: Bob > > Scenario: B1 without tags (inherited: @two) > Given a step passes ... passed > > Scenario: B2 with tags: @foo, @one (inherited: @two) > When a step passes ... passed > > TAG COUNTS (alphabetically sorted): > @bar 1 (used for scenario) > @foo 3 (used for scenario) > @one 2 (used for feature: 1, scenario: 1) > @setup 1 (used for scenario) > @two 1 (used for feature) > @wip 2 (used for scenario) > """ > > Scenario: Use Tags formatter when tags are selected # features/formatter.tags.feature:117 > When I run "behave -f tags --tags=@setup,@wip features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 1 skipped > 3 scenarios passed, 0 failed, 3 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > TAG COUNTS (alphabetically sorted): > @bar 1 (used for scenario) > @foo 3 (used for scenario) > @one 2 (used for feature: 1, scenario: 1) > @setup 1 (used for scenario) > @two 1 (used for feature) > @wip 2 (used for scenario) > """ > And note that "all tags are detected even from skipped features and scenarios" # behave4cmd0/note_steps.py:15 > >@sequential >Feature: TagsLocation Formatter # features/formatter.tags_location.feature:2 > As a tester > I want to know where and in which context tags are used > So that I better understand how to use tags in feature files and on command-line > NOTE: Primarily intended for dry-run mode. > @setup > Scenario: Feature Setup # features/formatter.tags_location.feature:12 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > @one > Feature: Alice > > @setup > Scenario: Setup Feature > Given a step passes > > @wip > Scenario: A1 with tags: @wip (inherited: @one) > Given a step passes > > @foo > @wip > Scenario: A2 with tags: @foo, @wip (inherited: @one) > When a step passes > > @foo @bar > Scenario: A3 with tags: @foo, @bar (inherited: @one) > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > @two > Feature: Bob > > Scenario: B1 without tags (inherited: @two) > Given a step passes > > @foo @one > Scenario: B2 with tags: @foo, @one (inherited: @two) > When a step passes > """ > > Scenario: Use TagsLocation formatter to get an overview where tags are used # features/formatter.tags_location.feature:58 > When I run "behave -f tags.location --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 0 skipped, 6 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > TAG LOCATIONS (alphabetically ordered): > @bar: > features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one) > > @foo: > features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one) > features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one) > features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two) > > @one: > features/alice.feature:2 Feature: Alice > features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two) > > @setup: > features/alice.feature:5 Scenario: Setup Feature > > @two: > features/bob.feature:2 Feature: Bob > > @wip: > features/alice.feature:9 Scenario: A1 with tags: @wip (inherited: @one) > features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one) > """ > But note that "tags inherited from its feature are (normally) not counted." # behave4cmd0/note_steps.py:15 > > Scenario: Use TagsLocation formatter together with another formatter # features/formatter.tags_location.feature:93 > When I run "behave -f tags.location -f plain -T features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 6 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > > Scenario: Setup Feature > Given a step passes ... passed > > Scenario: A1 with tags: @wip (inherited: @one) > Given a step passes ... passed > > Scenario: A2 with tags: @foo, @wip (inherited: @one) > When a step passes ... passed > > Scenario: A3 with tags: @foo, @bar (inherited: @one) > Then a step passes ... passed > > Feature: Bob > > Scenario: B1 without tags (inherited: @two) > Given a step passes ... passed > > Scenario: B2 with tags: @foo, @one (inherited: @two) > When a step passes ... passed > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > TAG LOCATIONS (alphabetically ordered): > @bar: > features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one) > > @foo: > features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one) > features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one) > features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two) > > @one: > features/alice.feature:2 Feature: Alice > features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two) > > @setup: > features/alice.feature:5 Scenario: Setup Feature > > @two: > features/bob.feature:2 Feature: Bob > > @wip: > features/alice.feature:9 Scenario: A1 with tags: @wip (inherited: @one) > features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one) > """ > > Scenario: Use TagsLocation formatter when tags are selected # features/formatter.tags_location.feature:151 > When I run "behave -f tags.location --tags=@setup,@wip features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 1 skipped > 3 scenarios passed, 0 failed, 3 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > TAG LOCATIONS (alphabetically ordered): > @bar: > features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one) > > @foo: > features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one) > features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one) > features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two) > > @one: > features/alice.feature:2 Feature: Alice > features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two) > > @setup: > features/alice.feature:5 Scenario: Setup Feature > > @two: > features/bob.feature:2 Feature: Bob > > @wip: > features/alice.feature:9 Scenario: A1 with tags: @wip (inherited: @one) > features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one) > """ > And note that "all tags are detected even from skipped features and scenarios" # behave4cmd0/note_steps.py:15 > >Feature: Use a user-defined Formatter # features/formatter.user_defined.feature:1 > As a behave user > I want to be able to provide own, user-defined formatters > So that I am able to add a new, user-defined formatters > when I need other output formats (or override existing ones). > | SPECIFICATION: > | * A user-defined formatter must inherit from the "Formatter" class. > | * A user-defined formatter can be specified on command-line > | by using a scoped class name as value for the '--format' option. > | * A user-defined formatter can be registered by name > | by using the "behave.formatters" section in the behave config file. > | > | SCOPED CLASS NAME (for formatter.class): > | * my.module_name:ClassName (preferred: single colon separator) > | * my.module_name::ClassName (alternative: double colon separator) > @setup > Scenario: Feature Setup # features/formatter.user_defined.feature:21 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL-STEP" > """ > And a file named "features/passing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Alice > Given a step passes > When another step passes > > Scenario: Bob > Then some step passes > """ > And an empty file named "behave_ext/__init__.py" # behave4cmd0/command_steps.py:66 > And a file named "behave_ext/formatter_one.py" with # behave4cmd0/command_steps.py:50 > """ > from behave.formatter.base import Formatter > > class NotAFormatter(object): pass > class SuperFormatter(Formatter): > name = "super" > description = "Super-duper formatter." > """ > And a file named "behave_ext/formatter_foo.py" with # behave4cmd0/command_steps.py:50 > """ > from behave.formatter.base import Formatter > > class FooFormatter(Formatter): > name = "foo" > description = "User-specific FOO formatter." > > class FooFormatter2(Formatter): > description = "User-specific FOO2 formatter." > """ > And a file named "behave_ext/formatter_bar.py" with # behave4cmd0/command_steps.py:50 > """ > from behave.formatter.base import Formatter > > class BarFormatter(Formatter): > description = "User-specific BAR formatter." > """ > > @use_formatter.class > Scenario: Use a known, valid user-defined formatter with scoped class name # features/formatter.user_defined.feature:75 > When I run "behave -f behave_ext.formatter_one:SuperFormatter features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @use_formatter.class > Scenario: Use a known, valid user-defined formatter (with double colon) # features/formatter.user_defined.feature:84 > When I run "behave -f behave_ext.formatter_one::SuperFormatter features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @use_formatter.class > Scenario Outline: Use built-in formatter "plain" like a user-defined formatter -- @1.1 # features/formatter.user_defined.feature:107 > When I run "behave -f behave.formatter.plain:PlainFormatter features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @use_formatter.class > Scenario Outline: Use built-in formatter "pretty" like a user-defined formatter -- @1.2 # features/formatter.user_defined.feature:108 > When I run "behave -f behave.formatter.pretty:PrettyFormatter features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @problematic @use_formatter.class > Scenario Outline: Use a problematic user-defined formatter (Unknown module) -- @1.1 # features/formatter.user_defined.feature:122 > When I run "behave -f my.unknown_module:SomeFormatter features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > error: format=my.unknown_module:SomeFormatter is unknown > """ > > @problematic @use_formatter.class > Scenario Outline: Use a problematic user-defined formatter (Unknown class) -- @1.2 # features/formatter.user_defined.feature:123 > When I run "behave -f behave_ext.formatter_one:UnknownClass features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > error: format=behave_ext.formatter_one:UnknownClass is unknown > """ > > @problematic @use_formatter.class > Scenario Outline: Use a problematic user-defined formatter (Invalid Formatter class) -- @1.3 # features/formatter.user_defined.feature:124 > When I run "behave -f behave_ext.formatter_one:NotAFormatter features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > error: format=behave_ext.formatter_one:NotAFormatter is unknown > """ > > @formatter.registered_by_name > Scenario Outline: Register user-defined formatter by name: foo -- @1.1 # features/formatter.user_defined.feature:150 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.formatters] > foo = behave_ext.formatter_foo:FooFormatter > foo2 = behave_ext.formatter_foo:FooFormatter2 > bar = behave_ext.formatter_bar:BarFormatter > """ > And note that "the schema: 'formatter.name = formatter.class' is used" # behave4cmd0/note_steps.py:15 > When I run "behave -f foo features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > error: format=foo is unknown > """ > > @formatter.registered_by_name > Scenario Outline: Register user-defined formatter by name: bar -- @1.2 # features/formatter.user_defined.feature:151 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.formatters] > foo = behave_ext.formatter_foo:FooFormatter > foo2 = behave_ext.formatter_foo:FooFormatter2 > bar = behave_ext.formatter_bar:BarFormatter > """ > And note that "the schema: 'formatter.name = formatter.class' is used" # behave4cmd0/note_steps.py:15 > When I run "behave -f bar features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > error: format=bar is unknown > """ > > @formatter.registered_by_name > Scenario: Help-Format shows description of registered-by-name formatters # features/formatter.user_defined.feature:155 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.formatters] > foo = behave_ext.formatter_foo:FooFormatter > bar = behave_ext.formatter_bar:BarFormatter > """ > When I run "behave -f help" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Available formatters: > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > bar User-specific BAR formatter. > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > foo User-specific FOO formatter. > """ > > @problematic @formatter.registered_by_name > Scenario Outline: Use problematic, registered-by-name formatter: Unknown module -- @1.1 # features/formatter.user_defined.feature:193 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.formatters] > unknown1 = my.unknown_module:SomeFormatter > """ > When I run "behave -f unknown1 features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > error: format=unknown1 is unknown > """ > > @problematic @formatter.registered_by_name > Scenario Outline: Use problematic, registered-by-name formatter: Unknown class -- @1.2 # features/formatter.user_defined.feature:194 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.formatters] > unknown2 = behave_ext.formatter_one:UnknownClass > """ > When I run "behave -f unknown2 features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > error: format=unknown2 is unknown > """ > > @problematic @formatter.registered_by_name > Scenario Outline: Use problematic, registered-by-name formatter: Invalid Formatter class -- @1.3 # features/formatter.user_defined.feature:195 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.formatters] > invalid1 = behave_ext.formatter_one:NotAFormatter > """ > When I run "behave -f invalid1 features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > error: format=invalid1 is unknown > """ > >@unicode >Feature: Internationalization (i18n) and Problems with Unicode Strings # features/i18n.unicode_problems.feature:2 > | POTENTIAL PROBLEM AREAS: > | * Feature, scenario, step names with problematic chars > | * Tags with problematic chars > | * step raises exception with problematic text (output capture) > | * step generates output with problematic and some step fails (stdout capture) > | * filenames with problematic chars: feature files, steps files > | > | CHECKED FORMATTERS and REPORTERS: > | * plain > | * pretty > | * junit (used via "behave.ini" defaults) > @setup > Scenario: Feature Setup # features/i18n.unicode_problems.feature:18 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > show_timings = false > show_skipped = false > show_source = true > junit = true > """ > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from __future__ import unicode_literals > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step passes with "{text}"') > def step_passes_with_text(context, word, text): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL" > > @step('{word:w} step fails with "{text}"') > def step_fails_with_text(context, word, text): > assert False, "XFAIL: "+ text > """ > And a file named "features/steps/step_write_output.py" with # behave4cmd0/command_steps.py:50 > """ > from __future__ import print_function, unicode_literals > from behave import step > import six > > @step('I write text "{text}" to stdout') > def step_write_text(context, text): > if six.PY2 and isinstance(text, six.text_type): > text = text.encode("utf-8", "replace") > print(text) > > @step('I write bytes "{data}" to stdout') > def step_write_bytes(context, data): > if isinstance(data, six.text_type): > data = data.encode("unicode-escape", "replace") > print(data) > """ > > Scenario Outline: Problematic scenario name: Café (case: passed, plain) -- @1.1 # features/i18n.unicode_problems.feature:89 > Given a file named "features/scenario_name_problematic_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Café > Given a step passes > """ > When I run "behave -f plain features/scenario_name_problematic_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Café > """ > > Scenario Outline: Problematic scenario name: Ãrgernis ist überall (case: passed, pretty) -- @1.2 # features/i18n.unicode_problems.feature:90 > Given a file named "features/scenario_name_problematic_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Ãrgernis ist überall > Given a step passes > """ > When I run "behave -f pretty features/scenario_name_problematic_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Ãrgernis ist überall > """ > > Scenario Outline: Problematic scenario name: Café (case: failed, plain) -- @1.1 # features/i18n.unicode_problems.feature:113 > Given a file named "features/scenario_name_problematic_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Café > Given a step fails > """ > When I run "behave -f plain features/scenario_name_problematic_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Café > """ > > Scenario Outline: Problematic scenario name: Ãrgernis ist überall (case: failed, pretty) -- @1.2 # features/i18n.unicode_problems.feature:114 > Given a file named "features/scenario_name_problematic_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Ãrgernis ist überall > Given a step fails > """ > When I run "behave -f pretty features/scenario_name_problematic_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Ãrgernis ist überall > """ > > Scenario Outline: Problematic step: Café (case: passed, plain) -- @1.1 # features/i18n.unicode_problems.feature:134 > Given a file named "features/step_problematic_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes with "Café" > """ > When I run "behave -f plain features/step_problematic_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario Outline: Problematic step: Ãrgernis ist überall (case: passed, pretty) -- @1.2 # features/i18n.unicode_problems.feature:135 > Given a file named "features/step_problematic_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes with "Ãrgernis ist überall" > """ > When I run "behave -f pretty features/step_problematic_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario Outline: Problematic step: Café (case: fail, plain) -- @1.1 # features/i18n.unicode_problems.feature:155 > Given a file named "features/step_problematic_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step fails with "Café" > """ > When I run "behave -f plain features/step_problematic_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > > Scenario Outline: Problematic step: Ãrgernis ist überall (case: fail, pretty) -- @1.2 # features/i18n.unicode_problems.feature:156 > Given a file named "features/step_problematic_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step fails with "Ãrgernis ist überall" > """ > When I run "behave -f pretty features/step_problematic_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > > @problematic.feature_filename > Scenario Outline: Problematic feature filename: Café (case: pass, plain) -- @1.1 # features/i18n.unicode_problems.feature:176 > Given a file named "features/Café_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > """ > When I run "behave -f plain features/Café_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > > @problematic.feature_filename > Scenario Outline: Problematic feature filename: Ãrgernis_ist_überall (case: pass, pretty) -- @1.2 # features/i18n.unicode_problems.feature:177 > Given a file named "features/Ãrgernis_ist_überall_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > """ > When I run "behave -f pretty features/Ãrgernis_ist_überall_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > > @problematic.feature_filename > Scenario Outline: Problematic feature filename: Café (case: fail, plain) -- @1.1 # features/i18n.unicode_problems.feature:197 > Given a file named "features/Café_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step fails > """ > When I run "behave -f plain features/Café_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > > @problematic.feature_filename > Scenario Outline: Problematic feature filename: Ãrgernis_ist_überall (case: fail, pretty) -- @1.2 # features/i18n.unicode_problems.feature:198 > Given a file named "features/Ãrgernis_ist_überall_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step fails > """ > When I run "behave -f pretty features/Ãrgernis_ist_überall_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > > @problematic.step_filename > Scenario Outline: Problematic step filename: Ãrgernis_ist_überall (case: pass, plain) -- @1.1 # features/i18n.unicode_problems.feature:231 > Given a file named "features/problematic_stepfile_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use a weird step and pass > """ > And a file named "features/steps/step_pass_Ãrgernis_ist_überall.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'I use a weird step and pass') > def step_weird_pass(context): > pass > """ > When I run "behave -f plain features/problematic_stepfile_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > But note that "you should normally use only ASCII/latin-1 python filenames" # behave4cmd0/note_steps.py:15 > > @problematic.step_filename > Scenario Outline: Problematic step filename: Ãrgernis_ist_überall (case: pass, pretty) -- @1.2 # features/i18n.unicode_problems.feature:232 > Given a file named "features/problematic_stepfile_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use a weird step and pass > """ > And a file named "features/steps/step_pass_Ãrgernis_ist_überall.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'I use a weird step and pass') > def step_weird_pass(context): > pass > """ > When I run "behave -f pretty features/problematic_stepfile_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > But note that "you should normally use only ASCII/latin-1 python filenames" # behave4cmd0/note_steps.py:15 > > @problematic.step_filename > Scenario Outline: Problematic step filename: Ãrgernis_ist_überall (case: fail, plain) -- @1.1 # features/i18n.unicode_problems.feature:265 > Given a file named "features/problematic_stepfile_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use a weird step and fail > """ > And a file named "features/steps/step_fail_Ãrgernis_ist_überall.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'I use a weird step and fail') > def step_weird_fails(context): > assert False, "XFAIL-WEIRD" > """ > When I run "behave -f plain features/problematic_stepfile_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > But note that "you should normally use only ASCII/latin-1 python filenames" # behave4cmd0/note_steps.py:15 > > @problematic.step_filename > Scenario Outline: Problematic step filename: Ãrgernis_ist_überall (case: fail, pretty) -- @1.2 # features/i18n.unicode_problems.feature:266 > Given a file named "features/problematic_stepfile_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use a weird step and fail > """ > And a file named "features/steps/step_fail_Ãrgernis_ist_überall.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'I use a weird step and fail') > def step_weird_fails(context): > assert False, "XFAIL-WEIRD" > """ > When I run "behave -f pretty features/problematic_stepfile_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > But note that "you should normally use only ASCII/latin-1 python filenames" # behave4cmd0/note_steps.py:15 > > @problematic.output > Scenario Outline: Problematic output: Café (case: pass, plain) -- @1.1 # features/i18n.unicode_problems.feature:288 > Given a file named "features/problematic_output_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I write text "Café" to stdout > Then I write bytes "Café" to stdout > And a step passes > """ > When I run "behave -f plain --no-capture features/problematic_output_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > > @problematic.output > Scenario Outline: Problematic output: Ãrgernis ist überall (case: pass, pretty) -- @1.2 # features/i18n.unicode_problems.feature:289 > Given a file named "features/problematic_output_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I write text "Ãrgernis ist überall" to stdout > Then I write bytes "Ãrgernis ist überall" to stdout > And a step passes > """ > When I run "behave -f pretty --no-capture features/problematic_output_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > > @problematic.output > Scenario Outline: Problematic output: Café (case: fail, plain) -- @1.1 # features/i18n.unicode_problems.feature:315 > Given a file named "features/problematic_output_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I write text "Café" to stdout > Then I write bytes "Café" to stdout > And a step fails > """ > When I run "behave -f plain features/problematic_output_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Café > """ > > @problematic.output > Scenario Outline: Problematic output: Ãrgernis ist überall (case: fail, pretty) -- @1.2 # features/i18n.unicode_problems.feature:316 > Given a file named "features/problematic_output_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I write text "Ãrgernis ist überall" to stdout > Then I write bytes "Ãrgernis ist überall" to stdout > And a step fails > """ > When I run "behave -f pretty features/problematic_output_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Ãrgernis ist überall > """ > > @problematic.tags > Scenario Outline: Problematic tag: tag.Café (case: pass, plain) -- @1.1 # features/i18n.unicode_problems.feature:336 > Given a file named "features/problematic_tag_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > @tag.Café > Scenario: > Given a step passes > """ > When I run "behave -f plain features/problematic_tag_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > """ > > @problematic.tags > Scenario Outline: Problematic tag: tag.Ãrgernis_ist_überall (case: pass, pretty) -- @1.2 # features/i18n.unicode_problems.feature:337 > Given a file named "features/problematic_tag_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > @tag.Ãrgernis_ist_überall > Scenario: > Given a step passes > """ > When I run "behave -f pretty features/problematic_tag_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > """ > > @problematic.tags > Scenario Outline: Problematic tag: tag.Café (case: fail, plain) -- @1.1 # features/i18n.unicode_problems.feature:357 > Given a file named "features/problematic_tag_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > @tag.Café > Scenario: > Given a step fails > """ > When I run "behave -f plain features/problematic_tag_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > """ > > @problematic.tags > Scenario Outline: Problematic tag: tag.Ãrgernis_ist_überall (case: fail, pretty) -- @1.2 # features/i18n.unicode_problems.feature:358 > Given a file named "features/problematic_tag_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > @tag.Ãrgernis_ist_überall > Scenario: > Given a step fails > """ > When I run "behave -f pretty features/problematic_tag_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > """ > > @issue_0230 > Scenario Outline: Step assert fails with problematic chars (case: plain) -- @1.1 # features/i18n.unicode_problems.feature:394 > Given a file named "features/steps/problematic_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'{word:w} step fails with assert and non-ASCII text') > def step_fails_with_assert_and_problematic_text(context, word): > assert False, "XFAIL:"+ chr(190) +";" > """ > And a file named "features/assert_with_ptext.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step fails with assert and non-ASCII text > """ > When I run "behave -f plain features/assert_with_ptext.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Assertion Failed: XFAIL:¾; > """ > > @issue_0230 > Scenario Outline: Step assert fails with problematic chars (case: pretty) -- @1.2 # features/i18n.unicode_problems.feature:395 > Given a file named "features/steps/problematic_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'{word:w} step fails with assert and non-ASCII text') > def step_fails_with_assert_and_problematic_text(context, word): > assert False, "XFAIL:"+ chr(190) +";" > """ > And a file named "features/assert_with_ptext.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step fails with assert and non-ASCII text > """ > When I run "behave -f pretty features/assert_with_ptext.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Assertion Failed: XFAIL:¾; > """ > > @issue_0226 > Scenario Outline: Step raises exception with problematic chars (case: plain) -- @1.1 # features/i18n.unicode_problems.feature:428 > Given a file named "features/steps/problematic_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'{word:w} step fails with exception and non-ASCII text') > def step_fails_with_exception_and_problematic_text(context, word): > raise RuntimeError("FAIL:"+ chr(190) +";") > """ > And a file named "features/exception_with_ptext.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step fails with exception and non-ASCII text > """ > When I run "behave -f plain features/exception_with_ptext.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > RuntimeError: FAIL:¾; > """ > > @issue_0226 > Scenario Outline: Step raises exception with problematic chars (case: pretty) -- @1.2 # features/i18n.unicode_problems.feature:429 > Given a file named "features/steps/problematic_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'{word:w} step fails with exception and non-ASCII text') > def step_fails_with_exception_and_problematic_text(context, word): > raise RuntimeError("FAIL:"+ chr(190) +";") > """ > And a file named "features/exception_with_ptext.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step fails with exception and non-ASCII text > """ > When I run "behave -f pretty features/exception_with_ptext.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > RuntimeError: FAIL:¾; > """ > >@logging @capture >Feature: Use --logging-clear-handlers configuration option # features/logcapture.clear_handlers.feature:3 > PRECONDITION: log_capture mode is enabled (config.log_capture = true). > As a tester > In log-capture mode > I want sometimes to remove any logging handler before capture starts > So that I have the log-records output under control. > @setup > Scenario: Feature Setup # features/logcapture.clear_handlers.feature:14 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.log.steps > import behave4cmd0.failing_steps > import behave4cmd0.passing_steps > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > # -- SAME-AS: context.config.setup_logging() > import logging > logging.basicConfig(level=context.config.logging_level) > > # -- ADDITIONAL LOG-HANDLER: Which will be cleared. > format = "LOG-HANDLER2: %(name)s %(levelname)s: %(message)s;" > handler = logging.StreamHandler() > handler.setFormatter(logging.Formatter(format)) > root_logger = logging.getLogger() > root_logger.addHandler(handler) > """ > And a file named "features/example.log_with_failure.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing > Given I create log records with: > | category | level | message | > | root | ERROR | Hello Alice | > | root | WARN | Hello Bob | > When a step fails > """ > > Scenario: Use logcapture mode without clearing existing log handlers # features/logcapture.clear_handlers.feature:48 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > logging_level = WARN > """ > When I run "behave -f plain features/example.log_with_failure.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured logging: > ERROR:root:Hello Alice > WARNING:root:Hello Bob > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > LOG-HANDLER2: root ERROR: Hello Alice; > LOG-HANDLER2: root WARNING: Hello Bob; > """ > > Scenario: Use logcapture mode with clearing additional log handlers (case: command-line) # features/logcapture.clear_handlers.feature:74 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > logging_level = WARN > """ > When I run "behave -f plain --logging-clear-handlers features/example.log_with_failure.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Captured logging: > ERROR:root:Hello Alice > WARNING:root:Hello Bob > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > LOG-HANDLER2: root ERROR: Hello Alice; > LOG-HANDLER2: root WARNING: Hello Bob; > """ > > Scenario: Use Logcapture mode with clearing additional log handlers (case: configfile) # features/logcapture.clear_handlers.feature:95 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > logging_level = WARN > logging_clear_handlers = true > """ > When I run "behave -f plain features/example.log_with_failure.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Captured logging: > ERROR:root:Hello Alice > WARNING:root:Hello Bob > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > LOG-HANDLER2: root ERROR: Hello Alice; > LOG-HANDLER2: root WARNING: Hello Bob; > """ > >@logging @capture >Feature: Capture log output # features/logcapture.feature:3 > As a tester > I want that log output is captured > But log-records are only shown when failures/errors occur > So that failure diagnostics are simplified > | SPECIFICATION: > | * log_capture mode is enabled per default > | * log_capture mode can be defined on command-line > | * log_capture mode can be defined in behave configuration file > | * In log_capture mode: Captured log-records are only shown if a scenario fails > | > | RELATED: > | * logcapture.*.feature > | * logging.*.feature > @setup > Scenario: Feature Setup # features/logcapture.feature:21 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.log.steps > import behave4cmd0.failing_steps > import behave4cmd0.passing_steps > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.config.setup_logging() > # -- SAME-AS: > # import logging > # logging.basicConfig(level=context.config.logging_level) > """ > And a file named "features/example.log_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Passing > Given I create log records with: > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > When another step passes > """ > And a file named "features/example.log_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing > Given I create log records with: > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > When another step fails > """ > > Scenario: Captured log is suppressed if scenario passes # features/logcapture.feature:65 > When I run "behave -f plain -T --logcapture features/example.log_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Passing > Given I create log records with ... passed > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > When another step passes ... passed > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Captured logging: > """ > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > > Scenario: Captured log is shown up to first failure if scenario fails # features/logcapture.feature:97 > When I run "behave -f plain -T --logcapture features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: Failing > Given I create log records with ... passed > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > When another step fails ... failed > Assertion Failed: EXPECT: Failing step > Captured logging: > CRITICAL:root:Hello Alice > ERROR:foo:Hello Bob > WARNING:foo.bar:Hello Charly > INFO:bar:Hello Dora > """ > And the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | Comment | > | baz | DEBUG | Hello Emily | Log-level too low: filtered-out | > > Scenario: Captured log is shown up to first failure if log_record.level is not too low # features/logcapture.feature:134 > When I run "behave -f plain --logcapture --logging-level=ERROR features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > > Scenario: Logcapture mode is enabled per default # features/logcapture.feature:151 > When I run "behave -f plain features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain "Captured logging:" # behave4cmd0/command_steps.py:154 > > Scenario: Logcapture mode can be enabled on command-line # features/logcapture.feature:157 > When I run "behave -f plain --logcapture features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain "Captured logging:" # behave4cmd0/command_steps.py:154 > > Scenario: Logcapture mode can be disabled on command-line # features/logcapture.feature:163 > When I run "behave -f plain --no-logcapture features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should not contain "Captured logging:" # behave4cmd0/command_steps.py:174 > > Scenario: Logcapture mode can be enabled in configfile # features/logcapture.feature:169 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > """ > When I run "behave -f plain features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain "Captured logging:" # behave4cmd0/command_steps.py:154 > > Scenario: Logcapture mode can be disabled in configfile # features/logcapture.feature:180 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = false > """ > When I run "behave -f plain features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should not contain "Captured logging:" # behave4cmd0/command_steps.py:174 > >Feature: Use logging_filter with logcapture # features/logcapture.filter.feature:1 > PRECONDITION: log_capture mode is enabled (config.log_capture = true). > As a tester > In log-capture mode > I want to include/exclude log-records from some logging categories > So that the output is not cluttered with unneeded information in case of failures. > Background: # features/logcapture.filter.feature:10 > > @setup > Scenario: Feature Setup # features/logcapture.filter.feature:16 > Given I define the log record schema # behave4cmd0/log/steps.py:184 > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.log.steps > import behave4cmd0.failing_steps > import behave4cmd0.passing_steps > """ > And a file named "features/logging.failing_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing > Given I create log records with: > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > | foo | ERROR | __LOG_MESSAGE__ | > | foo.bar | ERROR | __LOG_MESSAGE__ | > | bar | ERROR | __LOG_MESSAGE__ | > When another step fails > """ > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > logging_level = WARN > """ > > Scenario: Include only a logging category # features/logcapture.filter.feature:44 > Given I define the log record schema # behave4cmd0/log/steps.py:184 > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > When I run "behave --logcapture --logging-filter=foo features/logging.failing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain log records from categories # behave4cmd0/log/steps.py:259 > | category | > | foo | > But the command output should not contain log records from categories # behave4cmd0/log/steps.py:282 > | category | Comment | > | root | Not included: filtered-out | > | foo.bar | Not included: filtered-out | > | bar | Not included: filtered-out | > > Scenario: Include only a logging sub-category # features/logcapture.filter.feature:61 > Given I define the log record schema # behave4cmd0/log/steps.py:184 > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > When I run "behave --logcapture --logging-filter=foo.bar features/logging.failing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain log records from categories # behave4cmd0/log/steps.py:259 > | category | Comment | > | foo.bar | Included | > But the command output should not contain log records from categories # behave4cmd0/log/steps.py:282 > | category | Comment | > | root | Not included: filtered-out | > | foo | Not included: filtered-out | > | bar | Not included: filtered-out | > > Scenario: Exclude a logging category # features/logcapture.filter.feature:74 > Given I define the log record schema # behave4cmd0/log/steps.py:184 > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > When I run "behave --logcapture --logging-filter=-foo features/logging.failing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain log records from categories # behave4cmd0/log/steps.py:259 > | category | Comment | > | root | Not excluded: foo | > | foo.bar | Not excluded: foo | > | bar | Not excluded: foo | > But the command output should not contain log records from categories # behave4cmd0/log/steps.py:282 > | category | Comment | > | foo | Excluded | > > Scenario: Include several logging categories # features/logcapture.filter.feature:87 > Given I define the log record schema # behave4cmd0/log/steps.py:184 > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > When I run "behave --logcapture --logging-filter=foo,bar features/logging.failing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain log records from categories # behave4cmd0/log/steps.py:259 > | category | Comment | > | foo | Included: foo | > | bar | Included: bar | > But the command output should not contain log records from categories # behave4cmd0/log/steps.py:282 > | category | Comment | > | root | Not included: filtered-out | > | foo.bar | Not included (sub-category) | > > Scenario: Include/exclude several logging categories # features/logcapture.filter.feature:100 > Given I define the log record schema # behave4cmd0/log/steps.py:184 > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > When I run "behave --logcapture --logging-filter=foo.bar,-bar features/logging.failing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain log records from categories # behave4cmd0/log/steps.py:259 > | category | Comment | > | root | Not excluded: bar | > | foo | Not excluded: bar | > | foo.bar | Included | > But the command output should not contain log records from categories # behave4cmd0/log/steps.py:282 > | category | Comment | > | bar | Excluded: filtered-out | > > Scenario: Include/exclude several logging categories with configfile # features/logcapture.filter.feature:113 > Given I define the log record schema # behave4cmd0/log/steps.py:184 > | category | level | message | > | root | ERROR | __LOG_MESSAGE__ | > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > logging_level = WARN > logging_filter = foo.bar,-bar > """ > When I run "behave --logcapture features/logging.failing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain log records from categories # behave4cmd0/log/steps.py:259 > | category | Comment | > | root | Not excluded: bar | > | foo | Not excluded: bar | > | foo.bar | Included | > But the command output should not contain log records from categories # behave4cmd0/log/steps.py:282 > | category | Comment | > | bar | Excluded: filtered-out | > >@logging @no_capture >Feature: No-logcapture mode (normal mode) shows log-records # features/logging.no_capture.feature:3 > As a tester > I want that sometimes that log output is not captured > So that I can see progress even in case of success (or failures) > @setup > Scenario: Feature Setup # features/logging.no_capture.feature:11 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.log.steps > import behave4cmd0.failing_steps > import behave4cmd0.passing_steps > """ > > Scenario: Log records are shown when scenario passes (CASE 1) # features/logging.no_capture.feature:21 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > import logging > context.config.setup_logging(logging.WARN) > # -- SAME AS: > # logging.basicConfig() > # logging.getLogger().setLevel(logging.WARN) > """ > And a file named "features/logging.passing_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Passing > Given I create log records with: > | category | level | message | > | root | ERROR | Hello Alice | > | root | WARN | Hello Bob | > | root | INFO | Hello Charly | > | root | DEBUG | Hello Doro | > When another step passes > """ > When I run "behave -f plain -T --no-logcapture features/logging.passing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | ERROR | Hello Alice | > | root | WARN | Hello Bob | > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | Comment | > | root | INFO | Hello Charly | Filtered-out | > | root | DEBUG | Hello Doro | Filtered-out | > And note that "log_records with level below WARN are filtered out" # behave4cmd0/note_steps.py:15 > > @no_capture > Scenario: Log records are shown up to first failing step (CASE 2) # features/logging.no_capture.feature:60 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.config.setup_logging() > """ > And a file named "features/logging.failing_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing > Given I create log records with: > | category | level | message | > | root | ERROR | Hello Alice | > | root | WARN | Hello Bob | > | root | INFO | Hello Charly | > | root | DEBUG | Hello Doro | > When another step fails > Then I create log records with: > | category | level | message | > | root | ERROR | Hello2 Zerberus | > """ > When I run "behave -f plain -T --no-logcapture --logging-level=ERROR features/logging.failing_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 1 skipped, 0 undefined > """ > And the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | ERROR | Hello Alice | > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | Comment | > | root | WARN | Hello Bob | Filtered-out | > | root | INFO | Hello Charly | Filtered-out | > | root | DEBUG | Hello Doro | Filtered-out | > | root | ERROR | Hello2 Zerberus | Skipped | > And note that "log_records with level below ERROR are filtered out" # behave4cmd0/note_steps.py:15 > >Feature: Setup logging_format # features/logging.setup_format.feature:1 > As a tester > I want to configure the logging_format for log_capture mode > So that log-records are shown in my preferred format. > As a tester > I want to configure the logging_format for logging mode (no-log_capture) > So that log-records are shown in my preferred format. > | SPECIFICATION: > | * logging_format can be defined on command-line > | * logging_format can be defined in behave configuration file > | > | NOTE: > | The log record format can also be defined in a logging configuration file. > @setup > Scenario: Feature Setup # features/logging.setup_format.feature:19 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.log.steps > import behave4cmd0.failing_steps > import behave4cmd0.passing_steps > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.config.setup_logging() > """ > And a file named "features/example.log_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing > Given I create log records with: > | category | level | message | > | root | ERROR | Hello Alice | > | root | WARN | Hello Bob | > When a step fails > """ > > @capture > Scenario: Use logging_format on command-line (case: log_capture mode) # features/logging.setup_format.feature:44 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > logging_level = WARN > """ > When I run "behave -f plain -T --logging-format='LOG.%(levelname)-8s %(name)-10s: %(message)s' features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain "Captured logging:" # behave4cmd0/command_steps.py:154 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured logging: > LOG.ERROR root : Hello Alice > LOG.WARNING root : Hello Bob > """ > When I use the log record configuration # behave4cmd0/log/steps.py:349 > | property | value | > | format | LOG.%(levelname)-8s %(name)-10s: %(message)s | > Then the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | ERROR | Hello Alice | > | root | WARN | Hello Bob | > > @capture > Scenario: Use logging_format in config-file (case: log_capture mode) # features/logging.setup_format.feature:74 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = true > logging_level = WARN > logging_format = LOG.%(levelname)-8s %(name)-10s: %(message)s > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain "Captured logging:" # behave4cmd0/command_steps.py:154 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured logging: > LOG.ERROR root : Hello Alice > LOG.WARNING root : Hello Bob > """ > > @no_capture > Scenario: Use logging_format on command-line (case: logging mode) # features/logging.setup_format.feature:93 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = false > logging_level = WARN > """ > When I run "behave -f plain -T --logging-format='LOG.%(levelname)-8s %(name)-10s: %(message)s' features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should not contain "Captured logging:" # behave4cmd0/command_steps.py:174 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > LOG.ERROR root : Hello Alice > LOG.WARNING root : Hello Bob > """ > When I use the log record configuration # behave4cmd0/log/steps.py:349 > | property | value | > | format | LOG.%(levelname)-8s %(name)-10s: %(message)s | > Then the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | ERROR | Hello Alice | > | root | WARN | Hello Bob | > > @no_capture > Scenario: Use logging_format in config-file (case: logging mode) # features/logging.setup_format.feature:122 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = false > logging_level = WARN > logging_format = LOG.%(levelname)-8s %(name)-10s: %(message)s > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should not contain "Captured logging:" # behave4cmd0/command_steps.py:174 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > LOG.ERROR root : Hello Alice > LOG.WARNING root : Hello Bob > """ > > @capture > Scenario: Use logging_datefmt in config-file # features/logging.setup_format.feature:140 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > logging_format = %(asctime)s LOG.%(levelname)-8s %(name)s: %(message)s > logging_datefmt = %Y-%m-%dT%H:%M:%S > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain "LOG.ERROR root: Hello Alice" # behave4cmd0/command_steps.py:154 > And the command output should contain "LOG.WARNING root: Hello Bob" # behave4cmd0/command_steps.py:154 > >Feature: Setup logging_level # features/logging.setup_level.feature:1 > As a tester > I want to configure the logging_level for --logcapture mode > So that I see only the important log-records when a scenario fails. > As a tester > I want to configure the logging_level for --nologcapture mode > So that I see only the important log-records up to this level. > | SPECIFICATION: > | * logging_level can be defined on command-line > | * logging_level can be defined in behave configuration file > | * logging_level should be applied in before_all() hook in --nologcapture mode > @setup > Scenario: Feature Setup # features/logging.setup_level.feature:18 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.log.steps > import behave4cmd0.failing_steps > import behave4cmd0.passing_steps > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.config.setup_logging() > """ > And a file named "features/example.log_with_failure.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: S1 > Given I create log records with: > | category | level | message | > | root | ERROR | Hello1 log-error-record | > | root | WARN | Hello1 log-warn-record | > | root | INFO | Hello1 log-info-record | > | root | DEBUG | Hello1 log-debug-record | > When a step fails > """ > And a file named "features/example.log_with_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: S2 > Given I create log records with: > | category | level | message | > | root | ERROR | Hello2 log-error-record | > | root | WARN | Hello2 log-warn-record | > | root | INFO | Hello2 log-info-record | > | root | DEBUG | Hello2 log-debug-record | > When a step passes > """ > > @capture > Scenario: Logcapture mode: Use logging_level on command-line # features/logging.setup_level.feature:57 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > logging_level = INFO > """ > When I run "behave -f plain -T --logging-level=WARN features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 3 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured logging: > ERROR:root:Hello1 log-error-record > WARNING:root:Hello1 log-warn-record > """ > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | Comment | > | root | INFO | Hello1 log-info-record | Log-level too low | > | root | DEBUG | Hello1 log-debug-record | Log-level too low | > | root | ERROR | Hello2 log-error-record | Scenario passes, capture log is suppressed | > | root | WARN | Hello2 log-warn-record | Scenario passes, capture log is suppressed | > | root | INFO | Hello2 log-info-record | Scenario passes, capture log is suppressed | > | root | DEBUG | Hello2 log-debug-record | Scenario passes, capture log is suppressed | > > @capture > Scenario: Logcapture mode: Use logging_level in configuration file # features/logging.setup_level.feature:89 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > logging_level = ERROR > """ > When I run "behave -f plain -T features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 3 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured logging: > ERROR:root:Hello1 log-error-record > """ > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | Comment | > | root | WARN | Hello1 log-warn-record | Log-level too low | > | root | INFO | Hello1 log-info-record | Log-level too low | > | root | DEBUG | Hello1 log-debug-record | Log-level too low | > | root | ERROR | Hello2 log-error-record | Scenario passes | > | root | WARN | Hello2 log-warn-record | Scenario passes | > | root | INFO | Hello2 log-info-record | Scenario passes | > | root | DEBUG | Hello2 log-debug-record | Scenario passes | > > @no_capture > Scenario: Normal mode: Use logging_level on command-line # features/logging.setup_level.feature:118 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > logging_level = INFO > """ > When I run "behave -f plain -T --logging-level=WARN --no-logcapture features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 3 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | ERROR | Hello1 log-error-record | > | root | WARN | Hello1 log-warn-record | > | root | ERROR | Hello2 log-error-record | > | root | WARN | Hello2 log-warn-record | > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | Comment | > | root | INFO | Hello1 log-info-record | Log-level too low | > | root | DEBUG | Hello1 log-debug-record | Same reason | > | root | INFO | Hello2 log-info-record | Same reason | > | root | DEBUG | Hello2 log-debug-record | Same reason | > > @no_capture > Scenario: Normal mode: Use logging_level in configuration file # features/logging.setup_level.feature:144 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = false > logging_level = ERROR > """ > When I run "behave -f plain -T features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 3 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | ERROR | Hello1 log-error-record | > | root | ERROR | Hello2 log-error-record | > But the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | Comment | > | root | WARN | Hello1 log-warn-record | Log-level too low | > | root | INFO | Hello1 log-info-record | Same reason | > | root | DEBUG | Hello1 log-debug-record | Same reason | > | root | WARN | Hello2 log-warn-record | Same reason | > | root | INFO | Hello2 log-info-record | Same reason | > | root | DEBUG | Hello2 log-debug-record | Same reason | > >Feature: Setup logging subsystem by using a logging configfile # features/logging.setup_with_configfile.feature:1 > As a tester > I want to setup the logging subsystem by using a configfile > To be more flexible even in complex situations > @setup > Scenario: Feature setup # features/logging.setup_with_configfile.feature:8 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.log.steps > import behave4cmd0.failing_steps > import behave4cmd0.passing_steps > """ > And a file named "features/example.log_and_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Passing > Given I create log records with: > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > And another step passes > """ > And a file named "features/example.log_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing > Given I create log records with: > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > And another step fails > """ > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = false > logging_level = DEBUG > logging_format = LOG.%(levelname)-8s %(name)-10s: %(message)s > """ > And a file named "behave_logging.ini" with # behave4cmd0/command_steps.py:50 > """ > [loggers] > keys=root > > [handlers] > keys=Console,File > > [formatters] > keys=Brief > > [logger_root] > level = NOTSET > handlers = File > # handlers = Console,File > > [handler_File] > class=FileHandler > args=("behave.log", 'w') > level=NOTSET > formatter=Brief > > [handler_Console] > class=StreamHandler > args=(sys.stderr,) > level=NOTSET > formatter=Brief > > [formatter_Brief] > format= LOG.%(levelname)-8s %(name)-10s: %(message)s > datefmt= > """ > > Scenario: Setup logging subsystem via environment (case: logging mode) # features/logging.setup_with_configfile.feature:82 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.config.setup_logging(configfile="behave_logging.ini") > """ > And I use the log record configuration # behave4cmd0/log/steps.py:349 > | property | value | > | format | LOG.%(levelname)-8s %(name)-10s: %(message)s | > When I run "behave -f plain features/example.log_and_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the file "behave.log" should contain the log records # behave4cmd0/log/steps.py:304 > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > And the command output should not contain the following log records # behave4cmd0/log/steps.py:222 > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > > Scenario: Setup logging subsystem via environment (case: log-capture mode) # features/logging.setup_with_configfile.feature:109 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.config.setup_logging(configfile="behave_logging.ini") > """ > And I use the log record configuration # behave4cmd0/log/steps.py:349 > | property | value | > | format | LOG.%(levelname)-8s %(name)-10s: %(message)s | > When I run "behave -f plain --logcapture features/example.log_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the file "behave.log" should contain the log records # behave4cmd0/log/steps.py:304 > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > And the command output should contain the following log records # behave4cmd0/log/steps.py:197 > | category | level | message | > | root | FATAL | Hello Alice | > | foo | ERROR | Hello Bob | > | foo.bar | WARN | Hello Charly | > | bar | INFO | Hello Dora | > | baz | DEBUG | Hello Emily | > >Feature: Ensure that BAD/SAD Use cases of Background are detected # features/parser.background.sad_cases.feature:1 > To improve diagnostics when parser failures occur > As a test writer > I expect reasonable explanations what went wrong. > @setup > Scenario: Feature Setup # features/parser.background.sad_cases.feature:8 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step passes with "{text}"') > def step_passes(context, text): > pass > """ > > Scenario: Background with tags is not supported # features/parser.background.sad_cases.feature:24 > Given a file named "features/syndrome.background_with_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Ensure this fails > > @tags_are @not_supported @here > Background: Oops... > Given a step passes > > Scenario: More... > Given a step passes > """ > When I run "behave -f plain -T features/syndrome.background_with_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failed to parse "{__WORKDIR__}/features/syndrome.background_with_tags.feature": > Parser failure in state next_scenario, at line 4: 'Background: Oops...' > REASON: Background does not support tags. > """ > > Scenario: Background should not occur after a Scenario # features/parser.background.sad_cases.feature:45 > Given a file named "features/syndrome.background_after_scenario.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Ensure this fails1 > > Scenario: One... > Given a step passes > > Background: Oops, too late (after Scenario) > When a step passes > """ > When I run "behave -f plain -T features/syndrome.background_after_scenario.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failed to parse "{__WORKDIR__}/features/syndrome.background_after_scenario.feature": > Parser failure in state steps, at line 6: 'Background: Oops, too late (after Scenario)' > REASON: Background may not occur after Scenario/ScenarioOutline. > """ > > Scenario: Tagged Background should not occur after a Scenario # features/parser.background.sad_cases.feature:65 > Given a file named "features/syndrome.tagged_background_after_scenario.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Ensure this fails1 > > Scenario: One... > Given a step passes > > @tags_are @not_supported @here > Background: Oops, too late (after Scenario) > When a step passes > """ > When I run "behave -f plain -T features/syndrome.tagged_background_after_scenario.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Parser failure in state next_scenario, at line 7: 'Background: Oops, too late (after Scenario)' > REASON: Background may not occur after Scenario/ScenarioOutline. > """ > > Scenario: Background should not occur after a Scenario Outline # features/parser.background.sad_cases.feature:85 > Given a file named "features/syndrome.background_after_scenario_outline.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Ensure this fails3 > > Scenario Outline: Two... > Given a step passes with "<name>" > > Examples: > | name | > | Alice | > > Background: Oops, too late (after Scenario Outline) > When a step passes > """ > When I run "behave -f plain -T features/syndrome.background_after_scenario_outline.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Parser failure in state steps, at line 10: 'Background: Oops, too late (after Scenario Outline)' > REASON: Background may not occur after Scenario/ScenarioOutline. > """ > > Scenario: Tagged Background should not occur after a Scenario Outline # features/parser.background.sad_cases.feature:108 > Given a file named "features/syndrome.background_after_scenario_outline.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Ensure this fails4 > > Scenario Outline: Two... > Given a step passes with "<name>" > > Examples: > | name | > | Alice | > > @tags_are @not_supported @here > Background: Oops, too late (after Scenario Outline) > When a step passes > """ > When I run "behave -f plain -T features/syndrome.background_after_scenario_outline.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Parser failure in state next_scenario, at line 11: 'Background: Oops, too late (after Scenario Outline)' > REASON: Background may not occur after Scenario/ScenarioOutline. > """ > >Feature: Parsing a Feature File without a Feature or with several Features # features/parser.feature.sad_cases.feature:1 > > @setup > Scenario: Feature Setup # features/parser.feature.sad_cases.feature:5 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "features/steps/empty_steps.py" # behave4cmd0/command_steps.py:66 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > > @no_feature > Scenario: Empty Feature File # features/parser.feature.sad_cases.feature:18 > Given an empty file named "features/empty.feature" # behave4cmd0/command_steps.py:66 > When I run "behave -f plain features/empty.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped > 0 scenarios passed, 0 failed, 0 skipped > 0 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @no_feature > Scenario: Feature File without Feature, only with Comments # features/parser.feature.sad_cases.feature:30 > Given a file named "features/only_comments.feature" with # behave4cmd0/command_steps.py:50 > """ > # COMMENT: Comment starts at begin of line. > # INDENTED-COMMENT: Comment starts after some whitespace. > """ > When I run "behave -f plain features/only_comments.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped > 0 scenarios passed, 0 failed, 0 skipped > 0 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @no_feature > Scenario: Feature File without Feature, only with Empty Lines # features/parser.feature.sad_cases.feature:46 > Given a file named "features/only_empty_lines.feature" with # behave4cmd0/command_steps.py:50 > When I run "behave -f plain features/only_empty_lines.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped > 0 scenarios passed, 0 failed, 0 skipped > 0 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @no_feature > Scenario: Feature File without Feature, only with Tags # features/parser.feature.sad_cases.feature:61 > Given a file named "features/only_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > @weird > @no_feature > """ > When I run "behave -f plain features/only_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped > 0 scenarios passed, 0 failed, 0 skipped > 0 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @no_feature @parser.with_parse_error > Scenario: Feature File with Text # features/parser.feature.sad_cases.feature:77 > Given a file named "features/only_text.feature" with # behave4cmd0/command_steps.py:50 > """ > This File: Contains only text without keywords. > OOPS. > """ > When I run "behave -f plain features/only_text.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failed to parse "{__WORKDIR__}/features/only_text.feature": > Parser failure in state init, at line 1: 'This File: Contains only text without keywords.' > REASON: No feature found. > """ > > @no_feature @parser.with_parse_error > Scenario: Feature File with Scenario, but without Feature keyword # features/parser.feature.sad_cases.feature:94 > Given a file named "features/naked_scenario_only.feature" with # behave4cmd0/command_steps.py:50 > """ > Scenario: > Given a step passes > When a step passes > Then a step passes > """ > When I run "behave -f plain features/naked_scenario_only.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failed to parse "{__WORKDIR__}/features/naked_scenario_only.feature": > Parser failure in state init, at line 1: 'Scenario:' > REASON: Scenario may not occur before Feature. > """ > > @many_features @parser.with_parse_error > Scenario: Feature file with 2 features # features/parser.feature.sad_cases.feature:113 > Given a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/two_features.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: F1 > Scenario: F1.1 > Given a step passes > When a step passes > Then a step passes > > Feature: F2 > Scenario: F2.1 > Given a step passes > Then a step passes > """ > When I run "behave -f plain features/two_features.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failed to parse "{__WORKDIR__}/features/two_features.feature": > Parser failure in state steps, at line 7: 'Feature: F2' > REASON: Multiple features in one file are not supported. > """ > >Feature: Test run can be aborted by the user # features/runner.abort_by_user.feature:1 > As a tester > I want sometimes to abort a test run (because it is anyway failing, etc.) > So that I am more productive. > | NOTES: > | * The test runner should fail gracefully (most of the times) > | * At least some cleanup hooks should be called (in general) > @setup > Scenario: Feature Setup # features/runner.abort_by_user.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/aborting_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('the user aborts the test run') > def step_user_aborts_testrun(context): > raise KeyboardInterrupt() > """ > And a file named "features/scenarios_pass3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When another step passes > > Scenario: > Given first step passes > When second step passes > Then third step passes > > Scenario: > Then last step passes > """ > > Scenario: Abort test run in step definition # features/runner.abort_by_user.feature:44 > Given a file named "features/aborting_in_step.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: User aborts test run in a step definition > Scenario: > Given a step passes > When another step passes > > Scenario: User aborts here > Given first step passes > When the user aborts the test run > Then third step passes > > Scenario: > Then last step passes > """ > And an empty file named "features/environment.py" # behave4cmd0/command_steps.py:66 > When I run "behave -f plain -T features/aborting_in_step.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped, 1 untested > 3 steps passed, 1 failed, 1 skipped, 0 undefined, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: User aborts test run in a step definition > > Scenario: > Given a step passes ... passed > When another step passes ... passed > > Scenario: User aborts here > Given first step passes ... passed > When the user aborts the test run ... failed > ABORTED: By user (KeyboardInterrupt). > > ABORTED: By user. > > Failing scenarios: > features/aborting_in_step.feature:6 User aborts here > """ > But note that "the last scenario is untested (not-run) due to the user abort" # behave4cmd0/note_steps.py:15 > > Scenario: Abort test run in before_scenario hook # features/runner.abort_by_user.feature:89 > Given a file named "features/aborting_in_before_scenario_hook.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: User aborts test run in before_scenario hook > Scenario: > Given a step passes > When another step passes > > @user.aborts.before_scenario > Scenario: User aborts here > Given first step passes > When second step passes > Then third step passes > > Scenario: > Then last step passes > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_scenario(context, scenario): > if "user.aborts.before_scenario" in scenario.tags: > raise KeyboardInterrupt() > """ > When I run "behave -f plain -T features/aborting_in_before_scenario_hook.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > ABORTED: By user. > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped, 2 untested > 2 steps passed, 0 failed, 0 skipped, 0 undefined, 4 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: User aborts test run in before_scenario hook > > Scenario: > Given a step passes ... passed > When another step passes ... passed > > Scenario: User aborts here > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Given first step passes ... passed > When second step passes ... passed > Then third step passes ... passed > > Scenario: > Then last step passes ... passed > """ > And note that "the second snd third/last scenario is not run" # behave4cmd0/note_steps.py:15 > > Scenario: Abort test run in after_scenario hook # features/runner.abort_by_user.feature:142 > Given a file named "features/aborting_in_after_scenario_hook.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: User aborts test run in after_scenario hook > Scenario: > Given a step passes > When another step passes > > @user.aborts.after_scenario > Scenario: User aborts here > Given first step passes > When second step passes > Then third step passes > > Scenario: > Then last step passes > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def after_scenario(context, scenario): > if "user.aborts.after_scenario" in scenario.tags: > raise KeyboardInterrupt() > """ > When I run "behave -f plain -T features/aborting_in_after_scenario_hook.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > ABORTED: By user. > 0 features passed, 1 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped, 1 untested > 5 steps passed, 0 failed, 0 skipped, 0 undefined, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: User aborts test run in after_scenario hook > > Scenario: > Given a step passes ... passed > When another step passes ... passed > > Scenario: User aborts here > Given first step passes ... passed > When second step passes ... passed > Then third step passes ... passed > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: > Then last step passes ... passed > """ > And note that "the last scenario is not run" # behave4cmd0/note_steps.py:15 > > Scenario: Abort test run in before_feature hook # features/runner.abort_by_user.feature:194 > Given a file named "features/aborting_in_before_feature_hook.feature" with # behave4cmd0/command_steps.py:50 > """ > @user.aborts.before_feature > Feature: User aborts test HERE > Scenario: > Given a step passes > When another step passes > > Scenario: > Given first step passes > When second step passes > Then third step passes > > Scenario: > Then last step passes > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_feature(context, feature): > if "user.aborts.before_feature" in feature.tags: > raise KeyboardInterrupt() > """ > When I run "behave -f plain -T features/aborting_in_before_feature_hook.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Feature: User aborts test HERE > > ABORTED: By user. > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 3 untested > 0 steps passed, 0 failed, 0 skipped, 0 undefined, 6 untested > """ > And note that "the feature is not run" # behave4cmd0/note_steps.py:15 > > Scenario: Abort test run in after_feature hook # features/runner.abort_by_user.feature:230 > Given a file named "features/aborting_in_after_feature_hook.feature" with # behave4cmd0/command_steps.py:50 > """ > @user.aborts.after_feature > Feature: User aborts test after HERE > Scenario: > Given a step passes > When another step passes > > Scenario: > Given first step passes > When second step passes > Then third step passes > > Scenario: > Then last step passes > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def after_feature(context, feature): > if "user.aborts.after_feature" in feature.tags: > raise KeyboardInterrupt() > """ > When I run "behave -f plain -T features/aborting_in_after_feature_hook.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > ABORTED: By user. > 1 feature passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > But note that "the behave command fails, but all features/scenarios passed" # behave4cmd0/note_steps.py:15 > > Scenario: Abort test run in before_all hook # features/runner.abort_by_user.feature:264 > Given a file named "features/scenarios_pass3.feature" exists # behave4cmd0/command_steps.py:336 > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > raise KeyboardInterrupt() #< ABORT-HERE > """ > When I run "behave -f plain -T features/scenarios_pass3.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Traceback (most recent call last): > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > File "features/environment.py", line 2, in before_all > raise KeyboardInterrupt() #< ABORT-HERE > """ > And note that "no feature is not run" # behave4cmd0/note_steps.py:15 > > Scenario: Abort test run in after_all hook # features/runner.abort_by_user.feature:287 > Given a file named "features/scenarios_pass3.feature" exists # behave4cmd0/command_steps.py:336 > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def after_all(context): > raise KeyboardInterrupt() #< ABORT-HERE > """ > When I run "behave -f plain -T features/scenarios_pass3.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Traceback (most recent call last): > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > File "features/environment.py", line 2, in after_all > raise KeyboardInterrupt() #< ABORT-HERE > """ > And note that "all features are run" # behave4cmd0/note_steps.py:15 > >@sequential >Feature: Default Formatter # features/runner.default_format.feature:2 > | Specification: > | * Default formatter is used when no other formatter is specified/provided. > | * Default formatter uses stdout as default output/outfile. > | * Pretty formatter is the default formatter. > | * Behave configfile can specify the default formatter. > @setup > Scenario: Test Setup # features/runner.default_format.feature:12 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > When a step passes > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > When a step passes > Then a step passes > """ > > @no_configfile > Scenario: Pretty formatter is used as default formatter if no other is defined # features/runner.default_format.feature:39 > Given a file named "behave.ini" does not exist # behave4cmd0/command_steps.py:348 > When I run "behave -c features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice # features/alice.feature:1 > Scenario: A1 # features/alice.feature:2 > Given a step passes # features/steps/passing_steps.py:3 > When a step passes # features/steps/passing_steps.py:3 > Then a step passes # features/steps/passing_steps.py:3 > > Feature: Bob # features/bob.feature:1 > Scenario: B1 # features/bob.feature:2 > When a step passes # features/steps/passing_steps.py:3 > Then a step passes # features/steps/passing_steps.py:3 > """ > > @with_configfile > Scenario: Configfile can define own default formatter # features/runner.default_format.feature:63 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > default_format = plain > show_timings = false > """ > When I run "behave features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > > @with_configfile > Scenario: Use default formatter with own outfile instead of stdout # features/runner.default_format.feature:91 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > default_format = plain > show_timings = false > """ > When I run "behave --outfile=output/default.out features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the file "output/default.out" should contain # behave4cmd0/command_steps.py:399 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > > @with_configfile > Scenario: Can override default formatter from configfile on command-line # features/runner.default_format.feature:120 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > default_format = plain > show_timings = false > """ > When I run "behave -f progress features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > features/alice.feature . > features/bob.feature . > """ > > @with_configfile > Scenario: Default formatter is used when non is provided on command-line # features/runner.default_format.feature:142 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > default_format = plain > format = progress > outfiles = output/progress.out > show_timings = false > """ > And I remove the directory "output" # behave4cmd0/command_steps.py:274 > When I run "behave features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > And the file "output/progress.out" should contain # behave4cmd0/command_steps.py:399 > """ > features/alice.feature . > features/bob.feature . > """ > >@sequential >Feature: Runner should support a --dry-run option # features/runner.dry_run.feature:2 > As a tester > I want to check if behave tests are syntactically correct > And all step definitions exist > Before I actually run the tests (by executing steps). > | Specification: Dry-run mode > | * Undefined steps are detected > | * Marks steps as "untested" or "undefined" > | * Marks scenarios as "untested" > | * Marks features as "untested" > | * Causes no failed scenarios, features > | * Causes failed test-run when undefined steps are found. > @setup > Scenario: Feature Setup # features/runner.dry_run.feature:18 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL" > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > > @selected > Scenario: A1 > Given a step passes > When a step passes > Then a step passes > > @other_selected > Scenario: A2 > Given a step passes > When a step fails > Then a step passes > > @selected > Scenario: A3 > Given a step passes > > @selected > Scenario: A4 > Given a step fails > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > Given a step passes > When a step passes > Then a step passes > > Scenario: B2 > Given a step passes > When a step fails > Then a step passes > """ > And a file named "features/undefined_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Undefined Steps > > @selected > Scenario: U1 > Given a step passes > When a step is undefined > Then a step fails > > @other_selected > Scenario: U2 fails > Given a step is undefined > When a step passes > And a step fails > Then a step is undefined > """ > > Scenario: Dry-run one feature should mark feature/scenarios/steps as untested # features/runner.dry_run.feature:88 > When I run "behave -f plain --dry-run features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 4 untested > 0 steps passed, 0 failed, 0 skipped, 0 undefined, 8 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Scenario: A2 > Scenario: A3 > Scenario: A4 > """ > > Scenario: Dry-run one feature with tags should mark skipped scenario/steps as skipped # features/runner.dry_run.feature:105 > When I run "behave -f plain --dry-run --tags=@selected --no-skipped features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 3 untested > 0 steps passed, 0 failed, 3 skipped, 0 undefined, 5 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Scenario: A3 > Scenario: A4 > """ > > Scenario: Dry-run two features # features/runner.dry_run.feature:122 > When I run "behave --dry-run features/alice.feature features/bob.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 0 skipped, 6 untested > 0 steps passed, 0 failed, 0 skipped, 0 undefined, 14 untested > """ > > Scenario: Dry-run one feature with undefined steps # features/runner.dry_run.feature:131 > When I run "behave --dry-run features/undefined_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > 0 steps passed, 0 failed, 0 skipped, 3 undefined, 4 untested > """ > > Scenario: Dry-run two features, one with undefined steps # features/runner.dry_run.feature:140 > When I run "behave --dry-run features/alice.feature features/undefined_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 0 skipped, 6 untested > 0 steps passed, 0 failed, 0 skipped, 3 undefined, 12 untested > """ > > Scenario: Dry-run two features, one with undefined steps and use tags # features/runner.dry_run.feature:149 > When I run "behave --dry-run --tags=@selected features/alice.feature features/undefined_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 2 skipped, 4 untested > 0 steps passed, 0 failed, 7 skipped, 1 undefined, 7 untested > """ > > Scenario: Dry-run two features, one with undefined steps and use other tags # features/runner.dry_run.feature:158 > When I run "behave --dry-run --tags=@other_selected features/alice.feature features/undefined_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 4 skipped, 2 untested > 0 steps passed, 0 failed, 8 skipped, 2 undefined, 5 untested > """ > >@sequential >Feature: Feature Listfile (List of feature filenames/directories) # features/runner.feature_listfile.feature:2 > As a tester > I want to run a list of features together > And I do not want to provide the list each time > But provide a text file that contains the list of features. > | SPECIFICATION: behave file args > | * Prepend an '@' char (AT) to the feature configfile name to classify it. > | > | SPECIFICATION: Feature listfile (text file) > | * Each line contains a feature filename or directory with features > | * Feature filenames/dirnames are relative to the feature configfile > | * Empty lines are removed while reading > | * Comment lines are removed while reading (start with '#' char) > | * Wildcards are expanded to select 0..N files or directories. > | * Wildcards for file locations are not supported (only filenames or dirs). > | > | SPECIFICATION: Runner > | * Feature configfile with unknown/not found feature files > | cause runner to fail. > | > | NOTE: Also supported by Cucumber. > | RELATED: > | * issue #75 > @setup > Scenario: Test Setup # features/runner.feature_listfile.feature:30 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: > Given a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: > Given a step passes > """ > > Scenario: Use @feature_listfile in WORKDIR directory (above features/) # features/runner.feature_listfile.feature:54 > Given a file named "alice_and_bob2.txt" with # behave4cmd0/command_steps.py:50 > """ > features/alice.feature > features/bob.feature > """ > When I run "behave @alice_and_bob2.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Use @feature_listfile in features/ subdirectory (Case 2) # features/runner.feature_listfile.feature:69 > Given a file named "features/alice_and_bob.txt" with # behave4cmd0/command_steps.py:50 > """ > alice.feature > bob.feature > """ > When I run "behave @features/alice_and_bob.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Use @feature_listfile with some empty lines # features/runner.feature_listfile.feature:83 > Given a file named "features/alice_and_bob_with_empty_lines.txt" with # behave4cmd0/command_steps.py:50 > """ > alice.feature > > bob.feature > """ > When I run "behave @features/alice_and_bob_with_empty_lines.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Use @feature_listfile with some comment lines # features/runner.feature_listfile.feature:98 > Given a file named "features/alice_and_bob_with_comment_lines.txt" with # behave4cmd0/command_steps.py:50 > """ > alice.feature > # -- USE: bob (comment line) > bob.feature > """ > When I run "behave @features/alice_and_bob_with_comment_lines.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Use @feature_listfile with wildcards (Case 1) # features/runner.feature_listfile.feature:113 > Given a file named "with_wildcard_feature.txt" with # behave4cmd0/command_steps.py:50 > """ > features/a*.feature > """ > When I run "behave -f plain --no-timings @with_wildcard_feature.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > > Scenario: > Given a step passes ... passed > """ > > Scenario: Use @feature_listfile with wildcards (Case 2) # features/runner.feature_listfile.feature:135 > Given a file named "with_wildcard_feature2.txt" with # behave4cmd0/command_steps.py:50 > """ > features/alice.feature > features/b*.feature > """ > When I run "behave -f plain --no-timings @with_wildcard_feature2.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > > Scenario: > Given a step passes ... passed > > Feature: Bob > > Scenario: > Given a step passes ... passed > """ > > Scenario: Use @feature_listfile with wildcards for file location (not supported) # features/runner.feature_listfile.feature:165 > Given a file named "with_wildcard_location.txt" with # behave4cmd0/command_steps.py:50 > """ > features/a*.feature:3 > """ > When I run "behave -f plain --no-timings @with_wildcard_location.txt" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > ConfigError: No steps directory in "{__WORKDIR__}" > """ > > Scenario: Use empty @feature_listfile (Case 1) # features/runner.feature_listfile.feature:180 > Given an empty file named "empty.txt" # behave4cmd0/command_steps.py:66 > When I run "behave @empty.txt" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > No steps directory in "{__WORKDIR__}" > """ > > Scenario: Use empty @feature_listfile in features subdirectory (Case 2) # features/runner.feature_listfile.feature:188 > Given an empty file named "features/empty.txt" # behave4cmd0/command_steps.py:66 > When I run "behave @features/empty.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped > """ > > Scenario: Use @feature_listfile with unknown feature file (Case 1) # features/runner.feature_listfile.feature:196 > Given a file named "with_unknown_feature.txt" with # behave4cmd0/command_steps.py:50 > """ > features/alice.feature > features/UNKNOWN.feature > """ > When I run "behave @with_unknown_feature.txt" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Error: [Errno 2] No such file or directory: '{__WORKDIR__}/features/UNKNOWN.feature' > """ > > Scenario: Use @feature_listfile with unknown feature file (Case 2) # features/runner.feature_listfile.feature:208 > Given a file named "features/with_unknown_feature2.txt" with # behave4cmd0/command_steps.py:50 > """ > UNKNOWN.feature > """ > When I run "behave @features/with_unknown_feature2.txt" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Error: [Errno 2] No such file or directory: '{__WORKDIR__}/features/UNKNOWN.feature' > """ > > Scenario: Use unknown @feature_listfile # features/runner.feature_listfile.feature:219 > When I run "behave @unknown_feature_configfile.txt" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > FileNotFoundError: unknown_feature_configfile.txt > """ > >Feature: Multiple Formatter with different outputs # features/runner.multiple_formatters.feature:1 > | Specification: Command-line option --format > | * Each --format option specifies one formatter to use. > | > | Specification: Command-line option --outfile > | * Multiple --outfile options can be provided > | * The nth --outfile option is used for the nth formatter > | * If less --outfile options are provided than formatter, > | the remaining formatter use stdout as output stream. > | Therefore, the last formatter should in general use stdout. > | > | Specification: Configuration file > | * Option format with one or more formatters can be used (optional). > | * Formatters specified in the configuration file are always executed. > | * If not enough outfiles are specified, the outfiles list is extended > | by using an outfile "${format}.output" for each missing outfile. > | > | RELATED TO: > | * issue #47 Formatter chain is broken > @setup > Scenario: Test Setup # features/runner.multiple_formatters.feature:24 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > When a step passes > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > When a step passes > Then a step passes > """ > > @no_configfile > Scenario: One formatter, no outfile (use stdout instead) # features/runner.multiple_formatters.feature:51 > Given a file named "behave.ini" does not exist # behave4cmd0/command_steps.py:348 > When I run "behave -f plain -T features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > > @no_configfile > Scenario: One formatter, one outfile # features/runner.multiple_formatters.feature:74 > Given a file named "behave.ini" does not exist # behave4cmd0/command_steps.py:348 > When I run "behave -f plain --outfile=output/plain.out -T features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > Scenario: A1 > """ > But a file named "output/plain.out" should exist # behave4cmd0/command_steps.py:360 > And the file "output/plain.out" should contain # behave4cmd0/command_steps.py:399 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > > @no_configfile > Scenario: Two formatter, one outfile # features/runner.multiple_formatters.feature:103 > Given a file named "behave.ini" does not exist # behave4cmd0/command_steps.py:348 > When I run "behave -f plain -o output/plain.out -f progress -T features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > features/alice.feature . > features/bob.feature . > """ > But a file named "output/plain.out" should exist # behave4cmd0/command_steps.py:360 > And the file "output/plain.out" should contain # behave4cmd0/command_steps.py:399 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > > @no_configfile > Scenario: More outfiles than formatter should fail with CONFIG-ERROR # features/runner.multiple_formatters.feature:133 > Given a file named "behave.ini" does not exist # behave4cmd0/command_steps.py:348 > When I run "behave -f plain -o plain.output -o xxx.output features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > CONFIG-ERROR: More outfiles (2) than formatters (1). > """ > > @with_configfile > Scenario: Use default formatter and outfile from behave configuration file # features/runner.multiple_formatters.feature:142 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > format = plain > outfiles = output/plain.out > show_timings = false > """ > And I remove the directory "output" # behave4cmd0/command_steps.py:274 > When I run "behave features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > Scenario: A1 > """ > But a file named "output/plain.out" should exist # behave4cmd0/command_steps.py:360 > And the file "output/plain.out" should contain # behave4cmd0/command_steps.py:399 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > > @with_configfile > Scenario: Use default formatter and another without outfile from behave configuration file # features/runner.multiple_formatters.feature:174 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > default_format = plain > format = progress > # -- OOPS: No outfile specified => Use "${format}.output" as outfile > show_timings = false > """ > And I remove the directory "output" # behave4cmd0/command_steps.py:274 > When I run "behave features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > And a file named "progress.output" should exist # behave4cmd0/command_steps.py:360 > And the file "progress.output" should contain # behave4cmd0/command_steps.py:399 > """ > features/alice.feature . > features/bob.feature . > """ > > @with_configfile > Scenario: Command-line formatter/outfile extend behave configuration file args # features/runner.multiple_formatters.feature:208 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > show_timings = false > format = plain > outfiles = output/plain.out > """ > And I remove the directory "output" # behave4cmd0/command_steps.py:274 > When I run "behave -c -f pretty -o output/pretty.out -f progress -o output/progress.out features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the file "output/progress.out" should contain # behave4cmd0/command_steps.py:399 > """ > features/alice.feature . > features/bob.feature . > """ > And the file "output/pretty.out" should contain # behave4cmd0/command_steps.py:399 > """ > Feature: Alice # features/alice.feature:1 > Scenario: A1 # features/alice.feature:2 > Given a step passes # features/steps/passing_steps.py:3 > When a step passes # features/steps/passing_steps.py:3 > Then a step passes # features/steps/passing_steps.py:3 > > Feature: Bob # features/bob.feature:1 > Scenario: B1 # features/bob.feature:2 > When a step passes # features/steps/passing_steps.py:3 > Then a step passes # features/steps/passing_steps.py:3 > """ > And a file named "output/plain.out" should exist # behave4cmd0/command_steps.py:360 > And the file "output/plain.out" should contain # behave4cmd0/command_steps.py:399 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Feature: Bob > Scenario: B1 > When a step passes ... passed > Then a step passes ... passed > """ > > @with_configfile > Scenario: Combination of formatter from configfile and command-line cannot cause outfile offsets # features/runner.multiple_formatters.feature:254 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > show_timings = false > format = plain > # -- OOPS: No outfiles defined => Use "${format}.output" as outfile. > """ > And I remove the directory "output" # behave4cmd0/command_steps.py:274 > When I run "behave -f progress -o output/progress.out features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > """ > But the file "plain.output" should contain # behave4cmd0/command_steps.py:399 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > """ > And the file "output/progress.out" should contain # behave4cmd0/command_steps.py:399 > """ > features/alice.feature . > features/bob.feature . > """ > >Feature: Select feature files by using regular expressions (self-test) # features/runner.select_files_by_regexp.example.feature:1 > Use behave self-tests to ensure that --incude/--exclude options work. > RELATED: runner.select_files_by_regexp.feature > @setup > Scenario: Feature Setup # features/runner.select_files_by_regexp.example.feature:7 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "features/steps/steps.py" # behave4cmd0/command_steps.py:66 > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > """ > And a file named "features/barbi.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Barbi > Scenario: B1 > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B2 > """ > > Scenario: Include only feature files # features/runner.select_files_by_regexp.example.feature:27 > When I run "behave --include='features/b.*' -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Barbi > Scenario: B1 > > Feature: Bob > Scenario: B2 > """ > > Scenario: Exclude only feature files # features/runner.select_files_by_regexp.example.feature:45 > When I run "behave --exclude='features/b.*' -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > """ > > Scenario: Include and exclude feature files # features/runner.select_files_by_regexp.example.feature:59 > When I run "behave --include='features/.*a.*\.feature' --exclude='.*/barbi.*' -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > """ > >@sequential >Feature: Select feature files by using regular expressions # features/runner.select_files_by_regexp.feature:2 > As a tester > I want to include/exclude feature files into/from a test run by using wildcards > To be more flexible and avoid to specify all feature files > | SPECIFICATION: > | * behave provides --include and --exclude command line options > | * --include option selects a subset of all files that should be included > | * --exclude option is applied after include option is applied > | > | EXAMPLE: > | behave --include="features/ali.*\.feature" ... > | behave --exclude="features/ali.*" ... > Background: # features/runner.select_files_by_regexp.feature:18 > > Scenario: Include only feature files # features/runner.select_files_by_regexp.feature:26 > Given behave has the following feature fileset # features/steps/behave_select_files_steps.py:50 > """ > features/alice.feature > features/bob.feature > features/barbi.feature > """ > When behave includes feature files with "features/a.*" # features/steps/behave_select_files_steps.py:62 > And behave excludes no feature files # features/steps/behave_select_files_steps.py:67 > Then the following feature files are selected # features/steps/behave_select_files_steps.py:77 > """ > features/alice.feature > """ > > Scenario: Include more than one feature file # features/runner.select_files_by_regexp.feature:34 > Given behave has the following feature fileset # features/steps/behave_select_files_steps.py:50 > """ > features/alice.feature > features/bob.feature > features/barbi.feature > """ > When behave includes feature files with "features/b.*" # features/steps/behave_select_files_steps.py:62 > Then the following feature files are selected # features/steps/behave_select_files_steps.py:77 > """ > features/bob.feature > features/barbi.feature > """ > > Scenario: Exclude only feature files # features/runner.select_files_by_regexp.feature:43 > Given behave has the following feature fileset # features/steps/behave_select_files_steps.py:50 > """ > features/alice.feature > features/bob.feature > features/barbi.feature > """ > When behave excludes feature files with "features/a.*" # features/steps/behave_select_files_steps.py:72 > And behave includes all feature files # features/steps/behave_select_files_steps.py:57 > Then the following feature files are selected # features/steps/behave_select_files_steps.py:77 > """ > features/bob.feature > features/barbi.feature > """ > > Scenario: Exclude more than one feature file # features/runner.select_files_by_regexp.feature:52 > Given behave has the following feature fileset # features/steps/behave_select_files_steps.py:50 > """ > features/alice.feature > features/bob.feature > features/barbi.feature > """ > When behave excludes feature files with "features/b.*" # features/steps/behave_select_files_steps.py:72 > Then the following feature files are selected # features/steps/behave_select_files_steps.py:77 > """ > features/alice.feature > """ > > Scenario: Include and exclude feature files # features/runner.select_files_by_regexp.feature:59 > Given behave has the following feature fileset # features/steps/behave_select_files_steps.py:50 > """ > features/alice.feature > features/bob.feature > features/barbi.feature > """ > When behave includes feature files with "features/.*a.*\.feature" # features/steps/behave_select_files_steps.py:62 > And behave excludes feature files with ".*/barbi.*" # features/steps/behave_select_files_steps.py:72 > Then the following feature files are selected # features/steps/behave_select_files_steps.py:77 > """ > features/alice.feature > """ > > Scenario: Include and exclude feature files (in 2 steps) # features/runner.select_files_by_regexp.feature:70 > Given behave has the following feature fileset # features/steps/behave_select_files_steps.py:50 > """ > features/alice.feature > features/bob.feature > features/barbi.feature > """ > When behave includes feature files with "features/.*a.*\.feature" # features/steps/behave_select_files_steps.py:62 > Then the following feature files are selected # features/steps/behave_select_files_steps.py:77 > """ > features/alice.feature > features/barbi.feature > """ > When behave excludes feature files with ".*/barbi.*" # features/steps/behave_select_files_steps.py:72 > Then the following feature files are selected # features/steps/behave_select_files_steps.py:77 > """ > features/alice.feature > """ > >@sequential >Feature: Select Scenarios by File Location # features/runner.select_scenarios_by_file_location.feature:2 > To simplify running only one scenario in a feature (or some scenarios) > As a tester > I want to select a scenario by using its file location, > like: "alice.feature:10" (schema: {filename}:{line}) > | CONCEPT: File Location > | * A file location consists of file name and a positive line number > | * A file location is represented as "{filename}:{line}" (or "{filename}") > | * A file location with filename but without line number > | refers to the complete file > | * A file location with line number 0 (zero) refers to the complete file > | > | SPECIFICATION: Scenario selection by file locations > | * scenario.line == file_location.line selects scenario (preferred method). > | * Any line number in the following range is acceptable: > | scenario.line <= file_location.line < next_scenario.line > | * The first scenario is selected, > | if the file location line number is less than first scenario.line. > | * The last scenario is selected, > | if the file location line number is greater than the lines in the file. > | > | SPECIFICATION: Runner with scenario locations (file locations) > | * Adjacent file locations are merged if they refer to the same file, like: > | > | alice.feature:10 > | alice.feature:20 > | > | => MERGED: Selects/runs "alice.feature" with 2 scenarios. > | > | alice.feature > | alice.feature:20 > | > | => MERGED: Selects "alice.feature" with all scenarios. > | > | alice.feature:10 > | bob.feature:20 > | alice.feature:20 > | > | => NOT MERGED: Selects/runs "alice.feature" twice. > | > | * If file locations (scenario locations) are used, > | scenarios with @setup or @teardown tags are selected, too. > | > | REASON: Simplifies to use a Setup Scenario instead of a Background. > | > | * Additional scenario selection mechanisms, like tags, names, > | are applied afterwards. > @setup > Scenario: Feature Setup # features/runner.select_scenarios_by_file_location.feature:55 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > > Scenario: Alice First > When a step passes > > Scenario: Alice Last > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > > @setup > Scenario: Setup Bob > Given a step passes > > Scenario: Bob in Berlin > When a step passes > > Scenario: Bob in Paris > Then a step passes > > @teardown > Scenario: Teardown Bob > Then a step passes > """ > > @file_location.select > Scenario: Select one scenario with its exact file location # features/runner.select_scenarios_by_file_location.feature:96 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:3" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice Last > """ > > @file_location.select > Scenario: Select one scenario with a larger file location # features/runner.select_scenarios_by_file_location.feature:117 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:4" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice Last > """ > > @file_location.select > Scenario: Select next scenario with its exact location # features/runner.select_scenarios_by_file_location.feature:138 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:6" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice Last > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice First > """ > > @file_location.select_first > Scenario: Select first scenario if line number is smaller than first scenario line # features/runner.select_scenarios_by_file_location.feature:159 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:1" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice Last > """ > > @file_location.select_last > Scenario: Select last scenario when line number is too large # features/runner.select_scenarios_by_file_location.feature:180 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:100" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice Last > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice First > """ > > @file_location.select_all > Scenario: Select all scenarios with line number 0 (zero) # features/runner.select_scenarios_by_file_location.feature:202 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:0" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > Scenario: Alice Last > """ > > @file_location.select @with.feature_configfile > Scenario: Select a scenario by using file locations from a features configfile # features/runner.select_scenarios_by_file_location.feature:218 > Given a file named "alice1.txt" with # behave4cmd0/command_steps.py:50 > """ > # -- FEATURES CONFIGFILE: > # Selects Alice First > features/alice.feature:3 > """ > When I run "behave -f plain --dry-run --no-skipped @alice1.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice Last > """ > > @file_location.autoselect_setup_teardown > Scenario: Auto-select scenarios tagged with @setup or @teardown if file location is used # features/runner.select_scenarios_by_file_location.feature:242 > When I run "behave -f plain --dry-run --no-skipped features/bob.feature:7" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 1 skipped, 3 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > Scenario: Setup Bob > Scenario: Bob in Berlin > Scenario: Teardown Bob > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Bob in Paris > """ > > @merge.file_locations > Scenario: Merge 2 adjacent file locations that refer to the same file # features/runner.select_scenarios_by_file_location.feature:262 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:3 features/alice.feature:6" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > Scenario: Alice Last > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > Scenario: Alice First > > Feature: Alice > Scenario: Alice Last > """ > > @merge.file_locations @file_location.select_all > Scenario: Merge filename and adjacent file location that refer to the same file # features/runner.select_scenarios_by_file_location.feature:286 > When I run "behave -f plain --dry-run --no-skipped features/alice.feature:3 features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > Scenario: Alice Last > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > Scenario: Alice First > > Feature: Alice > Scenario: Alice First > Scenario: Alice Last > """ > > @merge.file_locations @with.feature_configfile > Scenario: Merge 2 adjacent file locations to same file from features configfile # features/runner.select_scenarios_by_file_location.feature:311 > Given a file named "alice1_and_alice2.txt" with # behave4cmd0/command_steps.py:50 > """ > # -- FEATURES CONFIGFILE: > # Selects Alice First, Alice Last > features/alice.feature:3 > features/alice.feature:6 > """ > When I run "behave -f plain --dry-run --no-skipped @alice1_and_alice2.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 2 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > Scenario: Alice Last > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > Scenario: Alice First > > Feature: Alice > Scenario: Alice Last > """ > > @no_merge.file_locations @with.feature_configfile > Scenario: No merge occurs if file locations to same file are not adjacent # features/runner.select_scenarios_by_file_location.feature:342 > Given a file named "alice1_bob2_and_alice2.txt" with # behave4cmd0/command_steps.py:50 > """ > # -- FEATURES CONFIGFILE: > # Selects Alice First, Bob in Paris (Setup, Teardown), Alice Last > features/alice.feature:3 > features/bob.feature:10 > features/alice.feature:6 > """ > When I run "behave -f plain --dry-run --no-skipped @alice1_bob2_and_alice2.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 3 untested > 0 scenarios passed, 0 failed, 3 skipped, 5 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice First > > Feature: Bob > Scenario: Setup Bob > Scenario: Bob in Paris > Scenario: Teardown Bob > > Feature: Alice > Scenario: Alice Last > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > Scenario: Alice First > Scenario: Alice Last > """ > >@sequential >Feature: Select named scenarios to run # features/runner.select_scenarios_by_name.feature:2 > As a tester > I want to select a subset of all scenarios > By using their name or parts of the scenario name. > | SPECIFICATION: When --name option is provided > | * Name selection is applied only to scenarios (currently) > | * A scenario is selected when scenario name part matches one of the provided names > | * Regular expressions can be used to match parts > | * If a scenario is not selected, it should be marked as skipped > @setup > Scenario: Test Setup # features/runner.select_scenarios_by_name.feature:16 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: Alice in Wonderland > Given a step passes > > Scenario: Alice in Florida > When a step passes > > Scenario: Alice in Antarctica > Then a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: Bob in Berlin > Given a step passes > > Scenario: Bob in Florida > When a step passes > > Scenario: Alice and Bob > Then a step passes > """ > > Scenario: Select scenarios with name="Alice" and inspect list # features/runner.select_scenarios_by_name.feature:52 > When I run "behave -f plain --name="Alice" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 2 skipped, 4 untested > 0 steps passed, 0 failed, 2 skipped, 0 undefined, 4 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Scenario: Alice in Florida > Scenario: Alice in Antarctica > > Feature: Bob > Scenario: Alice and Bob > """ > > Scenario: Select scenarios with name="Alice" and run them # features/runner.select_scenarios_by_name.feature:71 > When I run "behave -f plain -T --name="Alice" features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 4 scenarios passed, 0 failed, 2 skipped > 4 steps passed, 0 failed, 2 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Given a step passes ... passed > Scenario: Alice in Florida > When a step passes ... passed > Scenario: Alice in Antarctica > Then a step passes ... passed > > Feature: Bob > Scenario: Alice and Bob > Then a step passes ... passed > """ > > Scenario: Select scenarios with name="Bob" # features/runner.select_scenarios_by_name.feature:94 > When I run "behave -f plain --name="Bob" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 1 skipped, 1 untested > 0 scenarios passed, 0 failed, 3 skipped, 3 untested > 0 steps passed, 0 failed, 3 skipped, 0 undefined, 3 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > Scenario: Bob in Berlin > Scenario: Bob in Florida > Scenario: Alice and Bob > """ > > Scenario: Select scenarios with name="Florida" # features/runner.select_scenarios_by_name.feature:110 > When I run "behave -f plain --name="Florida" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 4 skipped, 2 untested > 0 steps passed, 0 failed, 4 skipped, 0 undefined, 2 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Florida > > Feature: Bob > Scenario: Bob in Florida > """ > > Scenario: Select scenarios with name that consists of multiple words # features/runner.select_scenarios_by_name.feature:127 > When I run "behave -f plain --name="Alice and Bob" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 1 skipped, 1 untested > 0 scenarios passed, 0 failed, 5 skipped, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > Scenario: Alice and Bob > """ > > Scenario: Select scenarios by using two names # features/runner.select_scenarios_by_name.feature:140 > When I run "behave -f plain --name="Alice" --name="Florida" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 1 skipped, 5 untested > 0 steps passed, 0 failed, 1 skipped, 0 undefined, 5 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Scenario: Alice in Florida > Scenario: Alice in Antarctica > > Feature: Bob > Scenario: Bob in Florida > Scenario: Alice and Bob > """ > > Scenario: Select scenarios by using a regular expression # features/runner.select_scenarios_by_name.feature:160 > When I run "behave -f plain --name="Alice in .*" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 1 skipped, 1 untested > 0 scenarios passed, 0 failed, 3 skipped, 3 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Scenario: Alice in Florida > Scenario: Alice in Antarctica > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Bob in > """ > > Scenario: Select scenarios by using another regular expression # features/runner.select_scenarios_by_name.feature:179 > When I run "behave -f plain --name=".* in .*" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 1 skipped, 5 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Scenario: Alice in Florida > Scenario: Alice in Antarctica > > Feature: Bob > Scenario: Bob in Berlin > Scenario: Bob in Florida > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice and Bob > """ > > Scenario: Select scenarios by using two regular expressions # features/runner.select_scenarios_by_name.feature:202 > When I run "behave -f plain --name="Alice in .*" --name="Bob in .*" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 1 skipped, 5 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Scenario: Alice in Florida > Scenario: Alice in Antarctica > > Feature: Bob > Scenario: Bob in Berlin > Scenario: Bob in Florida > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: Alice and Bob > """ > > Scenario: Select scenarios by using an unknown/unused name # features/runner.select_scenarios_by_name.feature:225 > When I run "behave -f plain --name="UNKNOWN" --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 2 skipped > 0 scenarios passed, 0 failed, 6 skipped > """ > >@sequential >Feature: Select scenarios by using tags # features/runner.select_scenarios_by_tag.feature:2 > As a tester > I want to select a subset of all scenarios by using tags > (for selecting/including them or excluding them) > So that I run only a subset of scenarios. > | RELATED: > | * runner.tag_logic.feature > @setup > Scenario: Feature Setup # features/runner.select_scenarios_by_tag.feature:14 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > default_format = plain > show_skipped = false > show_timings = false > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > @foo > Scenario: Alice in Wonderland > Given a step passes > > @foo @bar > Scenario: Alice in Florida > When hotter step passes > > @bar > Scenario: Alice in Antarctica > Then colder step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > @bar > Scenario: Bob in Berlin > Given beautiful step passes > > @foo > Scenario: Bob in Florida > When freaky step passes > > Scenario: Alice and Bob > Then another step passes > """ > > Scenario: Select scenarios with tag=@foo (inclusive) # features/runner.select_scenarios_by_tag.feature:62 > When I run "behave -f plain --tags=foo --no-skipped --no-timings features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 3 skipped > 3 steps passed, 0 failed, 3 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Given a step passes ... passed > > Scenario: Alice in Florida > When hotter step passes ... passed > > Feature: Bob > Scenario: Bob in Florida > When freaky step passes ... passed > """ > > Scenario: Select scenarios without tag=@foo (exclusive) # features/runner.select_scenarios_by_tag.feature:87 > When I run "behave --tags=~@foo features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 3 skipped > 3 steps passed, 0 failed, 3 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Antarctica > Then colder step passes ... passed > > Feature: Bob > Scenario: Bob in Berlin > Given beautiful step passes ... passed > > Scenario: Alice and Bob > Then another step passes ... passed > """ > > Scenario: Select scenarios with @foo and @bar tags (both) # features/runner.select_scenarios_by_tag.feature:115 > When I run "behave --tags=@foo --tags=@bar features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 1 skipped > 1 scenario passed, 0 failed, 5 skipped > 1 step passed, 0 failed, 5 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Florida > When hotter step passes > """ > And note that "only scenario 'Alice in Florida' has both tags" # behave4cmd0/note_steps.py:15 > > Scenario: Select scenarios without @foo tag and without @bar tag # features/runner.select_scenarios_by_tag.feature:135 > When I run "behave --tags=-@foo --tags=-@bar features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 1 skipped > 1 scenario passed, 0 failed, 5 skipped > 1 step passed, 0 failed, 5 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > Scenario: Alice and Bob > Then another step passes > """ > And note that "only scenario 'Alice and Bob' has neither tag" # behave4cmd0/note_steps.py:15 > > Scenario: Select scenarios with @foo tag, but exclude with @bar tag # features/runner.select_scenarios_by_tag.feature:155 > When I run "behave --tags=@foo --tags=-@bar features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 4 skipped > 2 steps passed, 0 failed, 4 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Given a step passes ... passed > > Feature: Bob > Scenario: Bob in Florida > When freaky step passes ... passed > """ > But note that "'Alice in Florida' is excluded because it has also @bar" # behave4cmd0/note_steps.py:15 > > Scenario: Select scenarios with @bar tag, but exclude with @foo tag # features/runner.select_scenarios_by_tag.feature:179 > When I run "behave --tags=-@foo --tags=@bar features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 4 skipped > 2 steps passed, 0 failed, 4 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Antarctica > Then colder step passes ... passed > > Feature: Bob > Scenario: Bob in Berlin > Given beautiful step passes ... passed > """ > But note that "'Alice in Florida' is excluded because it has also @bar" # behave4cmd0/note_steps.py:15 > > Scenario: Select scenarios with tag=@foo in dry-run mode (inclusive) # features/runner.select_scenarios_by_tag.feature:203 > When I run "behave --tags=@foo --dry-run features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 features passed, 0 failed, 0 skipped, 2 untested > 0 scenarios passed, 0 failed, 3 skipped, 3 untested > 0 steps passed, 0 failed, 3 skipped, 0 undefined, 3 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: Alice in Wonderland > Scenario: Alice in Florida > > Feature: Bob > Scenario: Bob in Florida > """ > >@sequential >Feature: Runner should stop after first failure if --stop option is used # features/runner.stop_after_failure.feature:2 > As a tester > To abort testing early (sometimes) > When the first failure occurs. > @setup > Scenario: Test Setup # features/runner.stop_after_failure.feature:10 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL" > """ > And a file named "features/alice_fails.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > When a step passes > Then a step passes > > Scenario: A2 fails > Given a step passes > When a step fails > Then a step passes > > Scenario: A3 > Given a step passes > > Scenario: A4 fails > Given a step fails > """ > And a file named "features/bob_passes.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > Given a step passes > When a step passes > Then a step passes > > Scenario: B2 fails > Given a step passes > When a step passes > Then a step passes > """ > > Scenario: Stop running after first failure with one feature # features/runner.stop_after_failure.feature:59 > When I run "behave -f plain -T --stop features/alice_fails.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failing scenarios: > features/alice_fails.feature:7 A2 fails > > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped, 2 untested > 4 steps passed, 1 failed, 1 skipped, 0 undefined, 2 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: A1 > Given a step passes ... passed > When a step passes ... passed > Then a step passes ... passed > > Scenario: A2 fails > Given a step passes ... passed > When a step fails ... failed > Assertion Failed: XFAIL > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Scenario: A3 > """ > > Scenario: Stop running after first failure with several features (CASE 1) # features/runner.stop_after_failure.feature:88 > When I run "behave -f plain -T --stop features/alice_fails.feature features/bob_passes.feature " # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failing scenarios: > features/alice_fails.feature:7 A2 fails > > 0 features passed, 1 failed, 0 skipped, 1 untested > 1 scenario passed, 1 failed, 0 skipped, 4 untested > 4 steps passed, 1 failed, 1 skipped, 0 undefined, 8 untested > """ > > Scenario: Stop running after first failure with several features (CASE 2: Different order) # features/runner.stop_after_failure.feature:100 > When I run "behave -f plain -T --stop features/bob_passes.feature features/alice_fails.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failing scenarios: > features/alice_fails.feature:7 A2 fails > > 1 feature passed, 1 failed, 0 skipped > 3 scenarios passed, 1 failed, 0 skipped, 2 untested > 10 steps passed, 1 failed, 1 skipped, 0 undefined, 2 untested > """ > > Scenario: Stop running after first failure with several features (CASE 3: Use directory) # features/runner.stop_after_failure.feature:112 > When I run "behave -f plain -T --stop features/" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Failing scenarios: > features/alice_fails.feature:7 A2 fails > > 0 features passed, 1 failed, 0 skipped, 1 untested > 1 scenario passed, 1 failed, 0 skipped, 4 untested > 4 steps passed, 1 failed, 1 skipped, 0 undefined, 8 untested > """ > >Feature: Runner Tag logic # features/runner.tag_logic.feature:1 > As a tester > I want to select scenarios using logical AND/OR of tags > In order to conveniently run subsets of these scenarios > | SPECIFICATION: Tag logic > | See "tag_expression.feature" description. > | > | RELATED: > | * tag_expression.feature > Scenario: Select scenarios with 1 tag (@foo) # features/runner.tag_logic.feature:13 > Given a behave model with # features/steps/behave_model_tag_logic_steps.py:55 > | statement | name | tags | Comment | > | Scenario | S0 | | Untagged | > | Scenario | S1 | @foo | With 1 tag | > | Scenario | S2 | @other | | > | Scenario | S3 | @foo @other | With 2 tags | > And note that "are all combinations of 0..2 tags" # behave4cmd0/note_steps.py:15 > When I run the behave model with "tags" # features/steps/behave_model_tag_logic_steps.py:75 > Then the following scenarios are selected with cmdline # features/steps/behave_model_tag_logic_steps.py:80 > | cmdline | selected? | Logic comment | > | | S0, S1, S2, S3 | ALL, no selector | > | --tags=@foo | S1, S3 | @foo | > | --tags=-@foo | S0, S2 | not @foo | > > Scenario: Use other tag expression variants # features/runner.tag_logic.feature:29 > Given a behave model with # features/steps/behave_model_tag_logic_steps.py:55 > | statement | name | tags | Comment | > | Scenario | S0 | | Untagged | > | Scenario | S1 | @foo | With 1 tag | > | Scenario | S2 | @other | | > | Scenario | S3 | @foo @other | With 2 tags | > Then the following scenarios are selected with cmdline # features/steps/behave_model_tag_logic_steps.py:80 > | cmdline | selected? | Logic comment | > | --tags=foo | S1, S3 | @foo, without optional @ | > | --tags=-foo | S0, S2 | not @foo, without optional @ | > | --tags=~foo | S0, S2 | not @foo, with tilde as minus | > | --tags=~@foo | S0, S2 | not @foo, with tilde and @ | > And note that "these tag expression variants can also be used" # behave4cmd0/note_steps.py:15 > > Scenario: Select scenarios with 2 tags (@foo, @bar) # features/runner.tag_logic.feature:45 > Given a behave model with # features/steps/behave_model_tag_logic_steps.py:55 > | statement | name | tags | Comment | > | Scenario | S0 | | Untagged | > | Scenario | S1 | @foo | With a tag | > | Scenario | S2 | @bar | | > | Scenario | S3 | @other | | > | Scenario | S4 | @foo @bar | With 2 tags | > | Scenario | S5 | @foo @other | | > | Scenario | S6 | @bar @other | | > | Scenario | S7 | @foo @bar @other | With 3 tags | > And note that "are all combinations of 0..3 tags" # behave4cmd0/note_steps.py:15 > When I run the behave model with "tags" # features/steps/behave_model_tag_logic_steps.py:75 > Then the following scenarios are selected with cmdline # features/steps/behave_model_tag_logic_steps.py:80 > | cmdline | selected? | Logic comment | > | | S0, S1, S2, S3, S4, S5, S6, S7 | ALL, no selector | > | --tags=@foo,@bar | S1, S2, S4, S5, S6, S7 | @foo or @bar | > | --tags=@foo,-@bar | S0, S1, S3, S4, S5, S7 | @foo or not @bar | > | --tags=-@foo,-@bar | S0, S1, S2, S3, S5, S6 | not @foo or not @bar | > | --tags=@foo --tags=@bar | S4, S7 | @foo and @bar | > | --tags=@foo --tags=-@bar | S1, S5 | @foo and not @bar | > | --tags=-@foo --tags=-@bar | S0, S3 | not @foo and not @bar | > >Feature: When an unknown formatter is used # features/runner.unknown_formatter.feature:1 > > Scenario: Unknown formatter is used # features/runner.unknown_formatter.feature:4 > When I run "behave -f unknown1" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > behave: error: format=unknown1 is unknown > """ > > Scenario: Unknown formatter is used together with another formatter # features/runner.unknown_formatter.feature:11 > When I run "behave -f plain -f unknown1" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > behave: error: format=unknown1 is unknown > """ > > Scenario: Two unknown formatters are used # features/runner.unknown_formatter.feature:18 > When I run "behave -f plain -f unknown1 -f tags -f unknown2" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > behave: error: format=unknown1, unknown2 is unknown > """ > >Feature: Use Alternate Step Implementations for Each Test Stage # features/runner.use_stage_implementations.feature:1 > As I tester and test writer > I want to run the same feature with other step implementations during different testing stages > So I can run quick checks in a development environment and detailed checks in a testlab. > | CONCEPT: TEST STAGE > | A test stage allows you to use different step/environment implementations > | compared to other test stage or the default, unnamed test stage. > | > | Examples for test stages are: > | * develop (using the development environment with more diagnostics) > | * product (using the product database, ...) > | * systemtest > | * systemint (system integration) > | * ... > | > | NOTE: > | Test stages can be used to adapt to different test environments > | while using these test stages. > | > | > | EXAMPLE DIRECTORY LAYOUT (with default stage and stage=testlab): > | > | features/ > | +-- steps/ # -- Step implementations for default stage. > | | +-- foo_steps.py > | +-- testlab_steps/ # -- Step implementations for stage=testlab. > | | +-- foo_steps.py > | +-- *.feature > | +-- environment.py # -- Environment for default stage. > | +-- testlab_environment.py # -- Environment for stage=testlab. > @setup > Scenario: Feature Setup # features/runner.use_stage_implementations.feature:35 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/example1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I do something in a test stage > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.use_develop_environment = False > """ > And a file named "features/steps/foo_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('I do something in a test stage') > def step_do_something(context): > assert not context.config.stage > assert not context.use_develop_environment > """ > And I remove the environment variable "BEHAVE_STAGE" # behave4cmd0/command_steps.py:421 > > Scenario: Use stage=develop # features/runner.use_stage_implementations.feature:59 > Given a file named "features/develop_environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.use_develop_environment = True > """ > And a file named "features/develop_steps/foo_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('I do something in a test stage') > def step_do_something(context): > assert context.config.stage == "develop" > assert context.use_develop_environment > """ > When I run "behave -c --stage=develop features/example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: # features/example1.feature:2 > Given I do something in a test stage # features/develop_steps/foo_steps.py:3 > """ > > Scenario: Use default stage # features/runner.use_stage_implementations.feature:87 > Given I remove the environment variable "BEHAVE_STAGE" # behave4cmd0/command_steps.py:421 > When I run "behave -c features/example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: # features/example1.feature:2 > Given I do something in a test stage # features/steps/foo_steps.py:3 > """ > > Scenario: Use the BEHAVE_STAGE environment variable to define the test stage # features/runner.use_stage_implementations.feature:102 > Given I set the environment variable "BEHAVE_STAGE" to "develop" # behave4cmd0/command_steps.py:414 > When I run "behave -c features/example1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: # features/example1.feature:2 > Given I do something in a test stage # features/develop_steps/foo_steps.py:3 > """ > But note that "I should better remove it again (TEARDOWN PHASE)" # behave4cmd0/note_steps.py:15 > And I remove the environment variable "BEHAVE_STAGE" # behave4cmd0/command_steps.py:421 > > Scenario: Using an unknown stage # features/runner.use_stage_implementations.feature:120 > When I run "behave -c --stage=unknown features/example1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > ConfigError: No unknown_steps directory > """ > >Feature: Scenario Description # features/scenario.description.feature:1 > As a tester > I want to explain the rationale of a test scenario or scenario outline > Before I actually execute the steps. > | SPECIFICATION: Scenario Description > | * Scenario descriptions are in optional section between > | Scenario line and the first step. > | * All description lines are added to the scenario description. > | * Empty lines are not part of the scenario description (are removed). > | * Comment lines are not part of the scenario description (are removed). > | * A Scenario/ScenarioOutline with a scenario description, > | but without steps is valid (to support preparation of scenarios). > | > | SPECIFICATION: A scenario description line... > | * must not start with step keywords, like: > | > | Given, When, Then, And, But, etc. > | (including lower-case versions) > | > | * must not start with '*' (ASTERISK) due to generic step keyword ambiguity > | * must not start with '@' (AT) due to tag ambiguity > | (supporting: scenario without steps but with step description). > | * may start with '|' (table-cell-separator). > | * does not contain only whitespace chars (empty line, filtered-out). > | * does not start with '#' (HASH) after whitespace chars (comment line). > | > | GRAMMAR STRUCTURE: > | Scenario-Line : 1 > | Scenario-Description-Line : 0 .. N > | Step-Line : 0 .. N > | > | Scenario-Line := Scenario-Keyword ':' Scenario-Name > | Scenario-Description-Line := Line does not start with Step-Keyword > | Step-Line := Step-Keyword Words+ > @setup > Scenario: Feature Setup # features/scenario.description.feature:40 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step('a step passes') > def step_passes(context): > pass > > @step('a step passes with "{comment}"') > def step_passes(context, comment): > sys.stdout.write("PASSING-STEP: %s;\n" % comment) > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL-STEP" > """ > > Scenario: First Example for a Scenario Description # features/scenario.description.feature:61 > Given a file named "features/example_description1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: E1 > > This is a simple scenario description before the steps start. > It explains why this scenario is important. > > Here another scenario description line after an empty line. > > Given a step passes with "Alice" > When a step passes with "Bob" > Then a step passes with "Charly" > """ > When I run "behave -f plain -T features/example_description1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: E1 > Given a step passes with "Alice" ... passed > When a step passes with "Bob" ... passed > Then a step passes with "Charly" ... passed > """ > > Scenario: Inspect the Scenario Description by using JSON # features/scenario.description.feature:93 > Given a file named "features/example_description1.feature" exists # behave4cmd0/command_steps.py:336 > When I run "behave -f json.pretty -o example1.json -f plain -T features/example_description1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the file "example1.json" should contain # behave4cmd0/command_steps.py:399 > """ > "description": [ > "This is a simple scenario description before the steps start.", > "It explains why this scenario is important.", > "Here another scenario description line after an empty line." > ], > "keyword": "Scenario", > "location": "features/example_description1.feature:2", > "name": "E1", > """ > > Scenario: Second Example with 2 scenario with scenario descriptions # features/scenario.description.feature:110 > Given a file named "features/example_description2.feature" with # behave4cmd0/command_steps.py:50 > """ > @one > Feature: F2 > > Feature description line 1. > Feature description line 2. > > @foo > Scenario: S2.1 > > Scenario description line S2.1-1. > Scenario description line S2.1-2 (indentation is removed). > > Given a step passes with "Alice" > Then a step passes with "Charly" > > @foo > @bar @baz > Scenario: S2.2 > > Scenario description line S2.2-1. > > When a step passes with "Bob" > """ > When I run "behave -f json.pretty -o example2.json -f plain -T features/example_description2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: F2 > Scenario: S2.1 > Given a step passes with "Alice" ... passed > Then a step passes with "Charly" ... passed > > Scenario: S2.2 > When a step passes with "Bob" ... passed > """ > And the file "example2.json" should contain # behave4cmd0/command_steps.py:399 > """ > "description": [ > "Scenario description line S2.1-1.", > "Scenario description line S2.1-2 (indentation is removed)." > ], > "keyword": "Scenario", > "location": "features/example_description2.feature:8", > "name": "S2.1", > """ > And the file "example2.json" should contain # behave4cmd0/command_steps.py:399 > """ > "description": [ > "Scenario description line S2.2-1." > ], > "keyword": "Scenario", > "location": "features/example_description2.feature:18", > "name": "S2.2", > """ > >Feature: Exclude Scenario from Test Run # features/scenario.exclude_from_run.feature:1 > As a test writer > I want sometimes to decide at runtime > that a scenario is excluded from a test run > So that the command-line configuration becomes simpler > (and auto-configuration is supported). > | MECHANISM: > | The "before_scenario()" hook can decide just before a scenario should run > | that the scenario should be excluded from the test-run. > | NOTE: Hooks are not called in dry-run mode. > | > | RATIONALE: > | There are certain situations where it is better to skip a scenario > | than to run and fail the scenario. > | > | Reasons for these cases are of often test environment related: > | * test environment does not fulfill the desired criteria > | * used testbed does not fulfill test requirements > | > | Instead of providing the exclude-scenario selection on the command-line, > | the test (environment) and configuration logic should determine > | if a test should be excluded (as auto-configuration functionality). > | > | EXAMPLE: > | Certain scenarios should not run on Windows (or Linux, ...). > | > | EVALUATION ORDER: > | Before the user can exclude a scenario from a test-run, > | additional mechanisms decide, if the scenario is part of the selected run-set. > | These are: > | * tags > | * ... > | > | RELATED: > | * features/feature.exclude_from_run.feature > @setup > Scenario: # features/scenario.exclude_from_run.feature:41 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > Scenario: Alice > Given a step passes > When another step passes > Then some step passes > > Scenario: Bob and Alice > Given some step passes > > Scenario: Bob > Given another step passes > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL-STEP" > """ > > @use_hook.before_scenario > Scenario: Exclude a scenario from the test run (using: before_scenario() hook) # features/scenario.exclude_from_run.feature:72 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > import sys > > def should_exclude_scenario(context, scenario): > if scenario.name.startswith("Alice"): > return True > return False > > def before_scenario(context, scenario): > if should_exclude_scenario(context, scenario): > sys.stdout.write("EXCLUDED-BY-USER: Scenario %s\n" % scenario.name) > scenario.skip() > """ > When I run "behave -f plain -T features/example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 3 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > EXCLUDED-BY-USER: Scenario Alice > """ > > @use_hook.before_feature > Scenario: Exclude a scenario from the test run (using: before_feature() hook) # features/scenario.exclude_from_run.feature:100 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > import sys > > def should_exclude_scenario(scenario): > if "Alice" in scenario.name: # MATCHES: Alice, Bob and Alice > return True > return False > > def before_feature(context, feature): > # -- NOTE: walk_scenarios() flattens ScenarioOutline.scenarios > for scenario in feature.walk_scenarios(): > if should_exclude_scenario(scenario): > sys.stdout.write("EXCLUDED-BEFORE-FEATURE: Scenario %s\n" % scenario.name) > scenario.skip() > """ > When I run "behave -f plain -T features/example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 2 skipped > 1 step passed, 0 failed, 4 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > EXCLUDED-BEFORE-FEATURE: Scenario Alice > EXCLUDED-BEFORE-FEATURE: Scenario Bob and Alice > """ > > Scenario: Skip scenario in a step # features/scenario.exclude_from_run.feature:130 > Given a file named "features/skip_scenario.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > Scenario: Alice2 > Given a step passes > And the assumption "location:Wonderland" is not met > When another step passes > Then some step passes > > Scenario: Bob and Alice2 > Given some step passes > When I skip the remaining scenario > Then another step passes > """ > And a file named "features/steps/skip_scenario_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, step > > @given('the assumption "{name}" is not met') > def step_assumption_not_met(context, name): > context.scenario.skip("Assumption %s not met" % name) > > @step('I skip the remaining scenario') > def step_skip_scenario(context): > context.scenario.skip() > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > # -- OVERRIDE WITH EMPTY-ENVIRONMENT. > """ > When I run "behave -f plain -T features/skip_scenario.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 0 scenarios passed, 0 failed, 2 skipped > 2 steps passed, 0 failed, 5 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Alice2 > Given a step passes ... passed > And the assumption "location:Wonderland" is not met ... skipped > > Scenario: Bob and Alice2 > Given some step passes ... passed > When I skip the remaining scenario ... skipped > """ > But note that "the step that skipped the scenario is also marked as skipped" # behave4cmd0/note_steps.py:15 > > Scenario: Skip scenario in after_scenario hook # features/scenario.exclude_from_run.feature:187 > Given a file named "features/pass_and_fail.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > Scenario: Passing > Given a step passes > > Scenario: Failing > Given some step passes > When a step fails > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_all(context): > context.config.setup_logging() > > def after_scenario(context, scenario): > scenario.skip("AFTER-SCENARIO") > """ > When I run "behave -f plain -T features/pass_and_fail.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 2 steps passed, 1 failed, 0 skipped, 0 undefined > """ > But note that "the scenarios are not marked as skipped (SKIP-TOO-LATE)" # behave4cmd0/note_steps.py:15 > >@issue >Feature: Issue #187 ScenarioOutline uses wrong return value when if fails # features/scenario_outline.basics.feature:2 > Ensure that ScenarioOutline run-logic behaves as expected. > @setup > Scenario: Feature Setup # features/scenario_outline.basics.feature:7 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL-STEP" > """ > > Scenario: All examples pass # features/scenario_outline.basics.feature:22 > Given a file named "features/example.scenario_outline_pass.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: All Examples pass > Scenario Outline: > Given a step <outcome> > > Examples: > | outcome | Comment | > | passes | First example passes | > | passes | Last example passes | > """ > When I run "behave -f plain features/example.scenario_outline_pass.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > > @scenario_outline.fails > Scenario: First example fails # features/scenario_outline.basics.feature:42 > Given a file named "features/example.scenario_outline_fail_first.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: First Example in Scenario Outline fails > Scenario Outline: > Given a step <outcome> > > Examples: > | outcome | Comment | > | fails | First example fails | > | passes | Last example passes | > """ > When I run "behave -f plain features/example.scenario_outline_fail_first.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped > """ > > @scenario_outline.fails > Scenario: Last example fails # features/scenario_outline.basics.feature:62 > Given a file named "features/example.scenario_outline_fail_last.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Last Example in Scenario Outline fails > Scenario Outline: > Given a step <outcome> > > Examples: > | outcome | Comment | > | passes | First example passes | > | fails | Last example fails | > """ > When I run "behave -f plain features/example.scenario_outline_fail_last.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped > """ > > @scenario_outline.fails > Scenario: Middle example fails # features/scenario_outline.basics.feature:82 > Given a file named "features/example.scenario_outline_fail_middle.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Middle Example in Scenario Outline fails > Scenario Outline: > Given a step <outcome> > > Examples: > | outcome | Comment | > | passes | First example passes | > | fails | Middle example fails | > | passes | Last example passes | > """ > When I run "behave -f plain features/example.scenario_outline_fail_middle.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 2 scenarios passed, 1 failed, 0 skipped > """ > >Feature: Scenario Outline -- Improvements # features/scenario_outline.improved.feature:1 > As a behave user / test writer > I want that Scenario Outline (as paramtrized Scenario) is improved > So that I know better which example/row combination is run. > | REQUIREMENTS: > | * Generated scenario name should better indicate row/example combination. > | * Naming schema for generated scenario names should be configurable. > | * File location of generated scenario should represent row/example. > | * It should be possible select all scenarios of an examples group. > | > | IMPROVEMENTS: > | * annotate Scenario Outline name (with row.id, examples.name, ...) > | * use placeholders (from row/example) in Scenario Outline tags. > | * use placeholders (from row/example) in Scenario Outline name. > | * use placeholders (from row/example) in Examples (group) name. > | * file location for generated scenario is unique (selectable in rerun) > | > | SPECIFICATION: Special placeholders > | > | | Placeholder | Description | > | | name | Name of the Scenario Outline. | > | | examples.name | Name of the examples group (or empty string). | > | | examples.index | Index of examples group (range: 1..N). | > | | row.index | Index of row in examples group (range: 1..R). | > | | row.id | Same as: "{example.index}.{row.index}" | > | > | RELATED: > | * scenario_outline.name_annotation.feature > | * scenario_outline.parametrized.feature > @setup > Scenario: Test Setup # features/scenario_outline.improved.feature:34 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} -- @{row.id} {examples.name} > show_timings = false > show_skipped = false > """ > And a file named "features/named_examples.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Named Examples > Given a param <param1> > > Examples: Alice > | param1 | > | 10 | > | 42 | > > Examples: Bob > | param1 | > | 43 | > """ > And a file named "features/unnamed_examples.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Unnamed Examples > Given a param <param1> > > Examples: > | param1 | > | 100 | > | 101 | > """ > And a file named "features/steps/param_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a param {value:w}') > def step_impl_with_param(context, value): > context.param = value > > @step('a param {name}={value}') > def step_impl_with_param_value(context, name, value): > context.param_name = name > context.param_value = value > """ > > Scenario: Unique File Locations in generated scenarios # features/scenario_outline.improved.feature:83 > When I run "behave -f pretty -c features/named_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Named Examples -- @1.1 Alice # features/named_examples.feature:7 > Given a param 10 # features/steps/param_steps.py:3 > > Scenario Outline: Named Examples -- @1.2 Alice # features/named_examples.feature:8 > Given a param 42 # features/steps/param_steps.py:3 > > Scenario Outline: Named Examples -- @2.1 Bob # features/named_examples.feature:12 > Given a param 43 # features/steps/param_steps.py:3 > """ > But note that "each generated scenario has unique file location (related to row.line)" # behave4cmd0/note_steps.py:15 > > Scenario: Select generated scenario by unique File Location # features/scenario_outline.improved.feature:99 > When I run "behave -f plain features/named_examples.feature:8" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 2 skipped > 1 step passed, 0 failed, 2 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario Outline: Named Examples -- @1.2 Alice > Given a param 42 ... passed > """ > > @select.examples.by_name > Scenario: Select Examples (Group) by Name (Case: name part) # features/scenario_outline.improved.feature:132 > When I run "behave --name=Alice -f plain features/named_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario Outline: Named Examples -- @1.1 Alice > Given a param 10 ... passed > > Scenario Outline: Named Examples -- @1.2 Alice > Given a param 42 ... passed > """ > > @select.examples.by_name > Scenario: Select Examples (Group) by Name (Case: regular expression) # features/scenario_outline.improved.feature:149 > When I run "behave --name='-- @.* Alice' -f plain features/named_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario Outline: Named Examples -- @1.1 Alice > Given a param 10 ... passed > > Scenario Outline: Named Examples -- @1.2 Alice > Given a param 42 ... passed > """ > > @select.examples.by_name > Scenario: Select one Example by Name # features/scenario_outline.improved.feature:166 > When I run "behave --name='-- @1.2 Alice' -f plain features/named_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 2 skipped > 1 step passed, 0 failed, 2 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario Outline: Named Examples -- @1.2 Alice > Given a param 42 ... passed > """ > >Feature: Scenario Outline -- Scenario Name Annotations # features/scenario_outline.name_annotation.feature:1 > As a behave user / test writer > I want to know in the current example/row combination > So that I know the context of success/failure within a test run (without details). > | REQUIREMENTS: > | * generated scenario name should better indicate row/example combination. > | * name annotation schema for generated scenario names should be configurable. > | > | IMPROVEMENTS: > | * annotate Scenario Outline name (with row.id, examples.name, ...) > | > | > | SCENARIO OUTLINE NAME ANNOTATION SCHEMA: > | > | scenario_outline_annotation_schema = "{name} -- @{row.id} {examples.name}" > | > | | Placeholder | Description | > | | name | Name of the Scenario Outline. | > | | examples.name | Name of the examples group (or empty string). | > | | examples.index | Index of examples group (range: 1..N). | > | | row.index | Index of row in examples group (range: 1..R). | > | | row.id | Same as: "{example.index}.{row.index}" | > @setup > Scenario: Test Setup # features/scenario_outline.name_annotation.feature:28 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/named_examples.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Named Examples > Given a param <param1> > > Examples: Alice > | param1 | > | 10 | > | 42 | > > Examples: Bob > | param1 | > | 43 | > """ > And a file named "features/unnamed_examples.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Unnamed Examples > Given a param <param1> > > Examples: > | param1 | > | 100 | > | 101 | > """ > And a file named "features/steps/param_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a param {value:w}') > def step_impl_with_param(context, value): > context.param = value > > @step('a param {name}={value}') > def step_impl_with_param_value(context, name, value): > context.param_name = name > context.param_value = value > > """ > > Scenario: Use default annotation schema for generated scenarios (name annotations) # features/scenario_outline.name_annotation.feature:71 > Given a file named "behave.ini" does not exist # behave4cmd0/command_steps.py:348 > When I run "behave -f plain --no-timings features/named_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Named Examples -- @1.1 Alice > Given a param 10 ... passed > > Scenario Outline: Named Examples -- @1.2 Alice > Given a param 42 ... passed > > Scenario Outline: Named Examples -- @2.1 Bob > Given a param 43 ... passed > """ > And note that "the default annotation schema is: {name} -- @{row.id} {examples.name}" # behave4cmd0/note_steps.py:15 > When I run "behave -f plain --no-timings features/unnamed_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Unnamed Examples -- @1.1 > Given a param 100 ... passed > > Scenario Outline: Unnamed Examples -- @1.2 > Given a param 101 ... passed > """ > But note that "each generated scenario name has a unique <row.id> annotation" # behave4cmd0/note_steps.py:15 > And note that "each generated scenario name contains has its <examples.name> as annotation" # behave4cmd0/note_steps.py:15 > > Scenario: Use own annotation schema for generated scenarios (name annotations) # features/scenario_outline.name_annotation.feature:102 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} -*- {examples.name} @{row.id} > """ > When I run "behave -f plain --no-timings features/named_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Named Examples -*- Alice @1.1 > Given a param 10 ... passed > > Scenario Outline: Named Examples -*- Alice @1.2 > Given a param 42 ... passed > > Scenario Outline: Named Examples -*- Bob @2.1 > Given a param 43 ... passed > """ > When I run "behave -f plain --no-timings features/unnamed_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Unnamed Examples -*- @1.1 > Given a param 100 ... passed > > Scenario Outline: Unnamed Examples -*- @1.2 > Given a param 101 ... passed > """ > > Scenario: Disable name annotations (use: old naming scheme) # features/scenario_outline.name_annotation.feature:131 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} > """ > When I run "behave -f plain --no-timings features/named_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Named Examples > Given a param 10 ... passed > > Scenario Outline: Named Examples > Given a param 42 ... passed > > Scenario Outline: Named Examples > Given a param 43 ... passed > """ > When I run "behave -f plain --no-timings features/unnamed_examples.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Unnamed Examples > Given a param 100 ... passed > > Scenario Outline: Unnamed Examples > Given a param 101 ... passed > """ > >Feature: Scenario Outline -- Parametrized Scenarios # features/scenario_outline.parametrized.feature:1 > As a test writer > I want to use the DRY principle when writing scenarios > So that I am more productive and my work is less error-prone. > | COMMENT: > | A Scenario Outline is basically a parametrized Scenario template. > | It is instantiated for each examples row with the corresponding data. > | > | SCENARIO GENERICS BASICS: What can be parametrized? > | * Scenario name: Based on Scenario Outline with placeholders > | * Scenario steps: Step name with placeholders (including: step.text, step.table) > | * Scenario tags: Based on Scenario Outline tags with placeholders > | > | CONSTRAINTS: > | * placeholders (names) for tags should not contain any whitespace. > | * a row data placeholder may override/hide a special placeholder (see below). > | > | SPECIAL PLACEHOLDERS: > | | Placeholder | Description | > | | examples.name | Name of the examples group (or empty string). | > | | examples.index | Index of examples group (range: 1..N). | > | | row.index | Index of row in examples group (range: 1..R). | > | | row.id | Same as: "{example.index}.{row.index}" | > @setup > Scenario: Test Setup # features/scenario_outline.parametrized.feature:30 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} -*- {examples.name} > """ > And a file named "features/steps/param_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a param {value:w}') > def step_with_param(context, value): > context.param = value > > @step('a param {name}={value}') > def step_with_param_value(context, name, value): > context.param_name = name > context.param_value = value > > @step('a step with text') > def step_with_param_value(context): > assert context.text is not None, "REQUIRE: text" > > @step('a step with table') > def step_with_param_value(context): > assert context.table is not None, "REQUIRE: table" > > @step('an unknown param {name}={value}') > def step_with_unknown_param_value(context, name, value): > pass > """ > > @parametrize.name > Scenario: Parametrized name in generated Scenarios (Case: Row Placeholders) # features/scenario_outline.parametrized.feature:64 > Given a file named "features/use_name_with_row_params.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: SOP1 > Scenario Outline: Use placeholder <name>-<param1> > Given a param param1=<param1> > And a param name=<name> > > Examples: E-<ID> > | ID | name | param1 | > | 001 | Alice | 100 | > | 002 | Bob | 101 | > """ > When I run "behave -f progress3 features/use_name_with_row_params.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Use placeholder Alice-100 -*- E-001 .. > Use placeholder Bob-101 -*- E-002 .. > """ > > @parametrize.name > Scenario: Parametrized name in generated Scenarios (Case: Special Placeholders) # features/scenario_outline.parametrized.feature:85 > Given a file named "features/use_name_with_special_params.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: SOP2 > Scenario Outline: Use placeholder S<examples.index>-<row.index> <examples.name> > Given a param name=<name> > And a param row.id=<row.id> > > Examples: E-<ID>/@<row.id> > | ID | name | param1 | > | 001 | Alice | 100 | > | 002 | Bob | 101 | > """ > When I run "behave -f progress3 features/use_name_with_special_params.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Use placeholder S1-1 E-001/@1.1 -*- E-001/@1.1 .. > Use placeholder S1-2 E-002/@1.2 -*- E-002/@1.2 .. > """ > > @parametrize.steps > Scenario: Use placeholders in generated scenario steps # features/scenario_outline.parametrized.feature:106 > Given a file named "features/use_steps_with_params.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Use row placeholders > Given a param ID=<ID> > And a param name=<name> > And a param param1=<param1> > > Examples: > | ID | name | param1 | > | 001 | Alice | 101 | > | 002 | Bob | 102 | > """ > When I run "behave -f plain --no-timings features/use_steps_with_params.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Use row placeholders -*- > Given a param ID=001 ... passed > And a param name=Alice ... passed > And a param param1=101 ... passed > > Scenario Outline: Use row placeholders -*- > Given a param ID=002 ... passed > And a param name=Bob ... passed > And a param param1=102 ... passed > """ > > @parametrize.steps > Scenario: Use an unknown placeholder in generated scenario steps # features/scenario_outline.parametrized.feature:135 > Given a file named "features/use_steps_with_unknown_params.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Use unknown placeholders > Given an unknown param unknown=<unknown> > > Examples: > | ID | name | param1 | > | 001 | Alice | 100 | > """ > When I run "behave -f plain --no-timings features/use_steps_with_unknown_params.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Use unknown placeholders -*- > Given an unknown param unknown=<unknown> ... passed > """ > But note that "unknown placeholders are not replaced" # behave4cmd0/note_steps.py:15 > > @parametrize.steps > Scenario: Use placeholders in generated scenario step.text # features/scenario_outline.parametrized.feature:156 > Given a file named "features/use_steps_with_param_text.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Use parametrized step with text > Given a step with text: > \"\"\" > <greeting> <name>; > Travel agency: <travel agency> > \"\"\" > > Examples: > | ID | name | greeting | travel agency | > | 001 | Alice | Hello | Pony express | > """ > When I run "behave -f plain --no-timings features/use_steps_with_param_text.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Use parametrized step with text -*- > Given a step with text ... passed > \"\"\" > Hello Alice; > Travel agency: Pony express > \"\"\" > """ > And note that "placeholders in step.text are replaced with row data" # behave4cmd0/note_steps.py:15 > > @parametrize.steps > Scenario: Use placeholders in generated scenario step.table # features/scenario_outline.parametrized.feature:185 > Given a file named "features/use_steps_with_param_table.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Use parametrized step with table > Given a step with table: > | Id | Name | Travel Agency | row id | > | <ID> | <name> | <travel agency> | <row.id> | > > Examples: > | ID | name | greeting | travel agency | > | 001 | Alice | Hello | Pony express | > """ > When I run "behave -f plain --no-timings features/use_steps_with_param_table.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Use parametrized step with table -*- > Given a step with table ... passed > | Id | Name | Travel Agency | row id | > | 001 | Alice | Pony express | <row.id> | > """ > And note that "placeholders in step.table cells are replaced with row data" # behave4cmd0/note_steps.py:15 > But note that "<row.id> is currently not supported in table cells (like other special placeholders)" # behave4cmd0/note_steps.py:15 > > @parametrize.steps > Scenario: Use special placeholders in generated scenario steps # features/scenario_outline.parametrized.feature:211 > Given a file named "features/use_steps_with_special_params.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Use special placeholders @<row.id> > Given a param name=<name> > And a param examples.name=<examples.name> > And a param examples.index=<examples.index> > And a param row.index=<row.index> > And a param row.id=<row.id> > > Examples: E-<ID>/@<row.id> > | ID | name | param1 | > | 001 | Alice | 100 | > | 002 | Bob | 101 | > """ > When I run "behave -f plain --no-timings features/use_steps_with_special_params.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Use special placeholders @1.1 -*- E-001/@1.1 > Given a param name=Alice ... passed > And a param examples.name=E-001/@1.1 ... passed > And a param examples.index=1 ... passed > And a param row.index=1 ... passed > And a param row.id=1.1 ... passed > > Scenario Outline: Use special placeholders @1.2 -*- E-002/@1.2 > Given a param name=Bob ... passed > And a param examples.name=E-002/@1.2 ... passed > And a param examples.index=1 ... passed > And a param row.index=2 ... passed > And a param row.id=1.2 ... passed > """ > > @parametrize.name @parametrize.steps > Scenario: When special placeholder name is used for row data (Case: Override) # features/scenario_outline.parametrized.feature:248 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} -*- special:row.id=@{row.id} {examples.name} > """ > And a file named "features/use_name_with_overwritten_params.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: SOP3 > Scenario Outline: Use placeholder data:row.id=<row.id> > Given a param name=<name> > And a param row.id=<row.id> > > Examples: E-<ID>/<row.id> > | ID | name | row.id | > | 001 | Alice | 100 | > | 002 | Bob | 101 | > """ > When I run "behave -f progress3 features/use_name_with_overwritten_params.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Use placeholder data:row.id=100 -*- special:row.id=@1.1 E-001/100 .. > Use placeholder data:row.id=101 -*- special:row.id=@1.2 E-002/101 .. > """ > When I run "behave -f plain --no-timings features/use_name_with_overwritten_params.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Use placeholder data:row.id=100 -*- special:row.id=@1.1 E-001/100 > Given a param name=Alice ... passed > And a param row.id=100 ... passed > > Scenario Outline: Use placeholder data:row.id=101 -*- special:row.id=@1.2 E-002/101 > Given a param name=Bob ... passed > And a param row.id=101 ... passed > """ > But note that "a row data placeholder can override a special placeholder" # behave4cmd0/note_steps.py:15 > And note that "the name annotation {row.id} still allows to refer to the special one" # behave4cmd0/note_steps.py:15 > > @parametrize.steps > Scenario: Placeholder value has placeholder syntax (Case: recursion-check) # features/scenario_outline.parametrized.feature:293 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} -*- @{row.id} {examples.name} > """ > And a file named "features/use_value_with_placeholder_syntax.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: Use weird placeholder values > Given a param name=<name> > > Examples: > | name | Expected | ID | Case: | > | <ID> | 001 | 001 | Value refers to other, known placeholder.| > | <ID> | 002 | 002 | Check if row specific value is used. | > | <unknown> | <unkown> | 003 | Value refers to unknown placeholder. | > | <name> | <name> | 004 | Value refers to itself (recursion?). | > """ > When I run "behave -f plain --no-timings features/use_value_with_placeholder_syntax.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > Scenario Outline: Use weird placeholder values -*- @1.1 > Given a param name=001 ... passed > > Scenario Outline: Use weird placeholder values -*- @1.2 > Given a param name=002 ... passed > > Scenario Outline: Use weird placeholder values -*- @1.3 > Given a param name=<unknown> ... passed > > Scenario Outline: Use weird placeholder values -*- @1.4 > Given a param name=<name> ... passed > """ > > @simple.case @parametrize.tags > Scenario: Parametrized tags in a Scenario Outline # features/scenario_outline.parametrized.feature:334 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} -*- @{row.id} {examples.name} > """ > And a file named "features/parametrized_tags.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > @foo @outline.e<examples.index> @outline.row.<row.id> @outline.ID.<ID> > Scenario Outline: Use parametrized tags > Given a param name=<name> > > Examples: > | ID | name | > | 001 | Alice | > | 002 | Bob | > """ > When I run "behave -f pretty -c --no-timings features/parametrized_tags.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @foo @outline.e1 @outline.row.1.1 @outline.ID.001 > Scenario Outline: Use parametrized tags -*- @1.1 # features/parametrized_tags.feature:8 > Given a param name=Alice # features/steps/param_steps.py:7 > > @foo @outline.e1 @outline.row.1.2 @outline.ID.002 > Scenario Outline: Use parametrized tags -*- @1.2 # features/parametrized_tags.feature:9 > Given a param name=Bob # features/steps/param_steps.py:7 > """ > But note that "special and row data placeholders can be used in tags" # behave4cmd0/note_steps.py:15 > > @parametrize.tags > Scenario: Parametrized tags in a Scenario Outline (Case: Whitespace... in value) # features/scenario_outline.parametrized.feature:367 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > scenario_outline_annotation_schema = {name} -*- @{row.id} {examples.name} > """ > And a file named "features/parametrized_tags2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > @outline.name.<name> > Scenario Outline: Use parametrized tags > Given a param name=<name> > > Examples: > | ID | name | Case: | > | 001 | Alice Cooper | Placeholder value w/ whitespace | > | 002 | Bob\tMarley | Placeholder value w/ tab | > | 003 | Joe\nCocker | Placeholder value w/ newline | > """ > When I run "behave -f pretty -c --no-source features/parametrized_tags2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > @outline.name.Alice_Cooper > Scenario Outline: Use parametrized tags -*- @1.1 > Given a param name=Alice Cooper > > @outline.name.Bob_Marley > Scenario Outline: Use parametrized tags -*- @1.2 > Given a param name=Bob\tMarley > > @outline.name.Joe_Cocker > Scenario Outline: Use parametrized tags -*- @1.3 > Given a param name=Joe\nCocker > """ > But note that "placeholder values with special chars (whitespace, ...) are transformed" # behave4cmd0/note_steps.py:15 > >Feature: Duplicated Step Definitions # features/step.duplicated_step.feature:1 > As I tester and test writer > I want to know when step definitions are duplicated > So that I can fix these problems. > Scenario: Duplicated Step in same File # features/step.duplicated_step.feature:8 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I call Alice') > def step(context): > pass > > @given(u'I call Alice') > def step(context): > pass > """ > And a file named "features/duplicated_step_alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Duplicated Step > Given I call Alice > """ > When I run "behave -f plain features/duplicated_step_alice.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > AmbiguousStep: @given('I call Alice') has already been defined in > existing step @given('I call Alice') at features/steps/alice_steps.py:3 > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > File "features/steps/alice_steps.py", line 7, in <module> > @given(u'I call Alice') > """ > > Scenario: Duplicated Step Definition in another File # features/step.duplicated_step.feature:42 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/bob1_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given('I call Bob') > def step_call_bob1(context): > pass > """ > And a file named "features/steps/bob2_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given('I call Bob') > def step_call_bob2(context): > pass > """ > And a file named "features/duplicated_step_bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Duplicated Step > Given I call Bob > """ > When I run "behave -f plain features/duplicated_step_bob.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > AmbiguousStep: @given('I call Bob') has already been defined in > existing step @given('I call Bob') at features/steps/bob1_steps.py:3 > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > File "features/steps/bob2_steps.py", line 3, in <module> > @given('I call Bob') > """ > >Feature: Execute Steps within a Step Function (Nested Steps) # features/step.execute_steps.feature:1 > As a tester > I want to reuse existing steps and call several ones within another step > So that I can comply with the the DRY principle. > Scenario: Execute a number of simple steps (GOOD CASE) # features/step.execute_steps.feature:7 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I go to the supermarket') > def step_given_I_go_to_the_supermarket(context): > context.shopping_cart = {} > > @when(u'I buy {amount:n} {item:w}') > def step_when_I_buy(context, amount, item): > assert amount >= 0 > if not item in context.shopping_cart: > context.shopping_cart[item] = 0 > context.shopping_cart[item] += amount > > # -- HERE: Is the interesting functionality. > @when(u'I buy the usual things') > def step_when_I_buy_the_usual_things(context): > context.execute_steps(u''' > When I buy 2 apples > And I buy 3 bananas > ''') > > @then(u'I have {amount:n} {item:w}') > def step_then_I_have(context, amount, item): > actual = context.shopping_cart.get(item, 0) > assert amount == actual > """ > And a file named "features/use_nested_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I go to the supermarket > When I buy the usual things > Then I have 2 apples > And I have 3 bananas > """ > When I run "behave -f plain features/use_nested_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 4 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @not_implemented > Scenario: A Nested Step Fails with Assert # features/step.execute_steps.feature:55 > > @not_implemented > Scenario: A Nested Step Fails with Exception # features/step.execute_steps.feature:58 > >Feature: Execute nested steps that use a table # features/step.execute_steps.with_table.feature:1 > > Scenario: # features/step.execute_steps.with_table.feature:3 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then, step > import six > @given('the following nested steps') > def step_given_following_nested_steps(context): > assert context.text, "ENSURE: multi-line text is provided." > context.nested_steps = six.text_type(context.text) > > @step('I execute the nested steps {comment}') > def step_execute_nested_steps_with_table(context, comment): > assert context.nested_steps, "ENSURE: nested steps are provided." > context.execute_steps(context.nested_steps) > > @then('the step "{expected_step}" was called') > def then_step_was_called(context, expected_step): > assert context.steps_called, "ENSURE: steps_called is provided." > assert expected_step in context.steps_called > > @then('the table should be equal to') > def then_table_should_be_equal_to(context): > assert context.table, "ENSURE: table is provided." > expected_table = context.table > actual_table = context.the_table > assert actual_table == expected_table > > # -- SPECIAL-STEP: > @step('I setup an address book with') > def step_setup_address_book_with_friends(context): > assert context.table, "ENSURE: table is provided." > if not hasattr(context, "steps_called"): > context.steps_called = [] > context.steps_called.append("I setup an address book with") > context.the_table = context.table > """ > And a file named "features/execute_nested_steps_with_table.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following nested steps: > \"\"\" > When I setup an address book with: > | Name | Telephone Number | > | Alice | 555 1111 | > | Bob | 555 2222 | > \"\"\" > When I execute the nested steps with a table > Then the step "I setup an address book with" was called > And the table should be equal to: > | Name | Telephone Number | > | Alice | 555 1111 | > | Bob | 555 2222 | > """ > When I run "behave -f plain features/execute_nested_steps_with_table.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 4 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >Feature: Ensure that a step module can import another step module # features/step.import_other_step_module.feature:1 > As a test writer > I want to import step definitions from another module in a step module > So that I can reuse other steps and call them directly. > | When a step module imports another step module > | this should not cause AmbiguousStep errors > | due to duplicated registration of the same step functions. > | > | NOTES: > | * In general you should avoid this case (provided as example here). > | * Use "context.execute_steps(...)" to avoid importing other step modules > | * Use step-libraries; this will in general use sane imports of other step modules > Scenario: Step module that imports another step module # features/step.import_other_step_module.feature:17 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/alice1_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'I call Alice') > def step_call_alice(context): > pass > """ > And a file named "features/steps/bob1_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > from alice1_steps import step_call_alice > > @given(u'I call Bob') > def step_call_bob(context): > pass > > @given(u'I call Bob and Alice') > def step_call_bob_and_alice(context): > step_call_bob(context) > step_call_alice(context) > """ > And a file named "features/example.import_step_module.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I call Bob and Alice > """ > When I run "behave -f plain --no-timings features/example.import_step_module.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given I call Bob and Alice ... passed > """ > > Scenario: Step module that imports another step module (cross-wise) # features/step.import_other_step_module.feature:61 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/alice2_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > import bob2_steps # -- BAD: Import other step module, cross-wise. > > @given(u'I call Alice') > def step_call_alice(context): > pass > """ > And a file named "features/steps/bob2_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > import alice2_steps # -- BAD: Import other step module, cross-wise. > > @given(u'I call Bob') > def step_call_bob(context): > pass > """ > And a file named "features/example.cross_imported_step_modules.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I call Alice > And I call Bob > """ > When I run "behave -f plain --no-timings features/example.cross_imported_step_modules.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given I call Alice ... passed > And I call Bob ... passed > """ > >Feature: Pending Step (Exists with NotImplementedError Marker) # features/step.pending_steps.feature:1 > | Terminology: > | * An undefined step is a step without matching step implementation. > | * A pending step exists, > | but contains only the undefined step snippet as implementation, > | that marks it as NotImplemented. > | > | RELATED TO: > | * step.undefined_steps.feature > @setup > Scenario: Feature Setup # features/step.pending_steps.feature:14 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > show_skipped = false > show_timings = false > """ > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step fails') > def step_fails(context, word): > assert False, "XFAIL" > """ > And a file named "features/steps/pending_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given('a pending step is used') > def step_pending_given(context): > raise NotImplementedError('STEP: Given a pending step is used') > > @when('a pending step is used') > def step_pending_when(context): > raise NotImplementedError('STEP: When a pending step is used') > > @then('a pending step is used') > def step_pending_then(context): > raise NotImplementedError('STEP: Then a pending step is used') > """ > And a file named "features/use_pending_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: 1 > Given a step passes > And a pending step is used > When another step passes > > Scenario: 2 > Given a step passes > When a pending step is used > Then some step passes > > Scenario: 3 > Given a step passes > When another step passes > Then a pending step is used > """ > > Scenario: Pending given step (not implemented) # features/step.pending_steps.feature:69 > When I run "behave -f plain features/use_pending_steps.feature:2" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: 1 > Given a step passes ... passed > And a pending step is used ... failed > """ > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > NotImplementedError: STEP: Given a pending step is used > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > File "features/steps/pending_steps.py", line 5, in step_pending_given > raise NotImplementedError('STEP: Given a pending step is used') > """ > > Scenario: Pending when step (not implemented) # features/step.pending_steps.feature:89 > When I run "behave -f plain features/use_pending_steps.feature:7" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: 2 > Given a step passes ... passed > When a pending step is used ... failed > """ > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > NotImplementedError: STEP: When a pending step is used > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > File "features/steps/pending_steps.py", line 9, in step_pending_when > raise NotImplementedError('STEP: When a pending step is used') > """ > > Scenario: Pending then step (not implemented) # features/step.pending_steps.feature:109 > When I run "behave -f plain features/use_pending_steps.feature:12" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: 3 > Given a step passes ... passed > When another step passes ... passed > Then a pending step is used ... failed > """ > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > NotImplementedError: STEP: Then a pending step is used > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > File "features/steps/pending_steps.py", line 13, in step_pending_then > raise NotImplementedError('STEP: Then a pending step is used') > """ > >Feature: Undefined Step # features/step.undefined_steps.feature:1 > | Terminology: > | * An undefined step is a step without matching step implementation. > | > | Specification: > | * An undefined step should be reported after the run. > | * An undefined step should cause its scenario to fail. > | * If an undefined step is detected the remaining scenario steps are skipped. > | * All undefined steps in a scenario should be reported (issue #42). > | * Undefined steps should be detected even after a step fails in a scenario. > | * Each undefined step should be reported only once. > | * If a scenario is disabled (by tag expression, etc.), > | the undefined step discovery should not occur. > | This allows to prepare scenarios that are not intended to run (yet). > | * Option --dry-run should discover undefined steps, too. > | > | RELATED TO: > | * issue #42 Multiple undefined steps in same scenario are detected. > @setup > Scenario: Feature Setup # features/step.undefined_steps.feature:23 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL" > """ > And a file named "features/undefined_last_step.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > """ > > Scenario: An undefined step should be reported # features/step.undefined_steps.feature:45 > When I run "behave -f plain -T features/undefined_last_step.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step passes ... passed > When an undefined step is used ... undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > > @when(u'an undefined step is used') > def step_impl(context): > raise NotImplementedError(u'STEP: When an undefined step is used') > """ > And an undefined-step snippet should exist for "When an undefined step is used" # features/steps/behave_undefined_steps.py:37 > > Scenario: An undefined step should cause its scenario to fail # features/step.undefined_steps.feature:66 > When I run "behave -f plain features/undefined_last_step.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 1 undefined > """ > > Scenario: Additional scenario steps after an undefined step are skipped # features/step.undefined_steps.feature:76 > Given a file named "features/undefined_step_and_more.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > Then a step passes > And a step fails > """ > When I run "behave -f plain -T features/undefined_step_and_more.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 0 failed, 2 skipped, 1 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step passes ... passed > When an undefined step is used ... undefined > """ > > Scenario: Two undefined steps in same scenario should be detected # features/step.undefined_steps.feature:102 > Given a file named "features/two_undefined_steps1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > And a step fails > Then another undefined step is used > """ > When I run "behave -f plain -T features/two_undefined_steps1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 0 failed, 1 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step passes ... passed > When an undefined step is used ... undefined > """ > And undefined-step snippets should exist for # features/steps/behave_undefined_steps.py:70 > | Step | > | When an undefined step is used | > | Then another undefined step is used | > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > And a step fails ... skipped > Then another undefined step is used ... undefined > """ > > Scenario: Two undefined steps in different scenarios # features/step.undefined_steps.feature:137 > Given a file named "features/two_undefined_steps2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > > Scenario: > Given another undefined step is used > When a step passes > """ > When I run "behave -f plain -T features/two_undefined_steps2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 2 failed, 0 skipped > 1 step passed, 0 failed, 1 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step passes ... passed > When an undefined step is used ... undefined > > Scenario: > Given another undefined step is used ... undefined > """ > And undefined-step snippets should exist for # features/steps/behave_undefined_steps.py:70 > | Step | > | When an undefined step is used | > | Given another undefined step is used | > > Scenario: Undefined step in Scenario Outline # features/step.undefined_steps.feature:172 > Given a file named "features/undefined_step_in_scenario_outline.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: > Given a step <outcome1> > When an undefined step is used > Then a step <outcome2> > > Examples: > | outcome1 | outcome2 | > | passes | passes | > | passes | fails | > | fails | passes | > | fails | fails | > """ > When I run "behave -f plain -T features/undefined_step_in_scenario_outline.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 4 failed, 0 skipped > 2 steps passed, 2 failed, 4 skipped, 4 undefined > """ > And an undefined-step snippet should exist for "When an undefined step is used" # features/steps/behave_undefined_steps.py:37 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario Outline: -- @1.1 > Given a step passes ... passed > When an undefined step is used ... undefined > > Scenario Outline: -- @1.2 > Given a step passes ... passed > When an undefined step is used ... undefined > > Scenario Outline: -- @1.3 > Given a step fails ... failed > Assertion Failed: XFAIL > > Scenario Outline: -- @1.4 > Given a step fails ... failed > Assertion Failed: XFAIL > """ > > Scenario: Two undefined step in Scenario Outline # features/step.undefined_steps.feature:217 > Given a file named "features/two_undefined_step_in_scenario_outline.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario Outline: > Given a step <outcome1> > When an undefined step is used > Then a step <outcome2> > And another undefined step is used > > Examples: > | outcome1 | outcome2 | > | passes | passes | > | passes | fails | > | fails | passes | > | fails | fails | > """ > When I run "behave -f plain features/two_undefined_step_in_scenario_outline.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 4 failed, 0 skipped > 2 steps passed, 2 failed, 4 skipped, 8 undefined > """ > And undefined-step snippets should exist for # features/steps/behave_undefined_steps.py:70 > | Step | > | When an undefined step is used | > | Then another undefined step is used | > > Scenario: Undefined steps are detected if scenario is selected via tag # features/step.undefined_steps.feature:247 > Given a file named "features/undefined_steps_with_tagged_scenario.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @selected > Scenario: S1 > Given a step passes > And an undefined step Alice > When a step fails > Then an undefined step Bob > > @selected > Scenario: S2 > Given a step passes > When an undefined step Charly > > @not_selected > Scenario: S3 > Given an undefined step Delta > Then a step fails > """ > When I run "behave -f plain --tags=@selected features/undefined_steps_with_tagged_scenario.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 2 failed, 1 skipped > 2 steps passed, 0 failed, 3 skipped, 3 undefined > """ > And undefined-step snippets should exist for # features/steps/behave_undefined_steps.py:70 > | Step | > | Given an undefined step Alice | > | Then an undefined step Bob | > | When an undefined step Charly | > But undefined-step snippets should not exist for # features/steps/behave_undefined_steps.py:87 > | Step | > | Given a step passes | > | Given an undefined step Delta | > | When a step fails | > | Then a step fails | > > Scenario: Undefined steps are detected if --dry-run option is used # features/step.undefined_steps.feature:289 > When I run "behave -f plain --dry-run features/undefined_steps_with_tagged_scenario.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 0 failed, 0 skipped, 1 untested > 0 scenarios passed, 0 failed, 0 skipped, 3 untested > 0 steps passed, 0 failed, 0 skipped, 4 undefined, 4 untested > """ > And undefined-step snippets should exist for # features/steps/behave_undefined_steps.py:70 > | Step | > | Given an undefined step Alice | > | Then an undefined step Bob | > | When an undefined step Charly | > | Given an undefined step Delta | > But undefined-step snippets should not exist for # features/steps/behave_undefined_steps.py:87 > | Step | > | Given a step passes | > | When a step fails | > | Then a step fails | > >Feature: Use a step library # features/step.use_step_library.feature:1 > As a tester > I want to use steps from one or more step libraries > To simplify the reuse of problem domain specific steps in multiple projects. > Scenario: Use a simple step library # features/step.use_step_library.feature:8 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "step_library1/__init__.py" # behave4cmd0/command_steps.py:66 > And a file named "step_library1/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('I meet Alice') > def step_meet_alice(context): > pass > """ > And a file named "step_library1/bob_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('I meet Bob') > def step_meet_bob(context): > pass > """ > And a file named "features/steps/use_step_library.py" with # behave4cmd0/command_steps.py:50 > """ > from step_library1 import alice_steps, bob_steps > """ > And a file named "features/example_use_step_library.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I meet Alice > And I meet Bob > """ > When I run "behave -f plain features/example_use_step_library.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >Feature: Step dialect for generic steps # features/step_dialect.generic_steps.feature:1 > As a test/story writer > I want to have a possibility to use generic steps > So that I can execute a sequence of steps without BDD keywords (Given/When/Then) > | SPECIFICATION: Generic step > | * Prefix each step with a '*' (asterisk/star) character to mark it as step > | * Provide step-functions/step definition with "@step" decorator > @setup > Scenario: Feature Setup # features/step_dialect.generic_steps.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('{word:w} step passes with "{param}"') > def step_passes_with_param(context, word, param): > pass > > @step('a multi-line text step with') > def step_with_multiline_text(context): > assert context.text is not None, "REQUIRE: multi-line text" > > @step('a step fails with "{param}"') > def step_fails_with_param(context, param=None): > assert False, "XFAIL-STEP: %s" % param > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL-STEP" > > @step('a table step with') > def step_with_table(context): > assert context.table, "REQUIRES: table" > context.table.require_columns(["name", "age"]) > """ > > Scenario: Simple step-by-step example # features/step_dialect.generic_steps.feature:46 > * a step passes # behave4cmd0/passing_steps.py:23 > * another step passes # behave4cmd0/passing_steps.py:23 > > Scenario: Simple step-by-step example 2 # features/step_dialect.generic_steps.feature:52 > Given a file named "features/generic_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > * a step passes > * another step passes > * a step passes with "Alice" > * another step passes with "Bob" > """ > When I run "behave -f plain -T features/generic_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 4 steps passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > * a step passes ... passed > * another step passes ... passed > * a step passes with "Alice" ... passed > * another step passes with "Bob" ... passed > """ > > Scenario: Simple step-by-step example with failing steps # features/step_dialect.generic_steps.feature:78 > Given a file named "features/generic_steps.failing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > * a step passes > * a step fails with "Alice" > * a step fails with "Bob" > * another step passes > """ > When I run "behave -f plain -T features/generic_steps.failing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 2 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > * a step passes ... passed > * a step fails with "Alice" ... failed > """ > > Scenario: Simple step-by-step example with scenario description # features/step_dialect.generic_steps.feature:103 > Given a file named "features/generic_steps.with_description.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > > First scenario description line. > Second scenario description line. > > * a step passes > * another step passes > """ > When I run "behave -f plain -T features/generic_steps.with_description.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped > """ > > Scenario: Simple step-by-step example with multi-line text # features/step_dialect.generic_steps.feature:126 > Given a file named "features/generic_steps.with_text.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > * a step passes > * a multi-line text step with: > \"\"\" > First line of multi-line text. > Second-line of multi-line text. > \"\"\" > * another step passes with "Charly" > """ > When I run "behave -f plain -T features/generic_steps.with_text.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > > Scenario: > * a step passes ... passed > * a multi-line text step with ... passed > \"\"\" > First line of multi-line text. > Second-line of multi-line text. > \"\"\" > * another step passes with "Charly" ... passed > """ > > Scenario: Simple step-by-step example with table # features/step_dialect.generic_steps.feature:159 > Given a file named "features/generic_steps.with_table.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > * a step passes > * a table step with: > | name | age | > | Alice | 10 | > | Bob | 12 | > * another step passes with "Dodo" > """ > When I run "behave -f plain -T features/generic_steps.with_table.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > * a step passes ... passed > * a table step with ... passed > | name | age | > | Alice | 10 | > | Bob | 12 | > * another step passes with "Dodo" ... passed > """ > >Feature: Step Dialect for BDD Steps with Given/When/Then Keywords # features/step_dialect.given_when_then.feature:1 > In order to execute a sequence of steps with BDD keywords (Given/When/Then) > As a test/story writer > I want to have the possibility to express myself. > | NOTE: > | * More details are provided in other features. > Scenario: Simple example # features/step_dialect.given_when_then.feature:11 > Given a step passes # behave4cmd0/passing_steps.py:23 > When a step passes # behave4cmd0/passing_steps.py:23 > And a step passes # behave4cmd0/passing_steps.py:23 > Then a step passes # behave4cmd0/passing_steps.py:23 > And a step passes # behave4cmd0/passing_steps.py:23 > But a step passes # behave4cmd0/passing_steps.py:23 > > Scenario: Simple example (with lower-case keywords) # features/step_dialect.given_when_then.feature:24 > Given a step passes # behave4cmd0/passing_steps.py:23 > When a step passes # behave4cmd0/passing_steps.py:23 > And a step passes # behave4cmd0/passing_steps.py:23 > Then a step passes # behave4cmd0/passing_steps.py:23 > And a step passes # behave4cmd0/passing_steps.py:23 > But a step passes # behave4cmd0/passing_steps.py:23 > > Scenario: Step usage example with details by running behave # features/step_dialect.given_when_then.feature:36 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then, step > > @given('a step passes') > def given_step_passes(context): > pass > > @when('a step passes') > def when_step_passes(context): > pass > > @then('a step passes') > def then_step_passes(context): > pass > > @step('a step passes with "{param}"') > def step_passes_with_param(context, param): > pass > > @step('another step passes') > def step_passes(context): > pass > > @step('another step passes with "{param}"') > def step_passes(context, param): > pass > """ > And a file named "features/basic_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > And another step passes > When a step passes with "Alice" > Then another step passes with "Bob" > """ > When I run "behave -f plain -T features/basic_steps.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 4 steps passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given a step passes ... passed > And another step passes ... passed > When a step passes with "Alice" ... passed > Then another step passes with "Bob" ... passed > """ > >@sequential >Feature: Parse data types in step parameters (type transformation) # features/step_param.builtin_types.with_float.feature:2 > As a test writer > I want write steps with parameter that should have floating-point data types > So that I can just use the step parameter with the correct type > behave uses the parse module (inverse of Python string.format). > Therefore, the following ``parse types`` for floats are already supported: > ===== =========================================== ============= ================================ > Type Characters Matched (regex class) Output Type Example(s) > ===== =========================================== ============= ================================ > % Percentage (converted to value/100.0) float 51.2% > f Fixed-point numbers float 1.23 -1.45 > e Floating-point numbers with exponent float 1.1e-10 -12.3E+5 > g General number format (either d, f or e) float 123 1.23 -1.45E+12 > ===== =========================================== ============= ================================ > SEE ALSO: > * http://pypi.python.org/pypi/parse > * string.format: http://docs.python.org/library/string.html#format-string-syntax > @setup > Scenario: Feature Setup # features/step_param.builtin_types.with_float.feature:27 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/float_param_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import then, step > class NotMatched(object): pass > > @step('a float param with "{value:g}"') > def step_float_param_with(context, value): > assert type(value) is float > context.value = value > > @step('a float param with "{value}"') > def step_float_param_otherwise(context, value): > context.value = NotMatched > > @step('a generic float param with "{value:g}"') > def step_generic_float_param_with(context, value): > step_float_param_with(context, value) > > @step('a generic float param with "{value}"') > def step_generic_float_param_otherwise(context, value): > step_float_param_otherwise(context, value) > > @step('a float with exponent param with "{value:e}"') > def step_float_with_exponent_param_with(context, value): > step_float_param_with(context, value) > > @step('a float with exponent param with "{value}"') > def step_float_with_exponent_param_otherwise(context, value): > step_float_param_otherwise(context, value) > > @step('a percentage param with "{value:%}"') > def step_percentage_param_with(context, value): > step_float_param_with(context, value) > > @step('a percentage param with "{value}"') > def step_percentage_param_otherwise(context, value): > step_float_param_otherwise(context, value) > > @step('a fixed-point number param with "{value:f}"') > def step_fixed_point_number_param_with(context, value): > step_float_param_with(context, value) > > @step('a fixed-point number param with "{value}"') > def step_fixed_point_number_param_otherwise(context, value): > step_float_param_otherwise(context, value) > > @then('the value should be {outcome} as float number') > def step_value_should_be_matched_as_float_number(context, outcome): > expected_type = float > if outcome == "matched": > assert type(context.value) is expected_type, \ > "Unexpected type: %s" % type(context.value) > else: > assert context.value is NotMatched > > @then('the value should be {outcome} as float number with "{expected:g}"') > def step_value_should_be_matched_as_float_number_with_expected(context, outcome, expected): > step_value_should_be_matched_as_float_number(context, outcome) > assert context.value == expected, \ > "FAILED: value(%s) == expected(%s)" % (context.value, expected) > """ > > Scenario: Float parameter values with type "%" (percentage) # features/step_param.builtin_types.with_float.feature:92 > Given a file named "features/example.float_param.with_percent.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Float parameter values with type "%" (percentage) > > Scenario Outline: Good cases > Given a percentage param with "<Value>" > Then the value should be matched as float number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 0% | 0 | Zero | > | 20% | 0.2 | Positive number | > | 120% | 1.2 | Larger than 100% | > | 10.5% | 0.105 | Float number | > | -10% | -0.1 | Negative number | > | +10% | 0.1 | With plus sign | > > > Scenario Outline: Bad cases (not matched) > Given a percentage param with "<Value>" > Then the value should be <Outcome> as float number > > Examples: > | Value | Outcome | Reason | > | 123 | not-matched | Percentage sign is missing | > | 1.23 | not-matched | Float number without percentage sign | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.float_param.with_percent.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 9 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Fixed-point parameter values with type "f" # features/step_param.builtin_types.with_float.feature:128 > Given a file named "features/example.float_param.with_type_f.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Float parameter values with type "f" (fixed-point number) > > Scenario Outline: Good cases > Given a fixed-point number param with "<Value>" > Then the value should be matched as float number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 0.23 | 0.23 | | > | 1.23 | 1.23 | | > | 123.45 | 123.45 | | > | +1.23 | 1.23 | With plus sign | > | -1.23 | -1.23 | Negative float | > > > Scenario Outline: Bad cases (not matched) > Given a fixed-point number param with "<Value>" > Then the value should be <Outcome> as float number > > Examples: > | Value | Outcome | Reason | > | 123 | not-matched | Integer number | > | 1.23E-7 | not-matched | Float number with exponent | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.float_param.with_type_f.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 8 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Float with exponent parameter values with type "e" # features/step_param.builtin_types.with_float.feature:163 > Given a file named "features/example.float_param.with_type_e.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Float parameter values with type "e" (float with exponents) > > Scenario Outline: Good cases > Given a float with exponent param with "<Value>" > Then the value should be matched as float number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 1.0E-10 | 1E-10 | With mantisse, negative exponent | > | 1.23E+5 | 123E3 | Exponent with plus sign | > | 123.0E+3 | 1.23E5 | Exponent with plus sign | > | -1.23E5 | -123E3 | Negative number with mantisse and exponent | > | INF | +INF | Infinity (INF) | > | +INF | INF | | > | -INF | -INF | | > | +inf | INF | Lower-case special names | > > > Scenario Outline: Bad cases (not matched) > Given a float with exponent param with "<Value>" > Then the value should be <Outcome> as float number > > Examples: > | Value | Outcome | Reason | > | 1E10 | not-matched | Without mantissa | > | 1.E10 | not-matched | Short mantissa | > | 123 | not-matched | Integer number | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.float_param.with_type_e.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 12 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Generic float parameter values with type "g" # features/step_param.builtin_types.with_float.feature:202 > Given a file named "features/example.float_param.with_type_g.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Float parameter values with type "g" (generic float) > > Scenario Outline: Good cases > Given a generic float param with "<Value>" > Then the value should be matched as float number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 1 | 1.0 | Integer number format | > | 1E10 | 1.0E10 | Float with exponent and shortened mantissa | > | 1.23E5 | 1.23E5 | Float with exponent and mantissa | > | 1.23e5 | 1.23E5 | Float with exponent and mantissa (lower-case) | > | 1.0E-10 | 1E-10 | With mantisse, negative exponent | > | 1.23E+5 | 123E3 | Exponent with plus sign | > | 123.0E+3 | 1.23E5 | Exponent with plus sign | > | -1.23E5 | -123E3 | Negative number with mantisse and exponent | > > > Scenario Outline: Bad cases (not matched) > Given a generic float param with "<Value>" > Then the value should be <Outcome> as float number > > Examples: > | Value | Outcome | Reason | > | 0b101 | not-matched | Binary number | > | 0o17 | not-matched | Octal number | > | 0x1A | not-matched | Hexadecimal number | > | 1.E10 | not-matched | Short mantissa | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.float_param.with_type_g.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 13 scenarios passed, 0 failed, 0 skipped > """ > >@sequential >Feature: Parse integer data types in step parameters (type transformation) # features/step_param.builtin_types.with_integer.feature:2 > As a test writer > I want write steps with parameter that should have integer data types > So that I can just use the step parameter with the correct type > Behave uses the parse module (inverse of Python string.format). > Therefore, the following ``parse types`` for integer numbers are already supported: > ===== =========================================== ============= ================================ > Type Characters Matched (regex class) Output Type Example(s) > ===== =========================================== ============= ================================ > d Digits (effectively integer numbers) int 12345 0b101 0o761 0x1ABE > n Numbers with thousands separators (, or .) int 12,345 > b Binary numbers int 10111 0b1011 > o Octal numbers int 07654 0o123 > x Hexadecimal numbers (lower and upper case) int DEADBEAF 0xBEEF > ===== =========================================== ============= ================================ > SEE ALSO: > * http://pypi.python.org/pypi/parse > * string.format: http://docs.python.org/library/string.html#format-string-syntax > @setup > Scenario: Feature Setup # features/step_param.builtin_types.with_integer.feature:28 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/integer_param_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import then, step > from six import integer_types > > class NotMatched(object): pass > > @step('a integer param with "{value:d}"') > def step_integer_param_with(context, value): > assert isinstance(value, integer_types), "value.type=%s" % type(value) > context.value = value > > @step('a integer param with "{value}"') > def step_integer_param_otherwise(context, value): > context.value = NotMatched > > @step('a number param with "{value:n}"') > def step_number_param_with(context, value): > step_integer_param_with(context, value) > > @step('a number param with "{value}"') > def step_number_param_otherwise(context, value): > step_integer_param_otherwise(context, value) > > @step('a binary number param with "{value:b}"') > def step_binary_param_with(context, value): > step_integer_param_with(context, value) > > @step('a binary number param with "{value}"') > def step_binary_param_otherwise(context, value): > step_integer_param_otherwise(context, value) > > @step('a octal number param with "{value:o}"') > def step_hexadecimal_param_with(context, value): > step_integer_param_with(context, value) > > @step('a octal number param with "{value}"') > def step_hexadecimal_param_otherwise(context, value): > step_integer_param_otherwise(context, value) > > @step('a hexadecimal number param with "{value:x}"') > def step_hexadecimal_param_with(context, value): > step_integer_param_with(context, value) > > @step('a hexadecimal number param with "{value}"') > def step_hexadecimal_param_otherwise(context, value): > step_integer_param_otherwise(context, value) > > @then('the value should be {outcome} as integer number') > def step_value_should_be_matched_as_number(context, outcome): > if outcome == "matched": > assert isinstance(context.value, integer_types), \ > "Unexpected type: %s" % type(context.value) > else: > assert context.value is NotMatched > > @then('the value should be {outcome} as integer number with "{expected:d}"') > def step_value_should_be_matched_as_number_with_expected(context, outcome, expected): > step_value_should_be_matched_as_number(context, outcome) > assert context.value == expected, \ > "FAILED: value(%s) == expected(%s)" % (context.value, expected) > """ > > Scenario: Use type "d" (Digits) for integer params # features/step_param.builtin_types.with_integer.feature:94 > Given a file named "features/example.int_param.with_type_d.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Use type "d" (Digits) for integer params > > Scenario Outline: Good cases > Given a integer param with "<Value>" > Then the value should be matched as integer number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | -1 | -1 | Negative number | > | +1 | 1 | With plus sign | > | 0 | 0 | | > | 1 | 1 | | > | 10 | 10 | | > | 42 | 42 | | > > > Scenario Outline: Bad cases (not matched) > Given a integer param with "<Value>" > Then the value should be <Outcome> as integer number > > Examples: > | Value | Outcome | Reason | > | 1.23 | not-matched | Float number | > | 1E+2 | not-matched | Float number | > | Alice | not-matched | Not a number | > > > Scenario Outline: Conversion from other number system (base=2, 8, 16) > Given a integer param with "<Value>" > Then the value should be matched as integer number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 0b1011 | 11 | Binary number | > | 0o123 | 83 | Octal number | > | 0xBEEF | 48879 | Hexadecimal number | > """ > When I run "behave -f plain features/example.int_param.with_type_d.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 12 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Use type "n" (Number) for integer params # features/step_param.builtin_types.with_integer.feature:140 > Given a file named "features/example.int_param.with_type_n.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Use type "n" (Number) for integer params > > Scenario Outline: Good cases > Given a number param with "<Value>" > Then the value should be matched as integer number with "<Expected Value>" > > Examples: > | Value | Expected Value | > | -1 | -1 | > | 0 | 0 | > | 1 | 1 | > | 10 | 10 | > | 12.345 | 12345 | > | 12,543 | 12543 | > | 12,345.678 | 12345678 | > | 12.345,678 | 12345678 | > > > Scenario Outline: Bad cases (not matched) > Given a number param with "<Value>" > Then the value should be <Outcome> as integer number > > Examples: > | Value | Outcome | Reason | > | 123.34 | not-matched | Separator in wrong position | > | 1.23 | not-matched | Float number or separator in wrong position | > | 1E+2 | not-matched | Float number | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.int_param.with_type_n.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 12 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Use type "b" (Binary Number) for integer params # features/step_param.builtin_types.with_integer.feature:181 > Given a file named "features/example.int_param.with_type_b.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Use type "b" (Binary number) for integer params > > Scenario Outline: Good cases > Given a binary number param with "<Value>" > Then the value should be matched as integer number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 0 | 0 | | > | 1 | 1 | | > | 10 | 2 | | > | 11 | 3 | | > | 100 | 4 | | > | 101 | 5 | | > | 0111 | 7 | With padded, leading zero | > | 0b1001 | 9 | With binary number prefix "0b" | > | 0b1011 | 11 | With binary number prefix "0b" | > | 10000000 | 128 | Larger binary number | > > Scenario Outline: Bad cases (not matched) > Given a binary number param with "<Value>" > Then the value should be <Outcome> as integer number > > Examples: > | Value | Outcome | Reason | > | 21 | not-matched | Invalid binary number | > | 0b21 | not-matched | Invalid binary number with binary number prefix | > | 1.23 | not-matched | Float number | > | 1E+2 | not-matched | Float number | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.int_param.with_type_b.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 15 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Use type "o" (octal number) for integer params # features/step_param.builtin_types.with_integer.feature:221 > Given a file named "features/example.int_param.with_type_o.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Use type "o" (octal number) for integer params > > Scenario Outline: Good cases > Given a octal number param with "<Value>" > Then the value should be matched as integer number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 0 | 0 | | > | 12 | 10 | | > | 21 | 17 | | > | 65 | 53 | | > | 123 | 83 | | > | 0o1 | 1 | With leading octal prefix | > | 0o12 | 10 | | > | 0o21 | 17 | | > > > Scenario Outline: Bad cases (not matched) > Given a octal number param with "<Value>" > Then the value should be <Outcome> as integer number > > Examples: > | Value | Outcome | Reason | > | 8 | not-matched | Invalid octal number | > | 81 | not-matched | Invalid octal number | > | 0o81 | not-matched | Invalid octal number with octal number prefix | > | 1.23 | not-matched | Float number | > | 1E+2 | not-matched | Float number | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.int_param.with_type_o.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 14 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Use type "x" (hexadecimal number) for integer params # features/step_param.builtin_types.with_integer.feature:261 > Given a file named "features/example.int_param.with_type_x.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Use type "x" (hexadecimal number) for integer params > > Scenario Outline: Good cases: <Value> > Given a hexadecimal number param with "<Value>" > Then the value should be matched as integer number with "<Expected Value>" > > Examples: > | Value | Expected Value | Case | > | 0 | 0 | | > | 12 | 18 | | > | 21 | 33 | | > | 65 | 101 | | > | 123 | 291 | | > | beef | 48879 | With hexadecimal letters (lowercase) | > | BEEF | 48879 | With hexadecimal letters (uppercase) | > | deadbeef | 3735928559 | Larger hex number | > | DeadBeef | 3735928559 | Larger hex number (mixed case) | > | 0x01 | 1 | With hexadecimal prefix | > | 0x12 | 18 | | > | 0x21 | 33 | | > | 0xbeef | 48879 | | > | 0xBeEF | 48879 | | > > > Scenario Outline: Bad cases (not matched) > Given a hexadecimal number param with "<Value>" > Then the value should be <Outcome> as integer number > > Examples: > | Value | Outcome | Reason | > | G | not-matched | Invalid hex digit | > | G1 | not-matched | Invalid hex number | > | 0x1G | not-matched | Invalid hex number with hex number prefix | > | 1.23 | not-matched | Float number | > | 1E+2 | not-matched | Float number | > | Alice | not-matched | Not a number | > """ > When I run "behave -f plain features/example.int_param.with_type_x.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 20 scenarios passed, 0 failed, 0 skipped > """ > >Feature: Summary with Undefined Steps # features/summary.undefined_steps.feature:1 > | Specification: > | * An undefined step should be counted as "undefined" step. > | * An undefined step should cause its scenario to fail. > | * If an undefined step is detected the remaining scenario steps are skipped. > | > | RELATED TO: > | * issue #42 Multiple undefined steps in same scenario are detected. > @setup > Scenario: Test Setup # features/summary.undefined_steps.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > > Scenario: Undefined step as first step in a scenario # features/summary.undefined_steps.feature:24 > Given a file named "features/summary_undefined_first_step.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given an undefined step is used > When a step passes > Then a step passes > """ > When I run "behave -f plain features/summary_undefined_first_step.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 0 failed, 2 skipped, 1 undefined > """ > > Scenario: Undefined step as last step in a scenario # features/summary.undefined_steps.feature:41 > Given a file named "features/summary_undefined_last_step.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > """ > When I run "behave -f plain features/summary_undefined_last_step.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 1 undefined > """ > > Scenario: Undefined step as middle step in a scenario # features/summary.undefined_steps.feature:58 > Given a file named "features/summary_undefined_middle_step.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > Then a step passes > And a step passes > """ > When I run "behave -f plain features/summary_undefined_middle_step.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 0 failed, 2 skipped, 1 undefined > """ > > Scenario: Two undefined steps in same scenario, all are detected (skipped) # features/summary.undefined_steps.feature:76 > Given a file named "features/summary_undefined_step2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > Then a step passes > And another undefined step is used > """ > When I run "behave -f plain features/summary_undefined_step2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 0 failed, 1 skipped, 2 undefined > """ > > Scenario: Two undefined steps in different scenarios # features/summary.undefined_steps.feature:95 > Given a file named "features/summary_undefined_step_and_another.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an undefined step is used > Then a step passes > > Scenario: > Given an undefined step is used > When a step passes > """ > When I run "behave -f plain features/summary_undefined_step_and_another.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 2 failed, 0 skipped > 1 step passed, 0 failed, 2 skipped, 2 undefined > """ > >Feature: Tag Expression # features/tag_expression.feature:1 > As a tester > I want to select a subset of all features/scenarios by using tags > And I want to include and/or exclude some tags > So that I can focus on the "important" scenarios (and features). > | SPECIFICATION: > | * a tag expression is a boolean expression > | * a tag expression supports the operators: and, or, not > | * a tag expression is structured as: > | (or_expr1) and (or_expr2) and ... > | > | EXAMPLES: > | | Tag logic | Tag expression | Comment | > | | @foo | @foo | Select elements with @foo tag | > | | @foo | foo | Same, '@' is optional. | > | | not @foo | -@foo | Use minus for "not". | > | | not @foo | ~foo | Same, use tilde instead of minus | > | | @foo or @bar | @foo,@bar | Use comma for "or". | > | | @foo and @bar | @foo @bar | Use space separated terms. | > | | @foo or not @bar | @foo,-@bar | | > | | @foo and not @bar | @foo -@bar | | > Scenario: Select @foo # features/tag_expression.feature:26 > Given the tag expression "@foo" # features/steps/behave_tag_expression_steps.py:58 > Then the tag expression selects elements with tags # features/steps/behave_tag_expression_steps.py:69 > | tags | selected? | > | | no | > | @foo | yes | > | @other | no | > | @foo @other | yes | > > Scenario: Tag expression with 0..1 tags # features/tag_expression.feature:36 > Given the model elements with name and tags # features/steps/behave_tag_expression_steps.py:96 > | name | tags | Comment | > | S0 | | Untagged | > | S1 | @foo | With 1 tag | > | S2 | @other | | > | S3 | @foo @other | With 2 tags | > And note that "are all combinations of 0..2 tags" # behave4cmd0/note_steps.py:15 > Then the tag expression selects model elements with # features/steps/behave_tag_expression_steps.py:126 > | tag expression | selected? | Case comment | > | | S0, S1, S2, S3 | Select all (empty tag expression) | > | @foo | S1, S3 | Select @foo | > | -@foo | S0, S2 | not @foo, selects untagged elements | > But note that "tag expression variants are also supported" # behave4cmd0/note_steps.py:15 > And the tag expression selects model elements with # features/steps/behave_tag_expression_steps.py:126 > | tag expression | selected? | Case comment | > | foo | S1, S3 | @foo: '@' is optional | > | -foo | S0, S2 | not @foo: '@' is optional | > | ~foo | S0, S2 | not @foo: tilde as minus | > | ~@foo | S0, S2 | not @foo: '~@' is supported | > > Scenario: Tag expression with two tags (@foo, @bar) # features/tag_expression.feature:58 > Given the model elements with name and tags # features/steps/behave_tag_expression_steps.py:96 > | name | tags | Comment | > | S0 | | Untagged | > | S1 | @foo | With 1 tag | > | S2 | @bar | | > | S3 | @other | | > | S4 | @foo @bar | With 2 tags | > | S5 | @foo @other | | > | S6 | @bar @other | | > | S7 | @foo @bar @other | With 3 tags | > And note that "are all combinations of 0..3 tags" # behave4cmd0/note_steps.py:15 > Then the tag expression selects model elements with # features/steps/behave_tag_expression_steps.py:126 > | tag expression | selected? | Case | > | | S0, S1, S2, S3, S4, S5, S6, S7 | Select all | > | @foo,@bar | S1, S2, S4, S5, S6, S7 | @foo or @bar | > | @foo,-@bar | S0, S1, S3, S4, S5, S7 | @foo or not @bar | > | -@foo,-@bar | S0, S1, S2, S3, S5, S6 | not @foo or @not @bar | > | @foo @bar | S4, S7 | @foo and @bar | > | @foo -@bar | S1, S5 | @foo and not @bar | > | -@foo -@bar | S0, S3 | not @foo and not @bar | > > Scenario: Tag expression with three tags (@foo, @bar, @zap) # features/tag_expression.feature:81 > Given the model elements with name and tags # features/steps/behave_tag_expression_steps.py:96 > | name | tags | Comment | > | S0 | | Untagged | > | S1 | @foo | With 1 tag | > | S2 | @bar | | > | S3 | @zap | | > | S4 | @other | | > | S5 | @foo @bar | With 2 tags | > | S6 | @foo @zap | | > | S7 | @foo @other | | > | S8 | @bar @zap | | > | S9 | @bar @other | | > | S10 | @zap @other | | > | S11 | @foo @bar @zap | With 3 tags | > | S12 | @foo @bar @other | | > | S13 | @foo @zap @other | | > | S14 | @bar @zap @other | | > | S15 | @foo @bar @zap @other | With 4 tags | > And note that "are all combinations of 0..4 tags" # behave4cmd0/note_steps.py:15 > Then the tag expression selects model elements with # features/steps/behave_tag_expression_steps.py:126 > | tag expression | selected? | Case | > | @foo,@bar @zap | S6, S8, S11, S13, S14, S15 | (@foo or @bar) and @zap | > | @foo,@bar -@zap | S1, S2, S5, S7, S9, S12 | (@foo or @bar) and not @zap | > | @foo,-@bar @zap | S3, S6, S10, S11, S13, S15 | (@foo or not @bar) and @zap | > >Feature: User-specific Configuration Data (userdata) # features/userdata.feature:1 > As a test writer > I want to provide my own configuration data > So that the test suite and/or the environment can be adapted to its needs. > | MECHANISM: > | * Use -D name=value (--define) option to specify user data on command-line. > | * Specify user data in section "behave.userdata" of "behave.ini" > | * Load/setup user data in before_all() hook (advanced cases) > | > | USING USER DATA: > | * context.config.userdata (as dict) > | > | SUPPORTED DATA TYPES (from "behave.ini" and command-line): > | * string > | * bool-like (= "true", if definition has no value) > @setup > Scenario: Feature Setup # features/userdata.feature:20 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/pass_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > """ > And a file named "features/steps/userdata_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > from hamcrest import assert_that, equal_to > > @step('the following user-data is provided') > def step_userdata_is_provided_with_table(context): > assert context.table, "REQUIRE: table" > context.table.require_columns(["name", "value"]) > userdata = context.config.userdata > for row in context.table.rows: > name = row["name"] > expected_value = row["value"] > if name in userdata: > actual_value = userdata[name] > assert_that(str(actual_value), equal_to(expected_value)) > else: > assert False, "MISSING: userdata %s" % name > > @step('I modify the user-data with') > def step_modify_userdata_with_table(context): > assert context.table, "REQUIRE: table" > context.table.require_columns(["name", "value"]) > userdata = context.config.userdata > for row in context.table.rows: > name = row["name"] > value = row["value"] > userdata[name] = value > """ > > @userdata.define > Scenario: Use define command-line option # features/userdata.feature:61 > Given a file named "features/userdata_ex1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | person1 | Alice | > | person2 | Bob | > """ > And an empty file named "behave.ini" # behave4cmd0/command_steps.py:66 > When I run "behave -D person1=Alice --define person2=Bob features/userdata_ex1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @userdata.define > Scenario: Duplicated define with other value overrides first value # features/userdata.feature:80 > Given a file named "features/userdata_ex2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | person1 | Bob | > """ > And an empty file named "behave.ini" # behave4cmd0/command_steps.py:66 > When I run "behave -D person1=Alice -D person1=Bob features/userdata_ex2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @userdata.define > Scenario: Use boolean flag as command-line definition # features/userdata.feature:98 > Given a file named "features/userdata_ex3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | DEBUG | true | > """ > And an empty file named "behave.ini" # behave4cmd0/command_steps.py:66 > When I run "behave -D DEBUG features/userdata_ex3.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @userdata.config > Scenario: Use user-data from behave configuration file # features/userdata.feature:119 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.userdata] > person1 = Alice > person2 = Bob > """ > When I run "behave features/userdata_ex1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @userdata.config > Scenario: Override user-data from behave configuration file on command-line # features/userdata.feature:134 > Given a file named "features/userdata_config2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | person1 | Charly | > | person2 | Bob | > """ > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.userdata] > person1 = Alice > person2 = Bob > """ > When I run "behave -D person1=Charly features/userdata_config2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @userdata.config > Scenario: Extend user-data from behave configuration file on command-line # features/userdata.feature:158 > Given a file named "features/userdata_config3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | person1 | Alice | > | person2 | Bob | > | person3 | Charly | > """ > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.userdata] > person1 = Alice > person2 = Bob > """ > When I run "behave -D person3=Charly features/userdata_config3.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @userdata.load > Scenario: Load user-data configuration in before_all hook (JSON) # features/userdata.feature:183 > Given an empty file named "behave.ini" # behave4cmd0/command_steps.py:66 > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > import json > import os.path > > def before_all(context): > userdata = context.config.userdata > configfile = userdata.get("configfile", "userconfig.json") > if os.path.exists(configfile): > config = json.load(open(configfile)) > userdata.update(config) > """ > And a file named "userconfig.json" with # behave4cmd0/command_steps.py:50 > """ > { > "person1": "Anna", > "person2": "Beatrix" > } > """ > And a file named "features/userdata_load1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | person1 | Anna | > | person2 | Beatrix | > """ > When I run "behave features/userdata_load1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @userdata.load > Scenario: Load user-data configuration in before_all hook (INI) # features/userdata.feature:221 > Given a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.userdata] > configfile = userconfig.ini > config_section = behave.userdata.more > """ > And a file named "userconfig.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.userdata.more] > person1 = Anna2 > person2 = Beatrix2 > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > try: > import configparser > except: > import ConfigParser as configparser # -- PY2 > > def before_all(context): > userdata = context.config.userdata > configfile = userdata.get("configfile", "userconfig.ini") > section = userdata.get("config_section", "behave.userdata") > parser = configparser.SafeConfigParser() > parser.read(configfile) > if parser.has_section(section): > userdata.update(parser.items(section)) > """ > And a file named "features/userdata_load2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | person1 | Anna2 | > | person2 | Beatrix2 | > """ > When I run "behave features/userdata_load2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > @bad_practice @userdata.modify > Scenario: Modified user-data is used by the remaining features/scenarios # features/userdata.feature:268 > Given a file named "features/userdata_modify1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following user-data is provided: > | name | value | > | person1 | Alice | > | person2 | Bob | > When I modify the user-data with: > | name | value | > | person1 | MODIFIED_VALUE | > Then the following user-data is provided: > | name | value | > | person1 | MODIFIED_VALUE | > | person2 | Bob | > > Scenario: Next scenario has modified user-data, too > Given the following user-data is provided: > | name | value | > | person1 | MODIFIED_VALUE | > | person2 | Bob | > """ > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave.userdata] > person1 = Alice > person2 = Bob > """ > When I run "behave features/userdata_modify1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 4 steps passed, 0 failed, 0 skipped, 0 undefined > """ > But note that "modifying userdata is BAD-PRACTICE, except in before_all() hook" # behave4cmd0/note_steps.py:15 > >67 features passed, 0 failed, 0 skipped >415 scenarios passed, 0 failed, 3 skipped >1604 steps passed, 0 failed, 15 skipped, 0 undefined >Took 1m3.403s >Feature: features may have backgrounds # tools/test-features/background.feature:1 > > Background: some background stuff to run # tools/test-features/background.feature:3 > > Scenario: the stuff should be set up # tools/test-features/background.feature:7 > Given I am testing stuff # tools/test-features/steps/steps.py:11 > And some stuff is set up # tools/test-features/steps/steps.py:15 > Given stuff has been set up # tools/test-features/steps/steps.py:19 > Then it will work # tools/test-features/steps/steps.py:29 > >Fonctionnalité: testing stuff # tools/test-features/french.feature:2 > > Scénario: test stuff # tools/test-features/french.feature:4 > Etant donné I am testing stuff # tools/test-features/steps/steps.py:11 > Quand I exercise it work # tools/test-features/steps/steps.py:24 > Alors it will work # tools/test-features/steps/steps.py:29 > > Scénario: test more stuff # tools/test-features/french.feature:9 > Etant donné I am testing stuff # tools/test-features/steps/steps.py:11 > Alors it will work # tools/test-features/steps/steps.py:29 > >Feature: support scenario outlines # tools/test-features/outline.feature:1 > > Scenario Outline: run scenarios with one example table -- @1.1 some simple examples # tools/test-features/outline.feature:10 > Given Some text go # tools/test-features/steps/steps.py:33 > When we add some text ogle # tools/test-features/steps/steps.py:37 > Then we should get the google # tools/test-features/steps/steps.py:41 > > Scenario Outline: run scenarios with one example table -- @1.2 some simple examples # tools/test-features/outline.feature:11 > Given Some text onomat # tools/test-features/steps/steps.py:33 > When we add some text opoeia # tools/test-features/steps/steps.py:37 > Then we should get the onomatopoeia # tools/test-features/steps/steps.py:41 > > Scenario Outline: run scenarios with one example table -- @1.3 some simple examples # tools/test-features/outline.feature:12 > Given Some text comb # tools/test-features/steps/steps.py:33 > When we add some text ination # tools/test-features/steps/steps.py:37 > Then we should get the combination # tools/test-features/steps/steps.py:41 > > Scenario Outline: run scenarios with examples -- @1.1 some simple examples # tools/test-features/outline.feature:21 > Given Some text go # tools/test-features/steps/steps.py:33 > When we add some text ogle # tools/test-features/steps/steps.py:37 > Then we should get the google # tools/test-features/steps/steps.py:41 > > Scenario Outline: run scenarios with examples -- @1.2 some simple examples # tools/test-features/outline.feature:22 > Given Some text onomat # tools/test-features/steps/steps.py:33 > When we add some text opoeia # tools/test-features/steps/steps.py:37 > Then we should get the onomatopoeia # tools/test-features/steps/steps.py:41 > > Scenario Outline: run scenarios with examples -- @1.3 some simple examples # tools/test-features/outline.feature:23 > Given Some text comb # tools/test-features/steps/steps.py:33 > When we add some text ination # tools/test-features/steps/steps.py:37 > Then we should get the combination # tools/test-features/steps/steps.py:41 > > Scenario Outline: run scenarios with examples -- @2.1 some other examples # tools/test-features/outline.feature:27 > Given Some text 1 # tools/test-features/steps/steps.py:33 > When we add some text 2 # tools/test-features/steps/steps.py:37 > Then we should get the 12 # tools/test-features/steps/steps.py:41 > > Scenario Outline: run scenarios with examples -- @2.2 some other examples # tools/test-features/outline.feature:28 > Given Some text one # tools/test-features/steps/steps.py:33 > When we add some text two # tools/test-features/steps/steps.py:37 > Then we should get the onetwo # tools/test-features/steps/steps.py:41 > >Feature: parse stuff out of steps # tools/test-features/parse.feature:1 > > Scenario: basic parsing # tools/test-features/parse.feature:3 > Given a string with an argument # tools/test-features/steps/steps.py:106 > Then we get "with" parsed # tools/test-features/steps/steps.py:117 > > Scenario: custom type parsing # tools/test-features/parse.feature:7 > Given a string with a custom type # tools/test-features/steps/steps.py:113 > Then we get "WITH" parsed # tools/test-features/steps/steps.py:117 > >Feature: steps may have associated data # tools/test-features/step-data.feature:1 > > Scenario: step with text # tools/test-features/step-data.feature:3 > Given some body of text # tools/test-features/steps/steps.py:45 > """ > Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed > do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut > enim ad minim veniam, quis nostrud exercitation ullamco laboris > nisi ut aliquip ex ea commodo consequat. > """ > Then the text is as expected # tools/test-features/steps/steps.py:54 > > Scenario: step with a table # tools/test-features/step-data.feature:13 > Given some initial data # tools/test-features/steps/steps.py:59 > | name | department | > | Barry | Beer Cans | > | Pudey | Silly Walks | > | Two-Lumps | Silly Walks | > Then we will have the expected data # tools/test-features/steps/steps.py:69 > > Scenario Outline: step with text and subtitution -- @1.1 # tools/test-features/step-data.feature:44 > Given some body of text # tools/test-features/steps/steps.py:45 > """ > Lorem spam dolor sit amet, consectetur adipisicing elit, sed > do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut > enim ad minim veniam, quis nostrud exercitation ullamco laboris > nisi ut aliquip ex ea commodo consequat. > """ > Then the text is substituted as expected # tools/test-features/steps/steps.py:76 > > Scenario Outline: step with text and subtitution -- @1.2 # tools/test-features/step-data.feature:45 > Given some body of text # tools/test-features/steps/steps.py:45 > """ > Lorem ham dolor sit amet, consectetur adipisicing elit, sed > do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut > enim ad minim veniam, quis nostrud exercitation ullamco laboris > nisi ut aliquip ex ea commodo consequat. > """ > Then the text is substituted as expected # tools/test-features/steps/steps.py:76 > > Scenario Outline: step with a table and substution -- @1.1 # tools/test-features/step-data.feature:58 > Given some initial data # tools/test-features/steps/steps.py:59 > | name | department | > | Barry | spam Cans | > | Pudey | Silly Walks | > | Two-Lumps | Silly Walks | > Then we will have the substituted data # tools/test-features/steps/steps.py:88 > > Scenario Outline: step with a table and substution -- @1.2 # tools/test-features/step-data.feature:59 > Given some initial data # tools/test-features/steps/steps.py:59 > | name | department | > | Barry | ham Cans | > | Pudey | Silly Walks | > | Two-Lumps | Silly Walks | > Then we will have the substituted data # tools/test-features/steps/steps.py:88 > >@spam >Feature: handle tags # tools/test-features/tags.feature:2 > Tags may be set at various levels in various ways. > Scenario: nothing changes # tools/test-features/tags.feature:5 > Given the tag "spam" is set # tools/test-features/steps/steps.py:96 > > @ham @cram > Scenario: adding the ham # tools/test-features/tags.feature:9 > Given the tag "spam" is set # tools/test-features/steps/steps.py:96 > And the tag "ham" is set # tools/test-features/steps/steps.py:96 > And the tag "cram" is set # tools/test-features/steps/steps.py:96 > > @ham > Scenario: adding the ham # tools/test-features/tags.feature:15 > Given the tag "spam" is set # tools/test-features/steps/steps.py:96 > And the tag "ham" is set # tools/test-features/steps/steps.py:96 > And the tag "cram" is not set # tools/test-features/steps/steps.py:102 > >6 features passed, 0 failed, 0 skipped >22 scenarios passed, 0 failed, 2 skipped >56 steps passed, 0 failed, 5 skipped, 0 undefined >Took 0m0.007s >@issue >Feature: Issue #30 "behave --version" runs features and shows no version # issue.features/issue0030.feature:2 > > Scenario: Ensure environment assumptions are correct (Sanity Check) # issue.features/issue0030.feature:4 > Given a new working directory # behave4cmd0/command_steps.py:30 > When I run "behave" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > No steps directory in "{__WORKDIR__}/features" > """ > > Scenario: Ensure --version option is processed correctly # issue.features/issue0030.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > When I run "behave --version" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > No steps directory in "{__WORKDIR__}/features" > """ > >@issue >Feature: Issue #31 "behave --format help" raises an error # issue.features/issue0031.feature:2 > > Scenario: # issue.features/issue0031.feature:4 > Given a new working directory # behave4cmd0/command_steps.py:30 > When I run "behave --format=help" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Available formatters: > json JSON dump of test run > json.pretty JSON dump of test run (human readable) > null Provides formatter that does not output anything. > plain Very basic formatter with maximum compatibility > pretty Standard colourised pretty formatter > """ > >@issue >Feature: Issue #32 "behave --junit-directory=xxx" fails if more than 1 level must be created # issue.features/issue0032.feature:2 > > Scenario: # issue.features/issue0032.feature:4 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'passing') > def step(context): > pass > """ > And a file named "features/issue32_1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: One > Scenario: One > Given passing > """ > When I run "behave --junit --junit-directory=report/test_results" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > And the directory "report/test_results" should exist # behave4cmd0/command_steps.py:295 > >@issue >Feature: Issue #35 Plain Formatter shows wrong steps when tag-selection is used # issue.features/issue0035.feature:2 > > Background: Test Setup # issue.features/issue0035.feature:4 > > Scenario: Select First Scenario with Tag # issue.features/issue0035.feature:39 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'the ninja has a third level black-belt') > def step(context): > pass > > @when(u'attacked by {opponent}') > def step(context, opponent): > pass > > @then(u'the ninja should {reaction}') > def step(context, reaction): > pass > """ > And a file named "features/issue35_1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Using Tags with Features and Scenarios > > @one > Scenario: Weaker opponent > Given the ninja has a third level black-belt > When attacked by a samurai > Then the ninja should engage the opponent > > @two > Scenario: Stronger opponent > Given the ninja has a third level black-belt > When attacked by Chuck Norris > Then the ninja should run for his life > """ > When I run "behave --no-timings -f plain --tags=@one features/issue35_1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 1 skipped > 3 steps passed, 0 failed, 3 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Using Tags with Features and Scenarios > Scenario: Weaker opponent > Given the ninja has a third level black-belt ... passed > When attacked by a samurai ... passed > Then the ninja should engage the opponent ... passed > Scenario: Stronger opponent > """ > > Scenario: Select Second Scenario with Tag # issue.features/issue0035.feature:57 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'the ninja has a third level black-belt') > def step(context): > pass > > @when(u'attacked by {opponent}') > def step(context, opponent): > pass > > @then(u'the ninja should {reaction}') > def step(context, reaction): > pass > """ > And a file named "features/issue35_1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Using Tags with Features and Scenarios > > @one > Scenario: Weaker opponent > Given the ninja has a third level black-belt > When attacked by a samurai > Then the ninja should engage the opponent > > @two > Scenario: Stronger opponent > Given the ninja has a third level black-belt > When attacked by Chuck Norris > Then the ninja should run for his life > """ > When I run "behave --no-timings -f plain --tags=@two features/issue35_1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 1 skipped > 3 steps passed, 0 failed, 3 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Using Tags with Features and Scenarios > Scenario: Weaker opponent > Scenario: Stronger opponent > Given the ninja has a third level black-belt ... passed > When attacked by Chuck Norris ... passed > Then the ninja should run for his life ... passed > """ > >@issue >Feature: Issue #40 Test Summary Scenario/Step Counts are incorrect for Scenario Outline # issue.features/issue0040.feature:2 > As I user > I want that each passed and each failed scenario is counted > And I want that each passed and failed step in a ScenarioOutline is counted > Background: Test Setup # issue.features/issue0040.feature:8 > > Scenario: ScenarioOutline with Passing Steps # issue.features/issue0040.feature:30 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > context.name = name > assert outcome == "passes" > > @when(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > > @then(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > """ > Given a file named "features/issue40_1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Verify Scenario/Step Summary Pass Count with ScenarioOutline > Scenario Outline: > Given a step passes with "<name>" > When a step passes with "<name>" > Then a step passes with "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue40_1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: ScenarioOutline with Failing Given-Steps # issue.features/issue0040.feature:51 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > context.name = name > assert outcome == "passes" > > @when(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > > @then(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > """ > Given a file named "features/issue40_2G.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Scenario/Step Summary Pass/Fail Count with ScenarioOutline > Scenario Outline: > Given a step fails with "<name>" > When a step passes with "<name>" > Then a step passes with "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue40_2G.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 0 steps passed, 2 failed, 4 skipped, 0 undefined > """ > > Scenario: ScenarioOutline with Failing When-Steps # issue.features/issue0040.feature:72 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > context.name = name > assert outcome == "passes" > > @when(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > > @then(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > """ > Given a file named "features/issue40_2W.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Scenario/Step Summary Pass/Fail Count with ScenarioOutline > Scenario Outline: > Given a step passes with "<name>" > When a step fails with "<name>" > Then a step passes with "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue40_2W.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 2 skipped, 0 undefined > """ > > Scenario: ScenarioOutline with Failing Then-Steps # issue.features/issue0040.feature:93 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > context.name = name > assert outcome == "passes" > > @when(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > > @then(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > """ > Given a file named "features/issue40_2T.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Scenario/Step Summary Pass/Fail Count with ScenarioOutline > Scenario Outline: > Given a step passes with "<name>" > When a step passes with "<name>" > Then a step fails with "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue40_2T.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 4 steps passed, 2 failed, 0 skipped, 0 undefined > """ > > Scenario: ScenarioOutline with Mismatched When-Step Example Row # issue.features/issue0040.feature:114 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > context.name = name > assert outcome == "passes" > > @when(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > > @then(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > """ > Given a file named "features/issue40_3W.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Scenario/Step Summary Pass/Fail Count with ScenarioOutline > Scenario Outline: > Given a step passes with "<name>" > When a step passes with "Alice" > Then a step passes with "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue40_3W.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 4 steps passed, 1 failed, 1 skipped, 0 undefined > """ > > Scenario: ScenarioOutline with Mismatched Then-Step Example Row # issue.features/issue0040.feature:135 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > context.name = name > assert outcome == "passes" > > @when(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > > @then(u'a step {outcome} with "{name}"') > def step(context, outcome, name): > assert outcome == "passes" > assert context.name == name > """ > Given a file named "features/issue40_3W.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Scenario/Step Summary Pass/Fail Count with ScenarioOutline > Scenario Outline: > Given a step passes with "<name>" > When a step passes with "<name>" > Then a step passes with "Alice" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue40_3W.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 5 steps passed, 1 failed, 0 skipped, 0 undefined > """ > >@issue >Feature: Issue #41 Missing Steps are duplicated in a Scenario Outline # issue.features/issue0041.feature:2 > As I user > I want that missing steps are reported only once. > Background: Test Setup # issue.features/issue0041.feature:7 > > Scenario: Missing Given Step # issue.features/issue0041.feature:26 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue41_missing1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing Given-Step in a Scenario Outline > Scenario Outline: > Given an unknown step > When I enter a "<name>" > Then the name is "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue41_missing1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 steps passed, 0 failed, 4 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @given(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Given an unknown step') > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > You can implement step definitions for undefined steps with these snippets: > @given(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Given an unknown step') > @given(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Given an unknown step') > """ > > Scenario: Missing When Step # issue.features/issue0041.feature:63 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue41_missing2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing When-Step in a Scenario Outline > Scenario Outline: > Given I enter a "<name>" > When I use an unknown step > Then the name is "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue41_missing2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 2 steps passed, 0 failed, 2 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @when(u'I use an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When I use an unknown step') > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > You can implement step definitions for undefined steps with these snippets: > @when(u'I use an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When I use an unknown step') > @when(u'I use an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When I use an unknown step') > """ > > Scenario: Missing Then Step # issue.features/issue0041.feature:100 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue41_missing3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing Then-Step in a Scenario Outline > Scenario Outline: > Given I enter a "<name>" > When I enter a "<name>" > Then I use an unknown step > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c -f plain features/issue41_missing3.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 4 steps passed, 0 failed, 0 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @then(u'I use an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Then I use an unknown step') > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > You can implement step definitions for undefined steps with these snippets: > @then(u'I use an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Then I use an unknown step') > @then(u'I use an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Then I use an unknown step') > """ > >@issue >Feature: Issue #42 Nice to have snippets for all unimplemented steps taking into account of the tags fltering # issue.features/issue0042.feature:2 > As a user > I want that all undefined steps are reported, > not only just the first one in a scenario. > In addition, all known steps after the first undefined step in a scenario > should be marked as skipped (even failing ones). > Background: Test Setup # issue.features/issue0042.feature:12 > > Scenario: One undefined step in a scenario # issue.features/issue0042.feature:31 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue42_missing1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing Given-Step in a Scenario > Scenario: > Given an unknown step > When I enter a "Alice" > Then the name is "Alice" > """ > When I run "behave -f plain features/issue42_missing1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 steps passed, 0 failed, 2 skipped, 1 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @given(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Given an unknown step') > """ > > Scenario: Two undefined steps in a scenario # issue.features/issue0042.feature:53 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue42_missing2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing Given and When steps in a Scenario > Scenario: > Given an unknown step > When another unknown step > And I enter a "Alice" > Then the name is "Alice" > """ > When I run "behave -f plain features/issue42_missing2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 steps passed, 0 failed, 2 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @given(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Given an unknown step') > > @when(u'another unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When another unknown step') > """ > > Scenario: Two undefined steps in the middle with passing steps # issue.features/issue0042.feature:80 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue42_missing3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing 2 When steps after passing step > Scenario: > When I enter a "Alice" > And an unknown step > And another unknown step > Then the name is "Alice" > """ > When I run "behave -f plain features/issue42_missing3.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 step passed, 0 failed, 1 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @when(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When an unknown step') > > @when(u'another unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When another unknown step') > """ > > Scenario: Undefined steps are detected if they occur after a failing step # issue.features/issue0042.feature:107 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue42_missing4.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing 2 When steps after passing step > Scenario: > When I enter a "Alice" > Then the name is "Bob" > And an unknown step > And another unknown step > """ > When I run "behave -f plain features/issue42_missing4.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 step passed, 1 failed, 0 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @then(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Then an unknown step') > > @then(u'another unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Then another unknown step') > """ > > Scenario: Failing step after first undefined step should be marked as skipped # issue.features/issue0042.feature:134 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue42_missing4.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing 2 When steps after passing step > Scenario: > When I enter a "Alice" > And an unknown step > Then the name is "Bob" > And another unknown step > """ > When I run "behave -f plain features/issue42_missing4.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 step passed, 0 failed, 1 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @when(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When an unknown step') > > @then(u'another unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Then another unknown step') > """ > > Scenario: Two undefined steps in scenario outline # issue.features/issue0042.feature:161 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue42_missing5.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing Given and When Step in a Scenario Outline > Scenario Outline: > Given an unknown step > When another unknown step > And I enter a "<name>" > Then the name is "<name>" > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -f plain features/issue42_missing5.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 steps passed, 0 failed, 4 skipped, 4 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @given(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: Given an unknown step') > > @when(u'another unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When another unknown step') > """ > > Scenario: Two undefined steps and run with tags # issue.features/issue0042.feature:193 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @when(u'I enter a "{name}"') > def step(context, name): > context.name = name > > @then(u'the name is "{name}"') > def step(context, name): > assert context.name == name > """ > Given a file named "features/issue42_missing6.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Missing steps in tagged scenarios > @tag1 > Scenario: > When I enter a "Alice" > And an unknown step > Then the name is "Bob" > > @tag1 > Scenario: > When I enter a "Alice" > And another unknown step > Then the name is "Bob" > > @another_tag > Scenario: > When I enter a "Alice" > And yet another unknown step > Then the name is "Bob" > """ > When I run "behave -f plain --tags tag1 features/issue42_missing6.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 2 steps passed, 0 failed, 5 skipped, 2 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > @when(u'an unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When an unknown step') > > @when(u'another unknown step') > def step_impl(context): > raise NotImplementedError(u'STEP: When another unknown step') > """ > >@issue >Feature: Issue #44 Shell-like comments are removed in Multiline Args # issue.features/issue0044.feature:2 > As I user > I want that multiline arguments (docstrings) contents are preserved. > Background: Test Setup # issue.features/issue0044.feature:7 > > Scenario: Ensure shell comment lines are not filtered out in multiline text # issue.features/issue0044.feature:23 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > from hamcrest import assert_that, equal_to > > @given(u'a multiline text argument with') > def step(context): > context.expected_text = context.text > > @then(u'the multiline text argument should be') > def step(context): > assert_that(context.text, equal_to(context.expected_text)) > """ > Given a file named "features/issue44_test.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Multiline text with shell comment lines > Scenario: > Given a multiline text argument with: > \"\"\" > Lorem ipsum. > # THIS IS A SHELL COMMENT. > Ipsum lorem. > \"\"\" > Then the multiline text argument should be: > \"\"\" > Lorem ipsum. > # THIS IS A SHELL COMMENT. > Ipsum lorem. > \"\"\" > """ > When I run "behave -c -f pretty features/issue44_test.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > # THIS IS A SHELL COMMENT. > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Lorem ipsum. > Ipsum lorem. > """ > >@issue >Feature: Issue #46 Behave returns 0 (SUCCESS) even in case of test failures # issue.features/issue0046.feature:2 > As I behave user > I want to detect test success or test failures > By using the process return value, 0 (SUCCESS) and non-zero for failure. > Background: Test Setup # issue.features/issue0046.feature:8 > > Scenario: Successful Execution # issue.features/issue0046.feature:23 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/passing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Passing > Scenario: Passing Scenario Example > Given passing > """ > When I run "behave -c -q features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Failing Execution # issue.features/issue0046.feature:38 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/failing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Failing > Scenario: Failing Scenario Example > Given failing > """ > When I run "behave -c -q features/failing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > > Scenario: Passing and Failing Execution # issue.features/issue0046.feature:53 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/passing_and_failing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Passing and Failing > Scenario: Passing Scenario Example > Given passing > Scenario: Failing Scenario Example > Given failing > """ > When I run "behave -c -q features/passing_and_failing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Passing and Failing > Scenario: Passing Scenario Example > Given passing > Scenario: Failing Scenario Example > Given failing > Assertion Failed: failing > """ > >@issue >Feature: Issue #52 Summary counts are wrong with option --tags # issue.features/issue0052.feature:2 > Wrong summary counts are shown for skipped and failed scenarios > when option --tags=done is used (and some scenarios are skipped). > Background: Test Setup # issue.features/issue0052.feature:8 > > Scenario: Successful Execution of Tagged Scenario # issue.features/issue0052.feature:23 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/tagged_scenario1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Passing tagged Scenario > @done > Scenario: P1 > Given passing > > @unimplemented > Scenario: N1 > Given passing > @unimplemented > Scenario: N2 > Given passing > """ > When I run "behave --junit -c --tags @done features/tagged_scenario1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 2 skipped > """ > > Scenario: Failing Execution of Tagged Scenario # issue.features/issue0052.feature:45 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/tagged_scenario2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Failing tagged Scenario > @done > Scenario: F1 > Given failing > > @unimplemented > Scenario: N1 > Given passing > @unimplemented > Scenario: N2 > Given passing > """ > When I run "behave --junit -c --tags @done features/tagged_scenario2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 2 skipped > """ > >@issue >Feature: Issue #59 Fatal error when using --format=json # issue.features/issue0059.feature:2 > Using the JSON formatter caused a fatal error. > Background: Test Setup # issue.features/issue0059.feature:6 > > Scenario: Use the JSONFormatter # issue.features/issue0059.feature:23 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > """ > And a file named "features/issue59_test.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Passing tagged Scenario > Scenario: P1 > Given passing > """ > When I run "behave --format=json features/issue59_test.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > >@issue >Feature: Issue #63: 'ScenarioOutline' object has no attribute 'stdout' # issue.features/issue0063.feature:2 > The problem occurs when "behave --junit ..." is used > And a feature contains one or more ScenarioOutline(s). > Background: Test Setup # issue.features/issue0063.feature:7 > > Scenario: ScenarioOutline with Passing Steps # issue.features/issue0063.feature:38 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -- OMIT: from __future__ import print_function > from behave import given > import sys > > def generate_output(step, outcome, name): > # -- OMIT: print("{0}0 {1}: {2};".format(step, outcome, name)) > sys.stdout.write("{0}1 {1}: {2};\n".format(step, outcome, name)) > sys.stderr.write("{0}2 {1}: {2};\n".format(step, outcome, name)) > > @given(u'a {outcome} step with "{name}"') > def step(context, outcome, name): > context.name = name > generate_output("Given", outcome, name) > assert outcome == "passing" > > @when(u'a {outcome} step with "{name}" occurs') > def step(context, outcome, name): > generate_output("When", outcome, name) > assert outcome == "passing" > > @then(u'a {outcome} step with "{name}" is reached') > def step(context, outcome, name): > generate_output("Then", outcome, name) > assert outcome == "passing" > assert context.name == name > """ > Given a file named "features/issue63_case1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: ScenarioOutline with Passing Steps > Scenario Outline: > Given a passing step with "<name>" > When a passing step with "<name>" occurs > Then a passing step with "<name>" is reached > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c --junit features/issue63_case1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > AttributeError: 'ScenarioOutline' object has no attribute 'stdout' > """ > > Scenario: ScenarioOutline with Passing and Failing Steps # issue.features/issue0063.feature:63 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -- OMIT: from __future__ import print_function > from behave import given > import sys > > def generate_output(step, outcome, name): > # -- OMIT: print("{0}0 {1}: {2};".format(step, outcome, name)) > sys.stdout.write("{0}1 {1}: {2};\n".format(step, outcome, name)) > sys.stderr.write("{0}2 {1}: {2};\n".format(step, outcome, name)) > > @given(u'a {outcome} step with "{name}"') > def step(context, outcome, name): > context.name = name > generate_output("Given", outcome, name) > assert outcome == "passing" > > @when(u'a {outcome} step with "{name}" occurs') > def step(context, outcome, name): > generate_output("When", outcome, name) > assert outcome == "passing" > > @then(u'a {outcome} step with "{name}" is reached') > def step(context, outcome, name): > generate_output("Then", outcome, name) > assert outcome == "passing" > assert context.name == name > """ > Given a file named "features/issue63_case2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: ScenarioOutline with Passing and Failing Steps > Scenario Outline: > Given a passing step with "<name>" > When a failing step with "<name>" occurs > Then a passing step with "<name>" is reached > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c --junit features/issue63_case2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 2 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > AttributeError: 'ScenarioOutline' object has no attribute 'stdout' > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > AttributeError: 'Scenario' object has no attribute 'exception' > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stdout: > Given1 passing: Alice; > When1 failing: Alice; > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stderr: > Given2 passing: Alice; > When2 failing: Alice; > """ > >@issue >Feature: Issue #64 Exit status not set to 1 even there are failures in certain cases # issue.features/issue0064.feature:2 > The behave exit status not always returns 1 when failure(s) occur. > The problem was associated with the Feature.run() logic implementation. > This problem was first discovered while verifying issue #52 (see comments). > See also similar test when tags select a subset of scenarios. > RELATED ISSUES: > * issue #52 > Background: Test Setup # issue.features/issue0064.feature:13 > > Scenario: Failing in First Scenario # issue.features/issue0064.feature:28 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/issue64_case1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Failing in First Scenario > Scenario: > Given failing > > Scenario: > Given passing > """ > When I run "behave --format=plain features/issue64_case1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped > """ > > Scenario: Failing in Middle Scenario # issue.features/issue0064.feature:45 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/issue64_case2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Failing in Middle Scenario > Scenario: > Given passing > Scenario: > Given failing > Scenario: > Given passing > """ > When I run "behave --format=plain features/issue64_case2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 2 scenarios passed, 1 failed, 0 skipped > """ > > Scenario: Failing in Last Scenario # issue.features/issue0064.feature:63 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/issue64_case3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Failing in Last Scenario > Scenario: > Given passing > Scenario: > Given passing > Scenario: > Given failing > """ > When I run "behave --format=plain features/issue64_case3.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 2 scenarios passed, 1 failed, 0 skipped > """ > > Scenario: Failing in First and Last Scenario # issue.features/issue0064.feature:81 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'passing') > def step(context): > pass > > @given(u'failing') > def step(context): > assert False, "failing" > """ > Given a file named "features/issue64_case4.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Failing in First and Last Scenario > Scenario: > Given failing > Scenario: > Given passing > Scenario: > Given failing > """ > When I run "behave --format=plain features/issue64_case4.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 1 scenario passed, 2 failed, 0 skipped > """ > >@issue >Feature: Issue #65 Unrecognized --tag-help argument # issue.features/issue0065.feature:2 > The "behave --help" output refers to the option "--tag-help" > in the description of the "--tags" option. > The correct option for more help on tags is "--tags-help". > Scenario: Ensure environment assumptions are correct (Sanity Check) # issue.features/issue0065.feature:8 > Given a new working directory # behave4cmd0/command_steps.py:30 > When I run "behave --help" # behave4cmd0/command_steps.py:80 > Then the command output should contain # behave4cmd0/command_steps.py:227 > """ > --tags-help > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > --tag-help > """ > >@issue >Feature: Issue #66: context.text and context.table are not cleared # issue.features/issue0066.feature:2 > I noticed that context.table and context.text survive after the step is finished. > Background: Test Setup # issue.features/issue0066.feature:7 > > Scenario: Ensure multiline text data is cleared for next step # issue.features/issue0066.feature:43 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > from hamcrest import assert_that, equal_to, is_not, is_, none > import six > > @given(u'a step with multiline text') > def step(context): > assert context.text is not None > assert context.text, "Ensure non-empty" > assert isinstance(context.text, six.string_types) > > @given(u'a step with a table') > def step(context): > assert context.table is not None > > @when(u'I check the "context.{name}" attribute') > def step(context, name): > context.name = name > context.value = getattr(context, name, None) > > @then(u'its value is None') > def step(context): > assert_that(context.value, is_(none())) > > @then(u'its value is "{value}"') > def step(context, value): > assert_that(context.value, equal_to(value)) > > @then(u'its value is not "{value}"') > def step(context, value): > assert_that(value, is_not(equal_to(context.value))) > """ > Given a file named "features/issue66_case1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step with multiline text: > ''' > Alice, Bob and Charly > ''' > When I check the "context.text" attribute > Then its value is not "Alice, Bob and Charly" > But its value is None > """ > When I run "behave -f plain features/issue66_case1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 4 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Ensure table data is cleared for next step # issue.features/issue0066.feature:63 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > from hamcrest import assert_that, equal_to, is_not, is_, none > import six > > @given(u'a step with multiline text') > def step(context): > assert context.text is not None > assert context.text, "Ensure non-empty" > assert isinstance(context.text, six.string_types) > > @given(u'a step with a table') > def step(context): > assert context.table is not None > > @when(u'I check the "context.{name}" attribute') > def step(context, name): > context.name = name > context.value = getattr(context, name, None) > > @then(u'its value is None') > def step(context): > assert_that(context.value, is_(none())) > > @then(u'its value is "{value}"') > def step(context, value): > assert_that(context.value, equal_to(value)) > > @then(u'its value is not "{value}"') > def step(context, value): > assert_that(value, is_not(equal_to(context.value))) > """ > Given a file named "features/issue66_case2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step with a table: > | name | gender | > | Alice | female | > | Bob | male | > When I check the "context.table" attribute > Then its value is None > """ > When I run "behave -f plain features/issue66_case2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >@issue >Feature: Issue #67: JSON formatter cannot serialize tables. # issue.features/issue0067.feature:2 > The JSON formatter cannot handle tables (currently): > * Table as setup/intermediate/result table in steps of scenario > * Examples tables in a ScenarioOutline > A JSON exception occurs when such a feature file should be processed. > Scenario: Scenario with Tables # issue.features/issue0067.feature:12 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps1.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I add the following employees') > def step(context): > pass # -- SKIP: Table processing here. > > @when(u'I select department "{department}"') > def step(context, department): > context.department = department > > @then(u'I get the following employees') > def step(context): > pass # -- SKIP: Table processing here. > """ > And a file named "features/issue67_case1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Scenario with Tables > Scenario: > Given I add the following employees: > | name | department | > | Alice | Wonderland | > | Bob | Moonwalk | > When I select department "Wonderland" > Then I get the following employees: > | name | department | > | Alice | Wonderland | > """ > When I run "behave -f json features/issue67_case1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > TypeError: <Row [u'Alice', u'Wonderland']> is not JSON serializable > """ > > Scenario: ScenarioOutline with Examples Table # issue.features/issue0067.feature:54 > Given a file named "features/steps/steps2.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step with "{name}"') > def step(context, name): > context.name = name > > @when(u'a step with "{name}" occurs') > def step(context, name): > assert context.name == name > > @then(u'a step with "{name}" is reached') > def step(context, name): > assert context.name == name > """ > And a file named "features/issue67_case2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: ScenarioOutline with Examples Table > Scenario Outline: > Given a step with "<name>" > When a step with "<name>" occurs > Then a step with "<name>" is reached > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -f json features/issue67_case2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >@issue >Feature: Issue #69: JUnitReporter: Fault when processing ScenarioOutlines with failing steps # issue.features/issue0069.feature:2 > The problem occurs when "behave --junit ..." is used > And a feature contains one or more ScenarioOutline(s) with failing steps. > The JUnitReport does not process ScenarioOutline correctly (logic-error). > Therefore, Scenarios of a ScenarioOutline are processes as Scenario steps. > This causes problems when the step.status is "failed". > RELATED: > * issue #63 > Background: Test Setup # issue.features/issue0069.feature:14 > > Scenario: ScenarioOutline with Failing Steps # issue.features/issue0069.feature:36 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'a {outcome} step with "{name}"') > def step(context, outcome, name): > context.name = name > assert outcome == "passing" > > @when(u'a {outcome} step with "{name}" occurs') > def step(context, outcome, name): > assert outcome == "passing" > assert context.name == name > > @then(u'a {outcome} step with "{name}" is reached') > def step(context, outcome, name): > assert outcome == "passing" > assert context.name == name > """ > Given a file named "features/issue63_case2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: ScenarioOutline with Passing and Failing Steps > Scenario Outline: > Given a passing step with "<name>" > When a failing step with "<name>" occurs > Then a passing step with "<name>" is reached > > Examples: > |name | > |Alice| > |Bob | > """ > When I run "behave -c --junit features/issue63_case2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 2 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > AttributeError: 'Scenario' object has no attribute 'exception' > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > behave/reporter/junit.py > """ > >@issue >Feature: Issue #72: Using 'GHERKIN_COLORS' fails with Exception # issue.features/issue0072.feature:2 > > Trying: GHERKIN_COLORS=executing=white behave > > It fails: > > > > Traceback (most recent call last): > > ... > > File "/.../behave/formatter/ansi_escapes.py", line 38, in <module> > > escapes[alias] = ''.join([colors[c] for c in aliases[alias].split(',')]) > > TypeError: list indices must be integers, not str > > > > The reason is that the global variable colors is defined twice in this module. > > The second variable overrides/modifies the first (without intention). > Scenario: Using GHERKIN_COLORS in new working dir # issue.features/issue0072.feature:17 > Given a new working directory # behave4cmd0/command_steps.py:30 > And I set the environment variable "GHERKIN_COLORS" to "executing=white" # behave4cmd0/command_steps.py:414 > When I run "behave" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > No steps directory in "{__WORKDIR__}/features" > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Traceback (most recent call last): > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > TypeError: list indices must be integers, not str > """ > >@issue >Feature: Issue #73: the current_matcher is not predictable # issue.features/issue0073.feature:2 > | behave provides 2 matchers: ParseMatcher (parse) and RegexpMatcher (re). > | The ParseMatcher is used per default when the test runner starts. > | > | A step definition file may change the matcher several times > | by calling `use_step_matcher("re")` or `use_step_matcher("parse")`. > | In order to make the writing of step definitions more predictable, > | the matcher should be reset to the default matcher > | before loading each step definition. > | > | A project can define its own default matcher by calling the > | `use_step_matcher(...)` in the "environment.py" hook. > | This matcher will be used as default before a step definition is loaded. > Scenario: Verify that ParseMatcher is the default matcher # issue.features/issue0073.feature:18 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/parse_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step {outcome:w}') > def step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/passing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step passes > Then a step passes > """ > When I run "behave -f plain features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Use only RegexMatcher in Step Definitions # issue.features/issue0073.feature:44 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import use_step_matcher > use_step_matcher("re") > """ > And a file named "features/steps/regexp_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step (?P<outcome>passes|fails)') > def step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/passing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step passes > Then a step passes > """ > When I run "behave -f plain features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Use ParseMatcher and RegexMatcher in Step Definitions (default=re) # issue.features/issue0073.feature:75 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import use_step_matcher > use_step_matcher("re") > """ > And a file named "features/steps/eparse_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, use_step_matcher > use_step_matcher("parse") > > @step(u'an extraordinary step {outcome:w}') > def step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/steps/regexp_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step (?P<outcome>passes|fails)') > def step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/steps/xparse_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, use_step_matcher > use_step_matcher("parse") > > @step(u'another step {outcome:w}') > def step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/passing3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When another step passes > Then an extraordinary step passes > """ > When I run "behave -f plain features/passing3.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Mix ParseMatcher and RegexMatcher in Step Definitions (default=re) # issue.features/issue0073.feature:124 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import use_step_matcher > use_step_matcher("re") > """ > And a file named "features/steps/given_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, use_step_matcher > > use_step_matcher("parse") > @given(u'a step {outcome:w}') > def given_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > > use_step_matcher("re") > @given(u'another step (?P<outcome>passes|fails)') > def given_another_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > > use_step_matcher("parse") > @given(u'an extraordinary step {outcome:w}') > def given_extraordinary_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/steps/when_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, use_step_matcher > > @when(u'a step (?P<outcome>passes|fails)') > def when_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > > use_step_matcher("parse") > @when(u'another step {outcome:w}') > def when_another_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > > use_step_matcher("re") > @when(u'an extraordinary step (?P<outcome>passes|fails)') > def when_extraordinary_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/steps/then_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, use_step_matcher > > use_step_matcher("parse") > @then(u'a step {outcome:w}') > def then_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > > use_step_matcher("re") > @then(u'another step (?P<outcome>passes|fails)') > def then_another_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > > use_step_matcher("parse") > @then(u'an extraordinary step {outcome:w}') > def then_extraordinary_step_passes(context, outcome): > assert outcome == "passes", "FAIL: outcome={0}".format(outcome) > """ > And a file named "features/passing3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: 1 > Given a step passes > When another step passes > Then an extraordinary step passes > > Scenario: 2 > Given another step passes > When an extraordinary step passes > Then a step passes > > Scenario: 3 > Given an extraordinary step passes > When a step passes > Then another step passes > """ > When I run "behave -c -f pretty --no-timings features/passing3.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 3 scenarios passed, 0 failed, 0 skipped > 9 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: # features/passing3.feature:1 > Scenario: 1 # features/passing3.feature:2 > Given a step passes # features/steps/given_steps.py:4 > When another step passes # features/steps/when_steps.py:8 > Then an extraordinary step passes # features/steps/then_steps.py:14 > > Scenario: 2 # features/passing3.feature:7 > Given another step passes # features/steps/given_steps.py:9 > When an extraordinary step passes # features/steps/when_steps.py:13 > Then a step passes # features/steps/then_steps.py:4 > > Scenario: 3 # features/passing3.feature:12 > Given an extraordinary step passes # features/steps/given_steps.py:14 > When a step passes # features/steps/when_steps.py:3 > Then another step passes # features/steps/then_steps.py:9 > """ > >@issue >Feature: Issue #75: behave @features_from_text_file does not work # issue.features/issue0075.feature:2 > | Feature of Cucumber. Reading the source code, I see it partly implemented. > | > | $ behave @list_of_features.txt > | https://github.com/jeamland/behave/blob/master/behave/runner.py#L416:L430 > | > | However it fails because: > | * it does not remove the @ from the path > | * it does not search the steps/ directory in the parents of the feature files themselves > @reuse.colocated_test > Scenario: Use feature listfile # issue.features/issue0075.feature:15 > Given I use the current directory as working directory # behave4cmd0/command_steps.py:39 > When I run "behave -f plain features/runner.feature_listfile.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > >@issue >Feature: Issue #77: Does not capture stdout from sub-processes # issue.features/issue0077.feature:2 > | My step functions are using wrapper objects to interact with SUT. > | Those wrappers use this kind of thing to invoke executables: > | > | subprocess.check_call('myprog', ..., stderr=subprocess.STDOUT) > | > | However, the output from those calls does not appear in the stdout > | captured by behave when a step fails. > Background: Test Setup # issue.features/issue0077.feature:13 > > Scenario: Subprocess call shows generated output # issue.features/issue0077.feature:55 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "hello.py" with # behave4cmd0/command_steps.py:50 > """ > import sys > > def hello(): > result = 0 > args = sys.argv[1:] > if args and args[0].startswith("--fail"): > result = 1 > args = args[1:] > message = " ".join(args) > sys.stdout.write("Hello {0}\n".format(message)) > sys.exit(result) > > if __name__ == "__main__": > hello() > """ > And a file named "features/steps/subprocess_call_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > import subprocess > import os.path > import sys > > PYTHON = sys.executable > HERE = os.path.dirname(__file__) > > @when(u'I make a subprocess call "hello {commandline}"') > def step(context, commandline): > result = subprocess_call_hello(commandline.split()) > assert result == 0 > > def subprocess_call_hello(args): > command_args = [ PYTHON, "hello.py" ] + args > result = subprocess.check_call(command_args, stderr=subprocess.STDOUT) > return result > # result = subprocess.check_output(command_args, stderr=subprocess.STDOUT) > # return result > """ > Given a file named "features/issue77_hello_OK.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When I make a subprocess call "hello world." > """ > When I run "behave -f plain features/issue77_hello_OK.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Hello world. > """ > > Scenario: Subprocess call fails with captured output # issue.features/issue0077.feature:73 > Given a new working directory # behave4cmd0/command_steps.py:30 > Given a file named "hello.py" with # behave4cmd0/command_steps.py:50 > """ > import sys > > def hello(): > result = 0 > args = sys.argv[1:] > if args and args[0].startswith("--fail"): > result = 1 > args = args[1:] > message = " ".join(args) > sys.stdout.write("Hello {0}\n".format(message)) > sys.exit(result) > > if __name__ == "__main__": > hello() > """ > And a file named "features/steps/subprocess_call_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > import subprocess > import os.path > import sys > > PYTHON = sys.executable > HERE = os.path.dirname(__file__) > > @when(u'I make a subprocess call "hello {commandline}"') > def step(context, commandline): > result = subprocess_call_hello(commandline.split()) > assert result == 0 > > def subprocess_call_hello(args): > command_args = [ PYTHON, "hello.py" ] + args > result = subprocess.check_call(command_args, stderr=subprocess.STDOUT) > return result > # result = subprocess.check_output(command_args, stderr=subprocess.STDOUT) > # return result > """ > Given a file named "features/issue77_hello_FAIL.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When I make a subprocess call "hello --fail FAIL." > """ > When I run "behave -f plain features/issue77_hello_FAIL.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Hello FAIL. > """ > >@issue >Feature: Issue #80: source file names not properly printed with python3 # issue.features/issue0080.feature:2 > | $ behave -f pretty example/example.feature > | Scenario: run a simple test # example/example.feature:3 > | Given we have behave installed # <string>:3 > | When we implement a test # <string>:7 > | Then behave will test it for us! # <string>:11 > Background: Test Setup # issue.features/issue0080.feature:11 > > Scenario: Show step locations # issue.features/issue0080.feature:38 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'a step passes') > def step(context): > pass > > @when(u'a step passes') > def step(context): > pass > > @then(u'a step passes') > def step(context): > pass > """ > And a file named "features/basic.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step passes > Then a step passes > """ > When I run "behave -c -f pretty --no-timings features/basic.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: # features/basic.feature:1 > Scenario: # features/basic.feature:2 > Given a step passes # features/steps/steps.py:3 > When a step passes # features/steps/steps.py:7 > Then a step passes # features/steps/steps.py:11 > """ > And the command output should not contain "# <string>:" # behave4cmd0/command_steps.py:174 > >@issue >Feature: Issue #81: Allow defining steps in a separate library # issue.features/issue0081.feature:2 > | The current design forces steps.py to be in a particular folder. > | This does not allow to reuse a common library of BDD steps across > | multiple software projects in a company. > | It would be great if one could define a separate lib with common steps > | (e.g. steps4mycompany.py) > Background: Test Setup # issue.features/issue0081.feature:11 > > Scenario: Proof of Concept # issue.features/issue0081.feature:40 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "step_library42/__init__.py" # behave4cmd0/command_steps.py:66 > And a file named "step_library42/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -- ALICE-STEPS: Anonymous step names. > from behave import given, when, then > > @given(u'I use the step library "{library}"') > def step(context, library): > pass > > @when(u'I use steps from this step library') > def step(context): > pass > > @then(u'these steps are executed') > def step(context): > pass > """ > And a file named "features/use_step_library.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use the step library "alice" > When I use steps from this step library > Then these steps are executed > """ > Given a file named "features/steps/use_step_libs.py" with # behave4cmd0/command_steps.py:50 > """ > from step_library42.alice_steps import * > """ > When I run "behave --no-timings -f plain features/use_step_library.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > Given I use the step library "alice" ... passed > When I use steps from this step library ... passed > Then these steps are executed ... passed > """ > > Scenario: With --format=pretty # issue.features/issue0081.feature:60 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "step_library42/__init__.py" # behave4cmd0/command_steps.py:66 > And a file named "step_library42/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -- ALICE-STEPS: Anonymous step names. > from behave import given, when, then > > @given(u'I use the step library "{library}"') > def step(context, library): > pass > > @when(u'I use steps from this step library') > def step(context): > pass > > @then(u'these steps are executed') > def step(context): > pass > """ > And a file named "features/use_step_library.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use the step library "alice" > When I use steps from this step library > Then these steps are executed > """ > Given a file named "features/steps/use_step_libs.py" with # behave4cmd0/command_steps.py:50 > """ > from step_library42.alice_steps import * > """ > When I run "behave -c -f pretty features/use_step_library.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: # features/use_step_library.feature:1 > Scenario: # features/use_step_library.feature:2 > Given I use the step library "alice" # step_library42/alice_steps.py:4 > When I use steps from this step library # step_library42/alice_steps.py:8 > Then these steps are executed # step_library42/alice_steps.py:12 > """ > > Scenario: Selective step import from step library # issue.features/issue0081.feature:80 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "step_library42/__init__.py" # behave4cmd0/command_steps.py:66 > And a file named "step_library42/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -- ALICE-STEPS: Anonymous step names. > from behave import given, when, then > > @given(u'I use the step library "{library}"') > def step(context, library): > pass > > @when(u'I use steps from this step library') > def step(context): > pass > > @then(u'these steps are executed') > def step(context): > pass > """ > And a file named "features/use_step_library.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use the step library "alice" > When I use steps from this step library > Then these steps are executed > """ > Given a file named "step_library42/bob_steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -- BOB-STEPS: Explicit step function names (otherwise same as alice). > from behave import given, when, then > > @given(u'I use the step library "{library}"') > def given_I_use_the_step_library(context, library): > pass > > @when(u'I use steps from this step library') > def when_I_use_steps_from_this_step_library(context): > pass > > @then(u'these steps are executed') > def then_these_steps_are_executed(context): > pass > """ > And a file named "features/steps/use_step_libs.py" with # behave4cmd0/command_steps.py:50 > """ > from step_library42.bob_steps import given_I_use_the_step_library > from step_library42.bob_steps import when_I_use_steps_from_this_step_library > from step_library42.bob_steps import then_these_steps_are_executed > """ > When I run "behave -c -f pretty features/use_step_library.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: # features/use_step_library.feature:1 > Scenario: # features/use_step_library.feature:2 > Given I use the step library "alice" # step_library42/bob_steps.py:4 > When I use steps from this step library # step_library42/bob_steps.py:8 > Then these steps are executed # step_library42/bob_steps.py:12 > """ > > Scenario: Import step library in "environment.py" # issue.features/issue0081.feature:119 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "step_library42/__init__.py" # behave4cmd0/command_steps.py:66 > And a file named "step_library42/alice_steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -- ALICE-STEPS: Anonymous step names. > from behave import given, when, then > > @given(u'I use the step library "{library}"') > def step(context, library): > pass > > @when(u'I use steps from this step library') > def step(context): > pass > > @then(u'these steps are executed') > def step(context): > pass > """ > And a file named "features/use_step_library.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I use the step library "alice" > When I use steps from this step library > Then these steps are executed > """ > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > from step_library42.alice_steps import * > """ > And an empty file named "features/steps/__init__.py" # behave4cmd0/command_steps.py:66 > When I run "behave -c -f pretty features/use_step_library.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: # features/use_step_library.feature:1 > Scenario: # features/use_step_library.feature:2 > Given I use the step library "alice" # step_library42/alice_steps.py:4 > When I use steps from this step library # step_library42/alice_steps.py:8 > Then these steps are executed # step_library42/alice_steps.py:12 > """ > >@issue >Feature: Issue #83: behave.__main__:main() Various sys.exit issues # issue.features/issue0083.feature:2 > | Currently, the main function has several issues related > | to sys.exit() returncode usage: > | > | 1. sys.exit("string") is invalid, a number must be used: > | => Used in exception cases after run (ParseError, ConfigError) > | > | 2. On success, the main() function returns implicitly None > | instead of using sys.exit(0) > | => No statement at end of function after failed case. > @setup > Scenario: Feature Setup # issue.features/issue0083.feature:15 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > """ > > Scenario: Successful test run # issue.features/issue0083.feature:26 > Given a file named "features/passing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step passes > Then a step passes > """ > When I run "behave -c features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command returncode is "0" # behave4cmd0/command_steps.py:103 > > Scenario: ParseError occurs # issue.features/issue0083.feature:39 > Given a file named "features/invalid_with_ParseError.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Invalid scenario which raises ParseError > Given a step passes > When2 a step passes > """ > When I run "behave -c features/invalid_with_ParseError.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command returncode is non-zero # behave4cmd0/command_steps.py:107 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Failed to parse "{__WORKDIR__}/features/invalid_with_ParseError.feature" > """ > > Scenario: ConfigError occurs # issue.features/issue0083.feature:55 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/passing2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > """ > When I run "behave -c features/passing2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command returncode is non-zero # behave4cmd0/command_steps.py:107 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > No steps directory in "{__WORKDIR__}/features" > """ > >@issue >Feature: Issue #84: behave.runner behave does not reliably detected failed test runs # issue.features/issue0084.feature:2 > | Behave does currently not reliably detected failed test runs and > | therefore returns not sys.exit(1) at end of main(). > | > | 1. behave.runner:Runner.run_with_paths() returns failed==True > | if last feature was successful and test runner does not stop > | after first failing feature. > | > | 2. Issue #64: Same problem in behave.model.Feature.run() with scenarios > Scenario: Test Setup # issue.features/issue0084.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/passing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Passing > Scenario: > Given a step passes > When a step passes > Then a step passes > """ > And a file named "features/failing.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Failing > Scenario: > Given a step fails > When a step fails > Then a step fails > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > > @step(u'a step fails') > def step_fails(context): > assert False, "step: a step fails" > """ > > Scenario: First feature fails, second feature passes # issue.features/issue0084.feature:44 > When I run "behave -f plain features/failing.feature features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 feature passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped > 3 steps passed, 1 failed, 2 skipped, 0 undefined > """ > > Scenario: First feature passes, second feature fails # issue.features/issue0084.feature:53 > When I run "behave -f plain features/passing.feature features/failing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 feature passed, 1 failed, 0 skipped > 1 scenario passed, 1 failed, 0 skipped > 3 steps passed, 1 failed, 2 skipped, 0 undefined > """ > > Scenario: First feature passes, second fails, last passes # issue.features/issue0084.feature:62 > When I run "behave -f plain features/passing.feature features/failing.feature features/passing.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 2 features passed, 1 failed, 0 skipped > 2 scenarios passed, 1 failed, 0 skipped > 6 steps passed, 1 failed, 2 skipped, 0 undefined > """ > >@issue >Feature: Issue #85: AssertionError with nested regex and pretty formatter # issue.features/issue0085.feature:2 > | When --format=pretty is used > | an AssertationError occurs for missing optional/nested-groups. > | When --format=plain is used, everything is fine > Scenario: Test Setup # issue.features/issue0085.feature:8 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/regexp_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from __future__ import print_function > from behave import given, when, then, use_step_matcher > @given(u'a {re_category} regular expression "{pattern}"') > def impl(context, re_category, pattern): > pass > > @then(u'the parameter "{name}" is "{expected_value}"') > def impl(context, name, expected_value): > actual_value = getattr(context, name, None) > if actual_value is None: > actual_value = "" > assert hasattr(context, name) > assert actual_value == expected_value, "MISMATCH: actual({0}) == expected({1})".format(actual_value, expected_value) > > @then(u'the parameter "{name}" is none') > def impl(context, name): > actual_value = getattr(context, name, None) > assert hasattr(context, name) > assert actual_value is None, "MISMATCH: actual({0}) == None)".format(actual_value) > > def store_in_context(context, data): > for name, value in data.items(): > setattr(context, name, value) > > use_step_matcher('re') > > @when(u'I try to match "(?P<foo>foo and more)"') > def impl(context, **kwargs): > kwargs["regexp_case"] = "simple" > print("CASE UNNESTED: {0}".format(kwargs)) > store_in_context(context, kwargs) > > @when(u'I try to match "(?P<foo>foo(?P<bar>bar)?)"') > def impl(context, **kwargs): > kwargs["regexp_case"] = "nested" > print("CASE NESTED: {0}".format(kwargs)) > store_in_context(context, kwargs) > > @when(u'I try to match "(?P<foo>foo) (?P<bar>bar)?"') > def impl(context, **kwargs): > kwargs["regexp_case"] = "optional" > print("CASE OPTIONAL: {0}".format(kwargs)) > store_in_context(context, kwargs) > """ > And a file named "features/matching.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Using regexp matcher with nested and optional parameters > > Scenario: regex, no nested groups, matching > Given a simple regular expression "(?P<foo>foo and more)" > When I try to match "foo and more" > Then the parameter "regexp_case" is "simple" > And the parameter "foo" is "foo and more" > > Scenario: Nested groups without nested match > Given a nested-group regular expression "(?P<foo>foo(?P<bar>bar)?)" > When I try to match "foo" > Then the parameter "regexp_case" is "nested" > And the parameter "foo" is "foo" > And the parameter "bar" is none > > Scenario: Nested groups with nested match > Given a nested-group regular expression "(?P<foo>foo(?P<bar>bar)?)" > When I try to match "foobar" > Then the parameter "regexp_case" is "nested" > And the parameter "foo" is "foobar" > And the parameter "bar" is "bar" > > Scenario: Optional group without match > Given a optional-group regular expression "(?P<foo>foo) (?P<bar>bar)?" > When I try to match "foo " > Then the parameter "regexp_case" is "optional" > And the parameter "foo" is "foo" > And the parameter "bar" is none > > Scenario: Optional group with match > Given a optional-group regular expression "(?P<foo>foo) (?P<bar>bar)?" > When I try to match "foo bar" > Then the parameter "regexp_case" is "optional" > And the parameter "foo" is "foo" > And the parameter "bar" is "bar" > """ > > Scenario: Run regexp steps with --format=plain # issue.features/issue0085.feature:95 > When I run "behave --format=plain features/matching.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 5 scenarios passed, 0 failed, 0 skipped > 24 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Run regexp steps with --format=pretty # issue.features/issue0085.feature:104 > When I run "behave -c --format=pretty features/matching.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 5 scenarios passed, 0 failed, 0 skipped > 24 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > assert isinstance(text, unicode) > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > AssertationError > """ > >@issue >Feature: Issue #92: Output from --format=plain shows skipped steps in next scenario # issue.features/issue0092.feature:2 > | DUPLICATED, FIXED-BY: issue #35 solution. > | > | Given a feature has more than one scenario > | When the --format=plain option is used > | and a middle step of a scenario fails > | Then the skipped steps appear under the next scenario > Scenario: # issue.features/issue0092.feature:12 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/issue92_syndrome.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Testing Plain Output > Reproduces bug where output from previous scenario appears before current. > > Scenario: First example > Given this step works > When this step fails > Then this step appears in the wrong place > > Scenario: Second example > Given this step works > When this step fails > Then this step appears in the wrong place > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'this step works') > def working(context): > pass > > > @step(u'this step fails') > def failing(context): > assert False, 'step failed' > > > @step(u'this step appears in the wrong place') > def missing(context): > pass > """ > When I run "behave --no-timings --format=plain features/issue92_syndrome.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 2 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Testing Plain Output > Scenario: First example > Given this step works ... passed > When this step fails ... failed > Assertion Failed: step failed > > Scenario: Second example > Given this step works ... passed > When this step fails ... failed > Assertion Failed: step failed > """ > >@issue >Feature: Issue #96: Sub-steps failed without any error info to help debug issue # issue.features/issue0096.feature:2 > | I am trying to run execute_steps. One of them fails, but the error output > | from behave has no details whatsoever. It is virtually impossible > | to figure out why it failed. as no error output is present except the > | final error message > | > | def before_scenario(context,scenario): > | context.execute_steps(u''' > | When "admin:admin" sends POST "/tasks/testStart" > | Then I expect HTTP code 200 > | ''') > | > | File ".../behave/runner.py", line 262, in execute_steps > | assert False, "FAILED SUB-STEP: %s" % step > | AssertionError: FAILED SUB-STEP: When "admin:admin" sends POST "/tasks/testStart" > | > | All we get is the "sub-step failed" but no info whatsoever > | as to why it failed... > Background: # issue.features/issue0096.feature:24 > > Scenario: Execute steps and one fails (EXPECTATION-MISMATCH: Assert fails) # issue.features/issue0096.feature:58 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step(u'a step passes') > def step_passes(context): > pass > > @step(u'a step fails') > def step_fails(context): > assert False, 'EXPECT: Step fails.' > > @step(u'a step fails with stdout "{message}"') > def step_fails_with_stdout(context, message): > sys.stdout.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stdout.' > > @step(u'a step fails with stderr "{message}"') > def step_fails_with_stderr(context, message): > sys.stderr.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stderr.' > > @step(u'a step raises an error "{message}"') > def step_raises_exception(context, message): > raise RuntimeError(message) > > @step(u'the following steps should pass') > def step_following_steps_should_pass(context): > context.execute_steps(context.text.strip()) > """ > Given a file named "features/issue96_case1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When the following steps should pass: > \"\"\" > Given a step passes > When a step fails > Then a step passes > \"\"\" > """ > When I run "behave -c features/issue96_case1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Assertion Failed: FAILED SUB-STEP: When a step fails > Substep info: Assertion Failed: EXPECT: Step fails. > """ > > Scenario: Execute steps and error occurs (UNEXPECTED: exception is raised) # issue.features/issue0096.feature:77 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step(u'a step passes') > def step_passes(context): > pass > > @step(u'a step fails') > def step_fails(context): > assert False, 'EXPECT: Step fails.' > > @step(u'a step fails with stdout "{message}"') > def step_fails_with_stdout(context, message): > sys.stdout.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stdout.' > > @step(u'a step fails with stderr "{message}"') > def step_fails_with_stderr(context, message): > sys.stderr.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stderr.' > > @step(u'a step raises an error "{message}"') > def step_raises_exception(context, message): > raise RuntimeError(message) > > @step(u'the following steps should pass') > def step_following_steps_should_pass(context): > context.execute_steps(context.text.strip()) > """ > Given a file named "features/issue96_case2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When the following steps should pass: > \"\"\" > Given a step passes > When a step raises an error "Alice is alive" > Then a step passes > \"\"\" > """ > When I run "behave -c features/issue96_case2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > RuntimeError: Alice is alive > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Assertion Failed: FAILED SUB-STEP: When a step raises an error "Alice is alive" > Substep info: Traceback (most recent call last): > """ > > Scenario: Execute steps and one fails with stdout capture # issue.features/issue0096.feature:100 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step(u'a step passes') > def step_passes(context): > pass > > @step(u'a step fails') > def step_fails(context): > assert False, 'EXPECT: Step fails.' > > @step(u'a step fails with stdout "{message}"') > def step_fails_with_stdout(context, message): > sys.stdout.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stdout.' > > @step(u'a step fails with stderr "{message}"') > def step_fails_with_stderr(context, message): > sys.stderr.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stderr.' > > @step(u'a step raises an error "{message}"') > def step_raises_exception(context, message): > raise RuntimeError(message) > > @step(u'the following steps should pass') > def step_following_steps_should_pass(context): > context.execute_steps(context.text.strip()) > """ > Given a file named "features/issue96_case3.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When the following steps should pass: > \"\"\" > Given a step passes > When a step fails with stdout "STDOUT: Alice is alive" > Then a step passes > \"\"\" > """ > When I run "behave -c features/issue96_case3.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Assertion Failed: FAILED SUB-STEP: When a step fails with stdout "STDOUT: Alice is alive" > Substep info: Assertion Failed: EXPECT: Step fails with stdout. > Captured stdout: > STDOUT: Alice is alive > """ > > Scenario: Execute steps and one fails with stderr capture # issue.features/issue0096.feature:121 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step(u'a step passes') > def step_passes(context): > pass > > @step(u'a step fails') > def step_fails(context): > assert False, 'EXPECT: Step fails.' > > @step(u'a step fails with stdout "{message}"') > def step_fails_with_stdout(context, message): > sys.stdout.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stdout.' > > @step(u'a step fails with stderr "{message}"') > def step_fails_with_stderr(context, message): > sys.stderr.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stderr.' > > @step(u'a step raises an error "{message}"') > def step_raises_exception(context, message): > raise RuntimeError(message) > > @step(u'the following steps should pass') > def step_following_steps_should_pass(context): > context.execute_steps(context.text.strip()) > """ > Given a file named "features/issue96_case4.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When the following steps should pass: > \"\"\" > Given a step passes > When a step fails with stderr "STDERR: Alice is alive" > Then a step passes > \"\"\" > """ > When I run "behave -c features/issue96_case4.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Assertion Failed: FAILED SUB-STEP: When a step fails with stderr "STDERR: Alice is alive" > Substep info: Assertion Failed: EXPECT: Step fails with stderr. > Captured stderr: > STDERR: Alice is alive > """ > > Scenario: Execute steps and fail in before_scenario hook # issue.features/issue0096.feature:142 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > import sys > > @step(u'a step passes') > def step_passes(context): > pass > > @step(u'a step fails') > def step_fails(context): > assert False, 'EXPECT: Step fails.' > > @step(u'a step fails with stdout "{message}"') > def step_fails_with_stdout(context, message): > sys.stdout.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stdout.' > > @step(u'a step fails with stderr "{message}"') > def step_fails_with_stderr(context, message): > sys.stderr.write("%s\n" % message) > assert False, 'EXPECT: Step fails with stderr.' > > @step(u'a step raises an error "{message}"') > def step_raises_exception(context, message): > raise RuntimeError(message) > > @step(u'the following steps should pass') > def step_following_steps_should_pass(context): > context.execute_steps(context.text.strip()) > """ > Given a file named "features/issue96_case5.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step passes > Then a step passes > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_scenario(context, scenario): > context.execute_steps(u''' > Given a step passes > When a step passes > Then a step fails > ''') > """ > When I run "behave -c features/issue96_case5.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > AssertionError: FAILED SUB-STEP: Then a step fails > Substep info: Assertion Failed: EXPECT: Step fails. > """ > >@issue >Feature: Issue #99: Layout variation "a directory containing your feature files" is broken for running single features # issue.features/issue0099.feature:2 > | When I use a layout as described in the 1.2.2 documentation, > | I can only specify a whole directory of feature files to run. > | Specifying a single feature file results in an error from behave: > | > | $ behave -v tests/feature/webui/features/feature_under_test.feature > | ... > | Supplied path: "tests/feature/webui/features/feature_under_test.feature" > | Primary path is to a file so using its directory > | Trying base directory: .../tests/feature/webui/features > | Trying base directory: .../tests/feature/webui > | ERROR: Could not find "steps" directory in your specified path ".../tests/feature/webui/features" > | No steps directory in ".../tests/feature/webui/features" > | > | My directory layout is as follows: > | > | .../tests/feature/webui/ > | +-- features/ > | +-- steps/ > | +-- environment.py > | > | SEE ALSO: > | * http://packages.python.org/behave/gherkin.html#layout-variations > Background: # issue.features/issue0099.feature:28 > > Scenario: Run features with root directory # issue.features/issue0099.feature:57 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "root/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > """ > And a file named "root/features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: > Given a step passes > """ > And a file named "root/features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: > Given a step passes > """ > And a file named "root/features2/charly.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Charly > Scenario: > When a step passes > """ > When I run "behave -f plain --no-timings root" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 3 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: > Given a step passes ... passed > Feature: Bob > Scenario: > Given a step passes ... passed > Feature: Charly > Scenario: > When a step passes ... passed > """ > > Scenario: Run features with root/features directory # issue.features/issue0099.feature:78 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "root/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > """ > And a file named "root/features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: > Given a step passes > """ > And a file named "root/features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: > Given a step passes > """ > And a file named "root/features2/charly.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Charly > Scenario: > When a step passes > """ > When I run "behave -f plain --no-timings root/features" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: > Given a step passes ... passed > Feature: Bob > Scenario: > Given a step passes ... passed > """ > > Scenario: Run features with feature files # issue.features/issue0099.feature:96 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "root/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > """ > And a file named "root/features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: > Given a step passes > """ > And a file named "root/features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: > Given a step passes > """ > And a file named "root/features2/charly.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Charly > Scenario: > When a step passes > """ > When I run "behave -f plain --no-timings root/features/alice.feature root/features2/charly.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > Scenario: > Given a step passes ... passed > Feature: Charly > Scenario: > When a step passes ... passed > """ > > Scenario: Run features with feature dir and feature files (other ordering) # issue.features/issue0099.feature:114 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "root/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > """ > And a file named "root/features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: > Given a step passes > """ > And a file named "root/features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: > Given a step passes > """ > And a file named "root/features2/charly.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Charly > Scenario: > When a step passes > """ > When I run "behave -f plain --no-timings root/features2 root/features/alice.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Charly > Scenario: > When a step passes ... passed > Feature: Alice > Scenario: > Given a step passes ... passed > """ > >@issue >Feature: Issue #109: Insists that implemented tests are not implemented # issue.features/issue0109.feature:2 > | STATUS: Resolved, not a behave problem. > | > | Following feature file marks implemented step "when I submit the following data" > | as not implemented. > Scenario: # issue.features/issue0109.feature:10 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/syndrome109.feature" with # behave4cmd0/command_steps.py:50 > """ > @wip > Feature: Manage accounts from the admin interface > > Scenario: Login successfully via login form > Given I navigate to "/admin/" > when I submit the following data > | name | value | > | username | admin@foo.bar | > | password | pass | > then I see the word "Welcome" > > Scenario: Create user via admin user creation form > Given I navigate to "/admin/users/user/add/" > when I submit the following data > | name | value | > | email | spaaaaaaaaaaaaaaaaaaam@ham.eggs | > | password1 | pass | > | password2 | pass | > then I see the word "successfully" > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > @given(u'I navigate to "{url}"') > def step_navigate_to_url(context, url): > pass > > @when(u'I submit the following data') > def step_submit_data(context): > pass > > @then(u'I see the word "{word}"') > def step_see_word(context, word): > pass > """ > When I run "behave -w features/syndrome109.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 6 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > You can implement step definitions for undefined steps with these snippets: > """ > >@issue >Feature: Issue #111: Comment following @wip tag results in scenario being ignored # issue.features/issue0111.feature:2 > | If a comment is placed after the @wip tag, the following scenario > | is ignored by behave: > | > | @wip # comment: this is work in progress > | Scenario: test scenario > | > | results in behave -w not running the "test scenario". > | After removing the comment, it runs as expected. > Scenario: Test Setup # issue.features/issue0111.feature:14 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > """ > And a file named "features/syndrome111.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @wip # Comment: blabla > Scenario: S1 > Given a step passes > > @wip @one # Comment: foobar > Scenario: S2 > Given a step passes > """ > > Scenario: Scenario w/ comment on tag-line should run as normal # issue.features/issue0111.feature:37 > When I run "behave --wip features/syndrome111.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 2 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Ensure 2nd scenario can be selected with other tag # issue.features/issue0111.feature:46 > When I run "behave -f plain --tags=one features/syndrome111.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 1 skipped > 1 step passed, 0 failed, 1 skipped, 0 undefined > """ > >@issue @change_request >Feature: Issue #112: Improvement to AmbiguousStep error # issue.features/issue0112.feature:3 > | AmbiguousStep could be more useful if it also showed the existing string > | with which the new one is clashing. This is particularly useful > | if using step parameters. > Background: # issue.features/issue0112.feature:10 > > Scenario: Good step ordering -- From specific to generic regular expression # issue.features/issue0112.feature:19 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/syndrome112.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I buy 10 oranges > """ > Given a file named "features/steps/good_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > # -- ORDERING-IMPORTANT: From more specific steps to less specific. > @given(u'I buy {number:n} {items:w}') > def step_given_I_buy2(context, number, items): > pass > > # -- OTHERWISE: Generic step matches all other patterns. > @given(u'I buy {amount} {product}') > def step_given_I_buy(context, amount, product): > pass > """ > When I run "behave -c features/syndrome112.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 1 step passed, 0 failed, 0 skipped, 0 undefined > """ > > Scenario: Bad step ordering causes AmbiguousStep # issue.features/issue0112.feature:43 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/syndrome112.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I buy 10 oranges > """ > Given a file named "features/steps/bad_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then > > # -- ORDERING-VIOLATED: Generic step comes first. > @given(u'I buy {amount} {product}') > def step_given_I_buy(context, amount, product): > pass > > # -- AMBIGUOUS-STEP: Will occur here. > @given(u'I buy {number:n} {items:w}') > def step_given_I_buy2(context, number, items): > pass > """ > When I run "behave -c features/syndrome112.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > AmbiguousStep: @given('I buy {number:n} {items:w}') has already been defined in > existing step @given('I buy {amount} {product}') at features/steps/bad_steps.py:4 > """ > >@issue @change_request >Feature: Issue #114: Avoid unnecessary blank lines w/ --no-skipped option # issue.features/issue0114.feature:3 > | Unnessary blank lines appear when you use (for each skipped feature): > | > | behave -f progress --tags=@one --no-skipped ... > @setup > Scenario: Feature Setup # issue.features/issue0114.feature:10 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > """ > And a file named "features/e1.feature" with # behave4cmd0/command_steps.py:50 > """ > @example > Feature: E1 > Scenario: S1.1 > Given a step passes > """ > And a file named "features/e2.feature" with # behave4cmd0/command_steps.py:50 > """ > @exclude > Feature: E2 > Scenario: S2.1 > Given a step passes > """ > And a file named "features/e3.feature" with # behave4cmd0/command_steps.py:50 > """ > @example > Feature: E3 > Scenario: S3.1 > Given a step passes > """ > > Scenario: Run Features with tags and --show-skipped option # issue.features/issue0114.feature:42 > When I run "behave -f progress --tags=@example" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 1 skipped > 2 scenarios passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 1 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > features/e1.feature . > features/e2.feature S > features/e3.feature . > """ > > Scenario: Run Features with tag and --no-skipped option (CASE 1) # issue.features/issue0114.feature:57 > When I run "behave -f progress --tags=@example --no-skipped" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 1 skipped > 2 scenarios passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 1 skipped, 0 undefined > """ > And the command output should contain exactly # behave4cmd0/command_steps.py:259 > """ > features/e1.feature . > features/e3.feature . > """ > But the command output should not contain exactly # behave4cmd0/command_steps.py:265 > """ > features/e1.feature . > > features/e3.feature . > """ > > Scenario: Run Features with other tag and --no-skipped option (CASE 2) # issue.features/issue0114.feature:77 > When I run "behave -f progress --tags=@exclude --no-skipped" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 2 skipped > 1 scenario passed, 0 failed, 2 skipped > 1 step passed, 0 failed, 2 skipped, 0 undefined > """ > And the command output should contain exactly # behave4cmd0/command_steps.py:259 > """ > features/e2.feature . > """ > > Scenario: Run Features with tag, --no-skipped and plain formatter (CASE 3) # issue.features/issue0114.feature:90 > When I run "behave -f plain --tags=@example --no-skipped -T" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 1 skipped > 2 scenarios passed, 0 failed, 1 skipped > 2 steps passed, 0 failed, 1 skipped, 0 undefined > """ > And the command output should contain exactly # behave4cmd0/command_steps.py:259 > """ > Feature: E1 > > Scenario: S1.1 > Given a step passes ... passed > > Feature: E3 > > """ > But the command output should not contain exactly # behave4cmd0/command_steps.py:265 > """ > Feature: E1 > > Scenario: S1.1 > Given a step passes ... passed > > > Feature: E3 > > """ > >@issue @change_request >Feature: Issue #116: SummaryReporter shows failed scenarios list # issue.features/issue0116.feature:3 > > Scenario: Test Setup # issue.features/issue0116.feature:5 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_failing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step passes') > def step_passes(context): > pass > > @step(u'a step fails') > def step_fails(context): > assert False, "FAILS" > """ > And a file named "features/e1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: E1 > > Scenario: E1.1 > Given a step passes > > @xfail > Scenario: E1.2 (XFAIL) > Given a step fails > > Scenario: E1.3 > Given a step passes > """ > And a file named "features/e2.feature" with # behave4cmd0/command_steps.py:50 > """ > @example2 > Feature: E2 > > @xfail > Scenario: E2.1 (XFAIL) > Given a step fails > > Scenario: E2.2 > Given a step passes > """ > > Scenario: Summary shows list of failed scenarios when at least one fails # issue.features/issue0116.feature:46 > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Failing scenarios: > features/e1.feature:7 E1.2 (XFAIL) > features/e2.feature:5 E2.1 (XFAIL) > > 0 features passed, 2 failed, 0 skipped > 3 scenarios passed, 2 failed, 0 skipped > 3 steps passed, 2 failed, 0 skipped, 0 undefined > """ > > Scenario: Summary hides list of failed scenarios when all scenarios pass # issue.features/issue0116.feature:60 > When I run "behave -f plain --tags=~@xfail features/" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 2 skipped > 3 steps passed, 0 failed, 2 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Failing scenarios: > """ > >@issue >Feature: Issue #125: Duplicate "Captured stdout" if substep has failed # issue.features/issue0125.feature:2 > > Background: Test Setup # issue.features/issue0125.feature:5 > > Scenario: Subprocess call shows generated output # issue.features/issue0125.feature:21 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step fails with stdout "{message}"') > def step_fails_with_stdout(context, message): > print(message) > assert False, 'EXPECT: Step fails with stdout.' > > @step('substep fails with stdout "{message}"') > def substep_fails_with_stdout(context, message): > context.execute_steps(u'When a step fails with stdout "%s"' % message) > """ > Given a file named "features/issue125_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When substep fails with stdout "Hello" > """ > When I run "behave -f plain --no-timings features/issue125_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Captured stdout: > Hello > > Captured stdout: > Hello > """ > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Scenario: > When substep fails with stdout "Hello" ... failed > > Assertion Failed: FAILED SUB-STEP: When a step fails with stdout "Hello" > Substep info: Assertion Failed: EXPECT: Step fails with stdout. > Captured stdout: > Hello > """ > >@issue >Feature: Issue #127: Strip trailing colons # issue.features/issue0127.feature:2 > | Trailing colon in a step is stripped by the Gherkin parser. > | Undefined step snippets should not suggest the step with a trailing colon. > | > | GENERAL RULE (by looking at the parser): > | 1. Colon in step in feature file is OK > | (parser strips this for step-with-table or step-with-multiline-text). > | 2. Step definitions in Python files should not end with a colon > | (used in @given/@when/@then decorators). > Background: # issue.features/issue0127.feature:14 > > Scenario: Step Definition has no trailing colon (GOOD CASE) # issue.features/issue0127.feature:26 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/example127.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following superusers exist: > | Name | User Id | > | Alice | 101 | > | Bob | 102 | > """ > Given a file named "features/steps/good_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'the following superusers exist') > def step_given_following_superusers_exist(context): > pass > """ > When I run "behave -f plain features/example127.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > You can implement step definitions for undefined steps with these snippets: > > @given(u'the following superusers exist:') > def step_impl(context): > raise NotImplementedError(u'STEP: Given the following superusers exist:') > """ > > Scenario: Step Definition has trailing colon (BAD CASE) # issue.features/issue0127.feature:46 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/example127.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given the following superusers exist: > | Name | User Id | > | Alice | 101 | > | Bob | 102 | > """ > Given a file named "features/steps/bad_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given > > @given(u'the following superusers exist:') > def step_given_following_superusers_exist(context): > pass > """ > When I run "behave -f plain features/example127.feature" # behave4cmd0/command_steps.py:80 > Then it should fail # behave4cmd0/command_steps.py:115 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > > @given(u'the following superusers exist') > def step_impl(context): > raise NotImplementedError(u'STEP: Given the following superusers exist') > """ > >@issue @not_reproducible >Feature: Issue #139: Wrong steps seem to be executed when using --wip # issue.features/issue0139.feature:3 > | RELATED-TO: issue #35 > | behave --format=plain --tags @one" seems to execute right scenario w/ wrong steps > | > | If you have a feature file with two scenarios where the second is tagged > | with @wip, running behave -w will output step names from the first scenario. > | It does seem to run the correct code for the steps. > Scenario: # issue.features/issue0139.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then, step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL" > > @when('I run a test step') > def step_impl(context): > pass > > @when('I run some other test step') > def step_impl(context): > pass > > @then('I should not see a failure here') > def step_impl(context): > pass > """ > And a file named "features/issue0139_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bug in wip/behave -w > > Scenario: This is strange > Given a step passes > When a step passes > Then a step fails > > @wip > Scenario: Demonstrate bug > When I run a test step > And I run some other test step > Then I should not see a failure here > """ > When I run "behave -w -f plain -T features/issue0139_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bug in wip/behave -w > Scenario: This is strange > Scenario: Demonstrate bug > When I run a test step ... passed > And I run some other test step ... passed > Then I should not see a failure here ... passed > """ > >@issue @not_reproducible >Feature: Issue #142: --junit flag fails to output with step table data: TypeError: <Row [u'data', u'value']> is not JSON serializable # issue.features/issue0142.feature:3 > DUPLICATES: issue #67 (already fixed). > Scenario: # issue.features/issue0142.feature:7 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then, step > > @then('use table data with') > def step_impl(context): > pass > """ > And a file named "features/issue0142_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Use a table > Then use table data with: > | data | value | > | behave outputs junit with tables | false | > """ > When I run "behave --junit -f json features/issue0142_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > TypeError: <Row [u'behave outputs junit with tables', u'false']> is not JSON serializable > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Traceback (most recent call last): > """ > >@issue >Feature: Issue #143: Logging starts with a StreamHandler way too early # issue.features/issue0143.feature:2 > | This verifies that some imported library or other item has not made a > | call to logging too soon, which would add a StreamHandler. > @setup > Scenario: Feature Setup # issue.features/issue0143.feature:9 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > import logging > from behave import given, when, then, step > > @step('I create {count:n} log records') > def step_create_log_records(context, count): > for i in range(count): > logging.debug('Some debug logging') > """ > And a file named "features/issue0143_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Logging should not be output unless there is a failure > > Scenario: A passing test > Given I create 4 log records > """ > > Scenario: Ensure that no log-ouput occurs with enabled log-capture # issue.features/issue0143.feature:29 > Given an empty file named "features/environment.py" # behave4cmd0/command_steps.py:66 > When I run "behave -f plain --logcapture features/issue0143_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > DEBUG:root:Some debug logging > """ > > Scenario: Ensure that log-ouput occurs with disabled log-capture # issue.features/issue0143.feature:39 > Given a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > import logging > > def before_all(context): > # -- basicConfig() will not set level if setup is already done. > logging.basicConfig() > logging.getLogger().setLevel(logging.DEBUG) > """ > When I run "behave -f plain --no-logcapture features/issue0143_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > DEBUG:root:Some debug logging > """ > >@issue >Feature: Issue #145: before_feature/after_feature should not be skipped # issue.features/issue0145.feature:2 > | Hooks before_feature(), after_feature() (and before_step()) are skipped > | if --tags options select feature tag and scenario tag. > | > | SEE ALSO: https://github.com/cucumber/cucumber/wiki/Tags > @setup > Scenario: Setup # issue.features/issue0145.feature:10 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/issue0145_example.feature" with # behave4cmd0/command_steps.py:50 > """ > @feature > Feature: Feature-145 > > @scenario > Scenario: Scenario-145 > Given a step passes > When a step passes > Then a step passes > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > from __future__ import print_function > > def before_feature(context, feature): > print("hooks.before_feature: %s called." % feature.name) > > def after_feature(context, feature): > print("hooks.after_feature: %s called." % feature.name) > """ > > Scenario: Select only @scenario tag # issue.features/issue0145.feature:42 > When I run "behave -f plain -T --tags=@scenario features/issue0145_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the behave hook "before_feature" was called # issue.features/steps/behave_hooks_steps.py:6 > And the behave hook "after_feature" was called # issue.features/steps/behave_hooks_steps.py:6 > > Scenario: Select @feature tag and @scenario tag (logical-and, fails if not fixed) # issue.features/issue0145.feature:53 > When I run "behave -f plain -T --tags=@feature --tags=@scenario features/issue0145_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the behave hook "before_feature" was called # issue.features/steps/behave_hooks_steps.py:6 > And the behave hook "after_feature" was called # issue.features/steps/behave_hooks_steps.py:6 > >@issue @already_fixed >Feature: Issue #148: Substeps do not fail # issue.features/issue0148.feature:3 > FIXED-BY: issue #117 context.execute_steps() should support table and multi-line text. > RELATED-TO: issue #96 > @setup > Scenario: Setup # issue.features/issue0148.feature:9 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > @step('a step passes') > def step_passes(context): > pass > > @step('a step fails') > def step_fails(context): > assert False, "XFAIL" > """ > And a file named "features/issue0148_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Sub steps > > @xfail > Scenario: Failing test without substeps > Given a step passes > When a step fails > Then a step passes > > @xfail > Scenario: Failing test with substeps > Given a step passes > When I do something with stupid substeps > Then a step passes > """ > > Scenario: Missing Step Keywords in Substeps # issue.features/issue0148.feature:38 > Given a file named "features/steps/substeps.py" with # behave4cmd0/command_steps.py:50 > """ > @When('I do something with stupid substeps') > def step(context): > context.execute_steps(u''' > I do something stupid > there is a second stupid step > ''') # Given/When/Then keywords are missing in substeps above. > """ > When I run "behave -f plain -T features/issue0148_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 2 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Failing test without substeps > Given a step passes ... passed > When a step fails ... failed > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Failing test with substeps > Given a step passes ... passed > When I do something with stupid substeps ... failed > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > ParserError: Failed to parse <string>: > Parser failure in state steps, at line 2: 'I do something stupid' > """ > > Scenario: Use Step Keywords in Substeps # issue.features/issue0148.feature:74 > Given a file named "features/steps/substeps.py" with # behave4cmd0/command_steps.py:50 > """ > @when('I do something with stupid substeps') > def step(context): > context.execute_steps(u''' > When a step fails > Then a step fails > ''') > """ > When I run "behave -f plain -T features/issue0148_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 2 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Failing test with substeps > Given a step passes ... passed > When I do something with stupid substeps ... failed > Assertion Failed: FAILED SUB-STEP: When a step fails > Substep info: Assertion Failed: XFAIL > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > > ParserError: Failed to parse <string> > """ > >@issue >Feature: Issue #152: Fix encoding issues # issue.features/issue0152.feature:2 > | I fixed two encoding issues in pretty formatter and in JUnit serialization. > | Now it's possible to use accented letters in feature files and > | create JUnit reports from the tests. > Scenario: Ensure JUnit reports can be created from a foreign language # issue.features/issue0152.feature:9 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "features/steps/steps.py" # behave4cmd0/command_steps.py:66 > And a file named "features/eins.feature" with # behave4cmd0/command_steps.py:50 > """ > # language: de > Funktionalität: Die Welt ist schön > Szenario: Was wäre wenn die schöne, neue Welt untergeht > """ > When I run "behave -f plain --junit --no-timings features/eins.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > 0 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Funktionalität: Die Welt ist schön > Szenario: Was wäre wenn die schöne, neue Welt untergeht > """ > > @reuse.colocated_test > Scenario: Ensure JUnit reports can be created from a foreign language # issue.features/issue0152.feature:33 > Given I use the current directory as working directory # behave4cmd0/command_steps.py:39 > When I run "behave -f plain --junit --no-timings tools/test-features/french.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > 5 steps passed, 0 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Fonctionnalité: testing stuff > Scénario: test stuff > Etant donné I am testing stuff ... passed > Quand I exercise it work ... passed > Alors it will work ... passed > Scénario: test more stuff > Etant donné I am testing stuff ... passed > Alors it will work ... passed > """ > >@issue >Feature: Issue #159: output stream is wrapped twice in the codecs.StreamWriter # issue.features/issue0159.feature:2 > > @setup > Scenario: Feature Setup # issue.features/issue0159.feature:5 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > # -*- coding: utf-8 -*- > from behave import step > > @step('firstname is "{name}"') > def step_impl(context, name): > pass > > @step(u'full name is Loïc "{name}"') > def step_impl(context, name): > pass > """ > > Scenario: Single feature, pass (a) # issue.features/issue0159.feature:21 > Given a file named "features/issue159_stream_writer.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When firstname is "Loïc" > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > > Scenario: Single feature, pass (b) # issue.features/issue0159.feature:32 > Given a file named "features/issue159_stream_writer.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When full name is Loïc "Dupont" > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > > Scenario: Two features, FAIL (a) # issue.features/issue0159.feature:43 > Given a file named "features/issue159_stream_writer.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When full name is Loïc "Dupont" > """ > And a file named "features/issue159_stream_writer_again.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When full name is Loïc "Dupond" > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > > Scenario: Two features, FAIL (b) # issue.features/issue0159.feature:60 > Given a file named "features/issue159_stream_writer.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When firstname is "Loïc" > """ > And a file named "features/issue159_stream_writer_again.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > When firstname is "Loïc" > """ > When I run "behave -f plain features/" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > >@issue >Feature: Issue #162 Unnecessary ContextMaskWarnings when assert fails or exception is raised # issue.features/issue0162.feature:2 > | Behave shows unnecessary ContextMaskWarnings related to: > | > | * tags > | * capture_stdout > | * capture_stderr > | * log_capture > | > | if: > | > | * an assertion fails in a step-definition/step-function > | * an exception is raised by a step-definition/step-function > | > | and an additional scenario follows. > | REASON: Context "behave" mode is not restored when an exception is raised. > @setup > Scenario: Feature Setup # issue.features/issue0162.feature:21 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > > @step('a step assert fails') > def step_assert_fails(context): > assert False, "XFAIL-STEP" > > @step('an exception is raised') > def step_raises_exception(context): > raise RuntimeError("XFAIL-STEP") > """ > > Scenario: Assertion fails in a step # issue.features/issue0162.feature:41 > Given a file named "features/example0162_assert_fails.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When a step assert fails > Then a step passes > > Scenario: > Given a step passes > """ > When I run "behave -f plain features/example0162_assert_fails.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 2 steps passed, 1 failed, 1 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ContextMaskWarning: user code is masking context attribute > """ > > Scenario: Exception is raised in a step # issue.features/issue0162.feature:65 > Given a file named "features/example0162_exception_raised.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When an exception is raised > Then a step passes > > Scenario: > Given a step passes > """ > When I run "behave -f plain features/example0162_exception_raised.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 1 scenario passed, 1 failed, 0 skipped > 2 steps passed, 1 failed, 1 skipped, 0 undefined > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ContextMaskWarning: user code is masking context attribute > """ > >@issue >Feature: Issue #171: Importing step from other step file fails with AmbiguousStep Error # issue.features/issue0171.feature:2 > | When a step module imports another step module > | this should not cause AmbiguousStep errors > | due to duplicated registration of the same step functions. > | > | NOTES: > | * In general you should avoid this case (provided as example here). > @reuse.colocated_test > Scenario: Step module imports other step module # issue.features/issue0171.feature:13 > Given I use the current directory as working directory # behave4cmd0/command_steps.py:39 > When I run "behave -f plain features/step.import_other_step_module.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > >@issue >Feature: Issue #172 Junit report file name populated incorrectly when running against a feature file # issue.features/issue0172.feature:2 > > @setup > Scenario: Feature Setup # issue.features/issue0172.feature:5 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/feature_in_root_folder.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > """ > And a file named "features/subfolder/feature_in_subfolder.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > """ > > Scenario: Running behave for one feature in root folder # issue.features/issue0172.feature:28 > When I run "behave --junit --junit-directory=test_results features/feature_in_root_folder.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > """ > And a file named "test_results/TESTS-feature_in_root_folder.xml" exists # behave4cmd0/command_steps.py:336 > > Scenario: Running behave for one feature in a subfolder # issue.features/issue0172.feature:36 > When I run "behave --junit --junit-directory=test_results features/subfolder/feature_in_subfolder.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > """ > And a file named "test_results/TESTS-subfolder.feature_in_subfolder.xml" exists # behave4cmd0/command_steps.py:336 > > Scenario: Running behave for all features # issue.features/issue0172.feature:44 > When I run "behave --junit --junit-directory=test_results" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > """ > And a file named "test_results/TESTS-feature_in_root_folder.xml" exists # behave4cmd0/command_steps.py:336 > And a file named "test_results/TESTS-subfolder.feature_in_subfolder.xml" exists # behave4cmd0/command_steps.py:336 > >@issue >Feature: Issue #175: Scenario isn't marked as 'failed' when Background step fails # issue.features/issue0175.feature:2 > Scenario has currently status "skipped" when a background step fails. > Expected is that scenario status should be "failed". > Ensure that this is the case. > RELATED: features/background.feature > REUSE: Scenario from there (as copy). > | NOTE: > | Cucumber has a slightly different behaviour. > | When a background step fails the first scenario is marked as failed. > | But the remaining scenarios are marked as skipped. > | > | This can lead to problems when you have sporadic background step failures. > | For this reason, behave retries the background steps for each scenario. > | > | SEE ALSO: > | * https://github.com/cucumber/cucumber/blob/master/features/docs/gherkin/background.feature > @setup > Scenario: Feature Setup # issue.features/issue0175.feature:24 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/background_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word} background step {outcome}') > def step_background_step_passes_or_fails(context, word, outcome): > if outcome == "fails": > assert False, "XFAIL: background step" > elif outcome == "passes": > pass > else: > message = "Unexpected outcome=%s. Use: passes, fails" > raise RuntimeError(message % outcome) > """ > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word} step passes') > def step_passes(context, word): > pass > > @step('{word} step fails') > def step_passes(context, word): > assert False, "XFAIL" > """ > > Scenario: Failing Background Step causes all Scenarios to fail # issue.features/issue0175.feature:54 > Given a file named "features/example.background_step_fails.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > Background: B1 > Given a background step passes > And a background step fails > And another background step passes > > Scenario: S1 > When a step passes > > Scenario: S2 > Then a step passes > And another step passes > """ > When I run "behave -f plain -T features/example.background_step_fails.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 2 steps passed, 2 failed, 5 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: > Background: B1 > > Scenario: S1 > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > > Scenario: S2 > Given a background step passes ... passed > And a background step fails ... failed > Assertion Failed: XFAIL: background step > """ > >@issue >Feature: Issue #177: Cannot setup logging_format # issue.features/issue0177.feature:2 > | DESCPRIPTION: > | When the logging_format is set in the behave configuration file > | or on command-line, an exception is thrown, because > | the ConfigParser tries to replace the placeholders in the format string > | with option values in the configuration file (which do not exist). > | > | SOLUTION: > | The format string must be processed as raw value (by the ConfigParser). > | > | RELATED: > | * features/logging.setup_format.feature > | * features/logging.setup_level.feature > @reuse.colocated_test > Scenario: Setup logging_format # issue.features/issue0177.feature:19 > Given I use the current directory as working directory # behave4cmd0/command_steps.py:39 > When I run "behave -f plain features/logging.setup_format.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Traceback (most recent call last): > """ > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > ConfigParser.InterpolationMissingOptionError: Bad value > """ > > @reuse.colocated_test > Scenario: Setup logging_level # issue.features/issue0177.feature:33 > Given I use the current directory as working directory # behave4cmd0/command_steps.py:39 > When I run "behave -f plain features/logging.setup_level.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > >@issue >Feature: Issue #181: Escape apostrophes in undefined steps snippets # issue.features/issue0181.feature:2 > | I have noticed that, for the following line in my features file: > | > | Then I'm redirected to http://www.example.com > | > | Behave outputs the following: > | > | @then(u'I'm redirected to http://www.example.com') > | def step_impl(context): > | assert False > Scenario: # issue.features/issue0181.feature:16 > Given a new working directory # behave4cmd0/command_steps.py:30 > And an empty file named "features/steps/steps.py" # behave4cmd0/command_steps.py:66 > And a file named "features/issue181_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I'm using an "undefined step" > """ > When I run "behave -f plain features/issue181_example.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 steps passed, 0 failed, 0 skipped, 1 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > You can implement step definitions for undefined steps with these snippets: > > @given(u'I\'m using an "undefined step"') > def step_impl(context): > raise NotImplementedError(u'STEP: Given I\'m using an "undefined step"') > """ > >@issue >Feature: Issue #184: TypeError when running behave with --include option # issue.features/issue0184.feature:2 > | Running behave with option '--include' causes fail with following error: > | > | Traceback (most recent call last): > | File "/.../bin/behave", line 8, in > | load_entry_point('behave==1.2.3', 'console_scripts', 'behave')() > | File "/.../lib/python2.7/site-packages/behave/__main__.py", line 111, in main > | ... > | File "/.../lib/python2.7/site-packages/behave/runner.py", line 490, in run_with_paths > | if not self.config.exclude(filename) ] > | File "/.../lib/python2.7/site-packages/behave/configuration.py", line 488, in exclude > | if self.include_re and self.include_re.search(filename) is None: > | TypeError: expected string or buffer > | > | RELATED: > | * features/runner.select_files_by_regexp.feature > | * features/runner.select_files_by_regexp2.feature > @setup > Scenario: Feature Setup # issue.features/issue0184.feature:22 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/passing_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > """ > And a file named "features/alice.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Alice > Scenario: A1 > Given a step passes > """ > And a file named "features/bob.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Bob > Scenario: B1 > When another step passes > > Scenario: B2 > Then another step passes > """ > > Scenario: Use --include command-line option to select some features # issue.features/issue0184.feature:48 > When I run "behave -f plain --include='features/a.*\.feature'" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Bob > """ > > Scenario: Use --include command-line option to select all features # issue.features/issue0184.feature:65 > When I run "behave -f plain --include='.*\.feature'" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 2 features passed, 0 failed, 0 skipped > 3 scenarios passed, 0 failed, 0 skipped > """ > > Scenario: Use --exclude command-line option # issue.features/issue0184.feature:74 > When I run "behave -f plain --exclude='features/a.*\.feature'" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > """ > > Scenario: Use --include and --exclude command-line options # issue.features/issue0184.feature:91 > When I run "behave -f plain --include='.*\.feature' --exclude='features/a.*\.feature'" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 2 scenarios passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > """ > > Scenario: Use --include command-line option with file location # issue.features/issue0184.feature:107 > When I run "behave -f plain --include='features/a.*\.feature' features/alice.feature:3" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 0 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Alice > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Bob > """ > > Scenario: Use --exclude command-line option with feature list file # issue.features/issue0184.feature:123 > Given a file named "selected.txt" with # behave4cmd0/command_steps.py:50 > """ > # -- FEATURE-LIST FILE: > features/alice.feature:3 > features/bob.feature:7 > """ > When I run "behave -f plain --no-skipped --exclude='.*/a.*\.feature' @selected.txt" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 1 skipped > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: Bob > Scenario: B2 > """ > But the command output should not contain # behave4cmd0/command_steps.py:243 > """ > Feature: Alice > """ > >@issue >Feature: Issue #186: ScenarioOutline uses wrong return value when if fails # issue.features/issue0186.feature:2 > ScenarioOutline returns encountered a failure only if the last scenario failed. > Failures in earlier examples return the wrong result. > Ensure that ScenarioOutline run-logic behaves as expected. > @reuse.colocated_test > Scenario: Reuse existing test # issue.features/issue0186.feature:9 > Given I use the current directory as working directory # behave4cmd0/command_steps.py:39 > When I run "behave -f plain features/scenario_outline.basics.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > >@issue >Feature: Issue #188: Better diagnostics if nested step is undefined # issue.features/issue0188.feature:2 > | Currently if nested step has no match, it's shown like this: > | > | Assertion Failed: Sub-step failed: When I do strange thign > | Substep info: None > | > | Took some time to find that typo. > | The suggestion is to fill substep error_message with at least "No match for step" > | so it would become: > | > | Assertion Failed: Sub-step failed: When I do strange thign > | Substep info: No match for step > | > | IMPLEMENTATION NOTE: > | A slightly different output is provided: > | > | Assertion Failed: UNDEFINED SUB-STEP: When I do strange thign > Scenario: Nested steps contain an undefined step # issue.features/issue0188.feature:22 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @then('a good diagnostic message is shown') > def step_good_diagnostic_message_is_shown(context): > pass > > @step('I execute nested steps with an undefined step') > def step_passes(context): > context.execute_steps(u''' > Given another step passes > When an undefined, nested step is executed > Then third step passes > ''') > """ > And a file named "features/example.execute_nested_undefined_step.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step passes > When I execute nested steps with an undefined step > Then a good diagnostic message is shown > """ > When I run "behave -f plain -T features/example.execute_nested_undefined_step.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > Scenario: > Given a step passes ... passed > When I execute nested steps with an undefined step ... failed > Assertion Failed: UNDEFINED SUB-STEP: When an undefined, nested step is executed > """ > >@issue >Feature: Issue #191 Using context.execute_steps() may change context.table/.text # issue.features/issue0191.feature:2 > | PROBLEM DESCRIPTION: > | When you execute nested steps via "context.execute_steps()" in a > | step implementation, the following context attributes of the current step > | may be modified and may be longer valid: > | * context.text (multi-line text) > | * context.table > @setup > Scenario: Feature Setup # issue.features/issue0191.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/common_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, step > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @given('I define the following nested steps') > def step_define_nested_steps(context): > assert context.text is not None, "REQUIRE: text" > context.nested_steps = context.text > """ > And a file named "features/steps/table_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import when, then, step > > @step('I use another table with') > def step_use_another_table_with(context): > assert context.table, "REQUIRE: table" > context.nested_table = context.table > > @when('I execute the nested steps and use the table') > def step_execute_nested_steps_and_use_table(context): > assert context.table, "REQUIRE: table" > assert context.nested_steps, "REQUIRE: context.nested_steps" > context.my_table1 = context.table > context.execute_steps(context.nested_steps) > context.my_table2 = context.table > > @then('the original table is restored after the nested steps are executed') > def step_table_is_restored(context): > assert context.my_table1 is not None > assert context.my_table2 is not None > assert context.my_table1 is context.my_table2 > """ > And a file named "features/steps/text_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import when, then, step > > @step('I use another step with text "{text}"') > def step_use_another_text_with(context, text): > assert context.text is None > context.text = text # -- MODIFY: context.text (emulation) > > @step('I use another text with') > def step_use_another_text_with(context): > assert context.text is not None, "REQUIRE: text" > context.nested_text = context.text > > @when('I execute the nested steps and use the text') > def step_execute_nested_steps_and_use_text(context): > assert context.text is not None, "REQUIRE: text" > assert context.nested_steps, "REQUIRE: context.nested_steps" > context.my_text1 = context.text > context.execute_steps(context.nested_steps) > context.my_text2 = context.text > > @then('the original text is restored after the nested steps are executed') > def step_text_is_restored(context): > assert context.my_text1 is not None > assert context.my_text2 is not None > assert context.my_text1 is context.my_text2 > """ > > @nested_steps.with_table > Scenario: After executing simple nested steps the original table is restored # issue.features/issue0191.feature:81 > Given a file named "features/example.nested_simple_steps_and_table.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I define the following nested steps: > ''' > Given a step passes > When another step passes > ''' > When I execute the nested steps and use the table: > | Name | Age | > | Alice | 21 | > | Bob | 32 | > Then the original table is restored after the nested steps are executed > """ > When I run "behave -f plain -T features/example.nested_simple_steps_and_table.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @nested_steps.with_table > Scenario: After executing nested steps with a table the original table is restored # issue.features/issue0191.feature:105 > Given a file named "features/example.nested_steps_and_table.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I define the following nested steps: > ''' > Given I use another table with: > | Person | Registered | > | Anton | true | > | Barby | false | > ''' > When I execute the nested steps and use the table: > | Name | Age | > | Charly | 41 | > | Doro | 52 | > Then the original table is restored after the nested steps are executed > """ > When I run "behave -f plain -T features/example.nested_steps_and_table.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @nested_steps.with_text > Scenario: After executing simple nested steps the original text is restored # issue.features/issue0191.feature:132 > Given a file named "features/example.nested_simple_steps_and_text.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I define the following nested steps: > ''' > Given a step passes > When another step passes > ''' > When I execute the nested steps and use the text: > ''' > Lorem ipsum > Ipsum lorem > ''' > Then the original text is restored after the nested steps are executed > """ > When I run "behave -f plain -T features/example.nested_simple_steps_and_text.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > > @nested_steps.with_text > Scenario: After executing nested steps with a text the original text is restored # issue.features/issue0191.feature:157 > Given a file named "features/example.nested_steps_and_text.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given I define the following nested steps: > ''' > Given I use another step with text "Hello Alice" > ''' > When I execute the nested steps and use the text: > ''' > Lorem ipsum > Ipsum lorem > ''' > Then the original text is restored after the nested steps are executed > """ > When I run "behave -f plain -T features/example.nested_steps_and_text.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > 3 steps passed, 0 failed, 0 skipped, 0 undefined > """ > >@issue >Feature: Issue #194: Nested steps prevent that original stdout/stderr is restored # issue.features/issue0194.feature:2 > | When nested steps are used, > | the original stdout/stderr streams are not restored after the scenario. > | This is caused by starting/stopping capture again while executing nested steps. > | > | ENSURE THAT: > | * Original streams are restored in after_scenario() hook. > | * Nested steps should not replace existing capture objects. > @setup > Scenario: Feature Setup # issue.features/issue0194.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > log_capture = false > logging_level = INFO > logging_format = LOG.%(levelname)-8s %(name)s: %(message)s > """ > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.passing_steps > import behave4cmd0.failing_steps > import behave4cmd0.note_steps > """ > And a file named "features/steps/stdout_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, when, then, step, matchers > import parse > import sys > > # -- USER-DEFINED DATA TYPES: > @parse.with_pattern(r"stdout|stderr") > def parse_stream_name(text): > assert text in ("stdout", "stderr") > return text > > matchers.register_type(StreamName=parse_stream_name) > > # -- UTILITY FUNCTIONS: > def write_text_to(stream, text, enforce_newline=True): > if enforce_newline and not text.endswith("\n"): > text += "\n" > stream.write(text) > > # -- STEP DEFINITIONS: > @step('I write "{text}" to {stream_name:StreamName}') > def step_write_text_to_stdxxx(context, text, stream_name): > stream = getattr(sys, stream_name) > write_text_to(stream, text) > > @step('I execute the following steps') > def step_execute_steps(context): > assert context.text, "REQUIRE: context.text" > context.execute_steps(context.text) > sys.stdout.write("STDOUT:AFTER-EXECUTE-STEPS\n") > sys.stderr.write("STDERR:AFTER-EXECUTE-STEPS\n") > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > import sys > > stdout_id = 0 > stderr_id = 0 > > def stdout_print(text): > sys.__stdout__.write(text + "\n") > > def inspect_stdout(context, scope, statement): > global stdout_id > stream_id = id(sys.stdout) > stream_class = sys.stdout.__class__.__name__ > expected_id = stdout_id > if stream_id != expected_id: > name = statement.name > stdout_print("CHANGED-STDOUT %s:%s: stream.id=%s:%d (was: %d)" % \ > (scope, name, stream_class, stream_id, expected_id)) > stdout_id = stream_id > > def inspect_stderr(context, scope, statement): > global stderr_id > stream_id = id(sys.stderr) > stream_class = sys.stderr.__class__.__name__ > expected_id = stderr_id > if stream_id != expected_id: > name = statement.name > stdout_print("CHANGED-STDERR %s:%s: stream.id=%s:%d (was: %d)" % \ > (scope, name, stream_class, stream_id, expected_id)) > stderr_id = stream_id > > def inspect_stdxxx(context, scope, statement): > inspect_stdout(context, scope, statement) > inspect_stderr(context, scope, statement) > > def before_all(context): > context.config.setup_logging(filename="behave.log") > > def before_scenario(context, scenario): > inspect_stdxxx(context, "before_scenario", scenario) > > def after_scenario(context, scenario): > inspect_stdxxx(context, "after_scenario", scenario) > # -- ENSURE: Original streams are restored. > assert sys.stdout is sys.__stdout__ > assert sys.stderr is sys.__stderr__ > stdout_print("AFTER-SCENARIO %s: Streams are restored." % scenario.name) > > def before_step(context, step): > inspect_stdxxx(context, "before_step", step) > > def after_step(context, step): > inspect_stdxxx(context, "after_step", step) > """ > > Scenario: Stdout capture works with nested steps # issue.features/issue0194.feature:117 > Given a file named "features/stdout.failing_with_nested.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing with nested steps > Given I write "STDOUT:Hello Alice" to stdout > When I write "STDOUT:Hello Bob" to stdout > Then I execute the following steps: > ''' > * I write "STDOUT:Hello nested.Alice" to stdout > * I write "STDOUT:Hello nested.Bob" to stdout > ''' > And I write "STDOUT:Hello Charly" to stdout > And another step fails > > Scenario: Another failing > Given I write "STDOUT:Hello Dora" to stdout > And another step fails > """ > When I run "behave -f plain features/stdout.failing_with_nested.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 5 steps passed, 2 failed, 0 skipped, 0 undefined > """ > And note that "the summary is only shown if hooks have no errors" # behave4cmd0/note_steps.py:15 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stdout: > STDOUT:Hello Alice > STDOUT:Hello Bob > STDOUT:Hello nested.Alice > STDOUT:Hello nested.Bob > STDOUT:AFTER-EXECUTE-STEPS > STDOUT:Hello Charly > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stdout: > STDOUT:Hello Dora > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > AFTER-SCENARIO Failing with nested steps: Streams are restored. > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > AFTER-SCENARIO Another failing: Streams are restored. > """ > > Scenario: Stderr capture works with nested steps # issue.features/issue0194.feature:167 > Given a file named "features/stderr.failing_with_nested.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Failing with nested steps > Given I write "STDERR:Hello Alice" to stderr > When I write "STDERR:Hello Bob" to stderr > Then I execute the following steps: > ''' > * I write "STDERR:Hello nested.Alice" to stderr > * I write "STDERR:Hello nested.Bob" to stderr > ''' > And I write "STDERR:Hello Charly" to stderr > And another step fails > > Scenario: Another failing > Given I write "STDERR:Hello Dora" to stderr > And another step fails > """ > When I run "behave -f plain features/stderr.failing_with_nested.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 2 failed, 0 skipped > 5 steps passed, 2 failed, 0 skipped, 0 undefined > """ > And note that "the summary is only shown if hooks have no errors" # behave4cmd0/note_steps.py:15 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stderr: > STDERR:Hello Alice > STDERR:Hello Bob > STDERR:Hello nested.Alice > STDERR:Hello nested.Bob > STDERR:AFTER-EXECUTE-STEPS > STDERR:Hello Charly > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stderr: > STDERR:Hello Dora > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > AFTER-SCENARIO Failing with nested steps: Streams are restored. > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > AFTER-SCENARIO Another failing: Streams are restored. > """ > >@issue >Feature: Issue #216: ANSI escape sequences are used while using --wip option # issue.features/issue0216.feature:2 > | ENSURE THAT: > | * Coloring is disabled when --wip option is used. > | * In addition, no colouring is used when using --show-skipped option > | * Undefined step snippets are not "colored". > @setup > Scenario: Feature Setup # issue.features/issue0216.feature:10 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "behave.ini" with # behave4cmd0/command_steps.py:50 > """ > [behave] > default_format = pretty > show_skipped = false > show_timings = false > """ > And a file named "features/steps/use_behave4cmd_steps.py" with # behave4cmd0/command_steps.py:50 > """ > import behave4cmd0.passing_steps > import behave4cmd0.failing_steps > import behave4cmd0.note_steps > """ > And a file named "features/steps/ansi_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, then > from behave4cmd0.command_steps import step_command_output_should_not_contain_text > > @then(u'the command output should not contain any ANSI escape sequences') > def step_command_ouput_should_not_contain_ansi_sequences(context): > CSI = u"\x1b[" #< ANSI CONTROL SEQUENCE INTRODUCER (CSI). > step_command_output_should_not_contain_text(context, CSI) > """ > And a file named "features/scenario_with_undefined_steps.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > > @wip > Scenario: Alice > Given a step passes > When a step is undefined > Then a step passes > > @foo > Scenario: Bob > When another step is undefined > """ > > Scenario: When using --wip, coloring is disabled # issue.features/issue0216.feature:51 > When I run "behave --wip features" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped, 1 untested > 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Alice > Given a step passes ... passed > When a step is undefined ... undefined > """ > But the command output should not contain any ANSI escape sequences # issue.features/steps/ansi_steps.py:17 > And note that "the plain formatter is used as default formatter" # behave4cmd0/note_steps.py:15 > > Scenario: When using --wip and --show-skipped, coloring is disabled # issue.features/issue0216.feature:69 > When I run "behave --wip --show-skipped features" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped, 1 untested > 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario: Alice > Given a step passes ... passed > When a step is undefined ... undefined > """ > But the command output should not contain any ANSI escape sequences # issue.features/steps/ansi_steps.py:17 > And note that "the plain formatter is used as default formatter" # behave4cmd0/note_steps.py:15 > > Scenario: When using --wip and --format, coloring is disabled # issue.features/issue0216.feature:87 > When I run "behave --wip -f pretty features" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped, 1 untested > 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: # features/scenario_with_undefined_steps.feature:1 > > @wip > Scenario: Alice # features/scenario_with_undefined_steps.feature:4 > Given a step passes # ../behave4cmd0/passing_steps.py:23 > When a step is undefined # None > Then a step passes # None > """ > But the command output should not contain any ANSI escape sequences # issue.features/steps/ansi_steps.py:17 > And note that "the plain formatter is overridden on command-line" # behave4cmd0/note_steps.py:15 > And note that "the coloring mode is disabled" # behave4cmd0/note_steps.py:15 > > Scenario: When using --wip and --color, coloring is disabled # issue.features/issue0216.feature:110 > When I run "behave --wip -f pretty --color features" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 features passed, 1 failed, 0 skipped > 0 scenarios passed, 1 failed, 0 skipped, 1 untested > 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Feature: # features/scenario_with_undefined_steps.feature:1 > > @wip > Scenario: Alice # features/scenario_with_undefined_steps.feature:4 > Given a step passes # ../behave4cmd0/passing_steps.py:23 > When a step is undefined # None > Then a step passes # None > """ > But the command output should not contain any ANSI escape sequences # issue.features/steps/ansi_steps.py:17 > And note that "the coloring mode is overridden by the wip mode" # behave4cmd0/note_steps.py:15 > >@issue @unicode >Feature: UnicodeDecodeError in tracebacks (when an exception in a step implementation) # issue.features/issue0226.feature:3 > | Exception with non-ASCII character is raised in a step implementation. > | UnicodeDecodeError occurs with: > | 'ascii' codec can't decode byte 0x82 in position 11: ordinal not in range(128) > | > | RELATED: > | * features/i18n.unicode_problems.feature > @setup > Scenario: Feature Setup # issue.features/issue0226.feature:13 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step raises an exception with non-ASCII character "{char_code:d}"') > def step_raises_exception_with_non_ascii_text(context, char_code): > assert 0 <= char_code <= 255, "RANGE-ERROR: char_code=%s" % char_code > raise RuntimeError("FAIL:"+ chr(char_code) +";") > """ > > Scenario Outline: Syndrome with non-ASCII char 130 (format=plain) -- @1.1 # issue.features/issue0226.feature:46 > Given a file named "features/syndrome_0226_130.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step raises an exception with non-ASCII character "130" > """ > When I run "behave -f plain features/syndrome_0226_130.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should not contain "UnicodeDecodeError" # behave4cmd0/command_steps.py:174 > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > RuntimeError: FAIL: > """ > > Scenario Outline: Syndrome with non-ASCII char 190 (format=pretty) -- @1.2 # issue.features/issue0226.feature:47 > Given a file named "features/syndrome_0226_190.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step raises an exception with non-ASCII character "190" > """ > When I run "behave -f pretty features/syndrome_0226_190.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should not contain "UnicodeDecodeError" # behave4cmd0/command_steps.py:174 > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > RuntimeError: FAIL: > """ > >@feature_request @issue >Feature: Issue #228: Allow before_scenario to determine whether steps should be run. # issue.features/issue0228.feature:3 > Allow before_scenario to call mark_skipped() and early out if the current > scenario should be skipped. > Scenario: Allow before_scenario to skip the current scenario # issue.features/issue0228.feature:8 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step('a step passes') > def step_passes(context): > pass > """ > And a file named "features/environment.py" with # behave4cmd0/command_steps.py:50 > """ > def before_scenario(context, scenario): > if scenario.name == 'Skip this scenario': > scenario.skip() > """ > And a file named "features/issue228_example.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Skip this scenario > Given I'm using an "undefined step" > > Scenario: Run this scenario > Given a step passes > """ > When I run "behave -f plain features/issue228_example.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 1 skipped > 1 step passed, 0 failed, 1 skipped, 0 undefined > """ > >@issue @unicode >Feature: Assert with non-ASCII char causes UnicodeDecodeError # issue.features/issue0230.feature:3 > | Failing assert with non-ASCII character in its message > | causes UnicodeDecodeError and silent exit in Python2. > | > | RELATED: > | * features/i18n.unicode_problems.feature > @setup > Scenario: Feature Setup # issue.features/issue0230.feature:12 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step > > @step(u'a step fails with non-ASCII character "{char_code:d}"') > def step_fails_with_non_ascii_text(context, char_code): > assert 0 <= char_code <= 255, "RANGE-ERROR: char_code=%s" % char_code > assert False, "FAIL:"+ chr(char_code) +";" > """ > > Scenario Outline: Syndrome with non-ASCII char 130 (format=plain) -- @1.1 # issue.features/issue0230.feature:45 > Given a file named "features/syndrome_0230_130.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step fails with non-ASCII character "130" > """ > When I run "behave -f plain features/syndrome_0230_130.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should not contain "UnicodeDecodeError" # behave4cmd0/command_steps.py:174 > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > Assertion Failed: FAIL: > """ > > Scenario Outline: Syndrome with non-ASCII char 190 (format=pretty) -- @1.2 # issue.features/issue0230.feature:46 > Given a file named "features/syndrome_0230_190.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: > Given a step fails with non-ASCII character "190" > """ > When I run "behave -f pretty features/syndrome_0230_190.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 0 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should not contain "UnicodeDecodeError" # behave4cmd0/command_steps.py:174 > But the command output should contain # behave4cmd0/command_steps.py:227 > """ > Assertion Failed: FAIL: > """ > >@issue @not_reproducible >Feature: Issue #231: Display the output of the last print command # issue.features/issue0231.feature:3 > | The output of the last print command in a step is not displayed > | in the behave output (at least with standard pretty formatter), > | unless the string to print ends with newline ('\n'). > | > | ANALYSIS: NOT-REPRODUCIBLE > | Checked print function and stdout without newline. > | Both show the expected capture stdout output when the step fails. > @setup > Scenario: Feature Setup # issue.features/issue0231.feature:15 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/syndrome1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Alice > Given a step passes > When a step passes > Then I write "ALICE was HERE" without newline to stdout and fail > """ > And a file named "features/syndrome2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Bob > Given a step passes > Then I print "BOB was HERE" without newline and fail > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > from __future__ import print_function > from behave import step > import sys > > @step('{word:w} step passes') > def step_passes(context, word): > pass > > @step('I write "{message}" without newline to stdout and fail') > def step_write_without_newline_and_fail(context, message): > sys.stdout.write(message) > assert False, "FAIL: "+ message > > @step('I print "{message}" without newline and fail') > def step_print_without_newline_and_fail(context, message): > print(message, end="") > assert False, "FAIL: "+ message > """ > > Scenario: Write to stdout without newline # issue.features/issue0231.feature:54 > When I run "behave -f pretty -c -T features/syndrome1.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 2 steps passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stdout: > ALICE was HERE > """ > > Scenario: Use print function without newline # issue.features/issue0231.feature:67 > When I run "behave -f pretty -c -T features/syndrome2.feature" # behave4cmd0/command_steps.py:80 > Then it should fail with # behave4cmd0/command_steps.py:135 > """ > 0 scenarios passed, 1 failed, 0 skipped > 1 step passed, 1 failed, 0 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Captured stdout: > BOB was HERE > """ > >@issue @feature_request >Feature: Issue #238 Skip a Scenario in a Scenario Outline # issue.features/issue0238.feature:3 > > Scenario: # issue.features/issue0238.feature:5 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/issue238_1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Testing Scenario skipping > Scenario Outline: > Given a set of "<thing>" > When I ensure that "<thing>" != invalid > Then it should pass > > Examples: > | thing | > | valid | > | invalid | > """ > And a file named "features/steps/steps.py" with # behave4cmd0/command_steps.py:50 > """ > @given('a set of "{thing}"') > def step_check_thing_assumption(ctx, thing): > if thing == "invalid": > ctx.scenario.skip("ASSUMPTION-MISMATCH: INVALID-THING") > > @when('I ensure that "{thing}" != invalid') > def step_ensure_that_thing_is_valid(ctx, thing): > assert thing != "invalid" > > @then('it should pass') > def step_passes(context): > pass > """ > When I run "behave -f plain --show-skipped --no-timings" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 feature passed, 0 failed, 0 skipped > 1 scenario passed, 0 failed, 1 skipped > 3 steps passed, 0 failed, 3 skipped, 0 undefined > """ > And the command output should contain # behave4cmd0/command_steps.py:227 > """ > Scenario Outline: -- @1.1 > Given a set of "valid" ... passed > When I ensure that "valid" != invalid ... passed > Then it should pass ... passed > > Scenario Outline: -- @1.2 > Given a set of "invalid" ... skipped > """ > But note that "the step that skipped the scenario is also marked as skipped" # behave4cmd0/note_steps.py:15 > >@issue @unicode >Feature: UnicodeDecodeError in model.Step (when step fails) # issue.features/issue0251.feature:3 > | Output of failing step contains non-ASCII characters. > | > | RELATED: > | * features/i18n.unicode_problems.feature > @reuse.colocated_test > Scenario: # issue.features/issue0251.feature:12 > Given I use the current directory as working directory # behave4cmd0/command_steps.py:39 > When I run "behave -f plain --tags=@setup,@problematic.output features/i18n.unicode_problems.feature" # behave4cmd0/command_steps.py:80 > Then it should pass # behave4cmd0/command_steps.py:111 > >@issue >Feature: Issue #280: AmbiguousStep error with similar step definitions and use_step_matcher("re") # issue.features/issue0280.feature:2 > | While using the RegexMatcher with steps that have the same step prefix > | an AmbiguousStep exception occurs if the shorter step is registered first. > | > | EXAMPLE: > | Two steps with definitions that have the same step prefix: > | > | * I do something > | * I do something more > | > | cause an AmbiguousStep error to be thrown: > | > | behave.step_registry.AmbiguousStep: @when('I do something more') has already > | been defined in existing step @when('I do something') at ... > | > | SOLUTION: Add regex begin-/end-markers around the step text( '^'+ step + '$') > | NOTE: Only RegexMatcher is affected. > @setuo > Scenario: Feature Setup # issue.features/issue0280.feature:22 > Given a new working directory # behave4cmd0/command_steps.py:30 > And a file named "features/steps/calculator_steps1.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import given, then > from hamcrest import assert_that, equal_to > > class SimpleCalculator(object): > def __init__(self): > self.result = 0 > > def add(self, value): > self.result += value > > @given(u'a calculator') > def step_impl(context): > context.calculator = SimpleCalculator() > > @then(u'the calculator result is "{expected_result:d}"') > def step_impl(context, expected_result): > assert_that(context.calculator.result, equal_to(expected_result)) > """ > > Scenario: Ensure RegexMatcher is not ordering sensitive # issue.features/issue0280.feature:45 > Given a file named "features/syndrome_280_1.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: > Scenario: Use both steps > Given I do something > When I do something more > """ > And a file named "features/steps/simple_steps.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import step, use_step_matcher > use_step_matcher("re") > > # -- ORDERING SENSITIVE PART: > @step(u'I do something') > def step_impl(context): > pass > > @step(u'I do something more') > def step_impl(context): > pass > """ > When I run "behave -f plain features/syndrome_280_1.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > 1 scenario passed, 0 failed, 0 skipped > """ > But the command output should not contain "AmbiguousStep:" # behave4cmd0/command_steps.py:174 > And the command output should not contain # behave4cmd0/command_steps.py:243 > """ > AmbiguousStep: @step('I do something more') has already been defined in > existing step @step('I do something') at features/steps/simple_steps.py:5' > """ > > Scenario: Ensure correct step implementation is selected # issue.features/issue0280.feature:79 > Given a file named "features/syndrome_280_2.feature" with # behave4cmd0/command_steps.py:50 > """ > Feature: Steps with same step prefix -- Use correct step implementation > Scenario: Use shorter step > Given a calculator > When I add "2" to it > And I add "3" to it > Then the calculator result is "5" > > Scenario: Use longer step > Given a calculator > When I add "2" to it twice > And I add "3" to it > Then the calculator result is "7" > """ > And a file named "features/steps/calculator_steps2.py" with # behave4cmd0/command_steps.py:50 > """ > from behave import when, use_step_matcher > use_step_matcher("re") > > # -- ORDERING SENSITIVE PART: > @when(u'I add "(?P<value>\d+)" to it') > def step_impl(context, value): > number_value = int(value) > context.calculator.add(number_value) > > @when(u'I add "(?P<value>\d+)" to it twice') > def step_impl(context, value): > number_value = int(value) > context.calculator.add(number_value) > context.calculator.add(number_value) > """ > When I run "behave -f pretty --no-color features/syndrome_280_2.feature" # behave4cmd0/command_steps.py:80 > Then it should pass with # behave4cmd0/command_steps.py:119 > """ > When I add "2" to it twice # features/steps/calculator_steps2.py:10 > And I add "3" to it # features/steps/calculator_steps2.py:5 > """ > But the command output should not contain "AmbiguousStep" # behave4cmd0/command_steps.py:174 > >62 features passed, 0 failed, 0 skipped >160 scenarios passed, 0 failed, 0 skipped >779 steps passed, 0 failed, 0 skipped, 0 undefined >Took 0m32.729s > * python3_6: running distutils-r1_run_phase python_test >.............................................................................................................................................................................................EE................................E....................................................................................................................................................................................................................................................................................................................................................................................................... >====================================================================== >ERROR: test_run_runs_named_scenarios (test.test_model.TestFeatureRun) >---------------------------------------------------------------------- >Traceback (most recent call last): > File "/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5/test/test_model.py", line 85, in test_run_runs_named_scenarios > self.config.name_re = Configuration.build_name_re(self.config.name) > File "/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5/behave/configuration.py", line 665, in build_name_re > return re.compile(pattern, flags=(re.UNICODE | re.LOCALE)) > File "/usr/lib64/python3.6/re.py", line 233, in compile > return _compile(pattern, flags) > File "/usr/lib64/python3.6/re.py", line 301, in _compile > p = sre_compile.compile(pattern, flags) > File "/usr/lib64/python3.6/sre_compile.py", line 562, in compile > p = sre_parse.parse(p, flags) > File "/usr/lib64/python3.6/sre_parse.py", line 865, in parse > p.pattern.flags = fix_flags(str, p.pattern.flags) > File "/usr/lib64/python3.6/sre_parse.py", line 832, in fix_flags > raise ValueError("cannot use LOCALE flag with a str pattern") >ValueError: cannot use LOCALE flag with a str pattern > >====================================================================== >ERROR: test_run_runs_named_scenarios_with_regexp (test.test_model.TestFeatureRun) >---------------------------------------------------------------------- >Traceback (most recent call last): > File "/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5/test/test_model.py", line 112, in test_run_runs_named_scenarios_with_regexp > self.config.name_re = Configuration.build_name_re(self.config.name) > File "/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5/behave/configuration.py", line 665, in build_name_re > return re.compile(pattern, flags=(re.UNICODE | re.LOCALE)) > File "/usr/lib64/python3.6/re.py", line 233, in compile > return _compile(pattern, flags) > File "/usr/lib64/python3.6/re.py", line 301, in _compile > p = sre_compile.compile(pattern, flags) > File "/usr/lib64/python3.6/sre_compile.py", line 562, in compile > p = sre_parse.parse(p, flags) > File "/usr/lib64/python3.6/sre_parse.py", line 865, in parse > p.pattern.flags = fix_flags(str, p.pattern.flags) > File "/usr/lib64/python3.6/sre_parse.py", line 832, in fix_flags > raise ValueError("cannot use LOCALE flag with a str pattern") >ValueError: cannot use LOCALE flag with a str pattern > >====================================================================== >ERROR: test_should_run_with_name_select (test.test_model.TestScenarioRun) >---------------------------------------------------------------------- >Traceback (most recent call last): > File "/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5/test/test_model.py", line 261, in test_should_run_with_name_select > self.config.name_re = Configuration.build_name_re(self.config.name) > File "/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5/behave/configuration.py", line 665, in build_name_re > return re.compile(pattern, flags=(re.UNICODE | re.LOCALE)) > File "/usr/lib64/python3.6/re.py", line 233, in compile > return _compile(pattern, flags) > File "/usr/lib64/python3.6/re.py", line 301, in _compile > p = sre_compile.compile(pattern, flags) > File "/usr/lib64/python3.6/sre_compile.py", line 562, in compile > p = sre_parse.parse(p, flags) > File "/usr/lib64/python3.6/sre_parse.py", line 865, in parse > p.pattern.flags = fix_flags(str, p.pattern.flags) > File "/usr/lib64/python3.6/sre_parse.py", line 832, in fix_flags > raise ValueError("cannot use LOCALE flag with a str pattern") >ValueError: cannot use LOCALE flag with a str pattern > >---------------------------------------------------------------------- >Ran 615 tests in 1.000s > >FAILED (errors=3) > * ERROR: dev-python/behave-1.2.5-r1::gentoo failed (test phase): > * nosetests failed under python3.6 > * > * Call stack: > * ebuild.sh, line 124: Called src_test > * environment, line 2658: Called distutils-r1_src_test > * environment, line 898: Called _distutils-r1_run_foreach_impl 'python_test' > * environment, line 349: Called python_foreach_impl 'distutils-r1_run_phase' 'python_test' > * environment, line 2183: Called multibuild_foreach_variant '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' > * environment, line 1552: Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' > * environment, line 1550: Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'python_test' > * environment, line 561: Called distutils-r1_run_phase 'python_test' > * environment, line 829: Called python_test > * environment, line 2557: Called die > * The specific snippet of code: > * nosetests || die "nosetests failed under ${EPYTHON}"; > * > * If you need support, post the output of `emerge --info '=dev-python/behave-1.2.5-r1::gentoo'`, > * the complete build log and the output of `emerge -pqv '=dev-python/behave-1.2.5-r1::gentoo'`. > * The complete build log is located at '/var/log/portage/dev-python:behave-1.2.5-r1:20180825-131615.log'. > * For convenience, a symlink to the build log is located at '/var/tmp/portage/dev-python/behave-1.2.5-r1/temp/build.log'. > * The ebuild environment file is located at '/var/tmp/portage/dev-python/behave-1.2.5-r1/temp/environment'. > * Working directory: '/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5' > * S: '/var/tmp/portage/dev-python/behave-1.2.5-r1/work/behave-1.2.5'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 664576
:
544990
| 544992 |
544994
|
544996
|
544998
|
545000