busser-behave 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.cane +0 -0
- data/.gitignore +17 -0
- data/.tailor +4 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/LICENSE +15 -0
- data/README.md +41 -0
- data/Rakefile +68 -0
- data/busser-behave.gemspec +30 -0
- data/features/plugin_install_command.feature +11 -0
- data/features/plugin_list_command.feature +8 -0
- data/features/support/env.rb +13 -0
- data/features/test_command.feature +31 -0
- data/lib/busser/behave/version.rb +26 -0
- data/lib/busser/runner_plugin/behave.rb +37 -0
- data/vendor/behave/CHANGES.rst +483 -0
- data/vendor/behave/LICENSE +23 -0
- data/vendor/behave/MANIFEST.in +37 -0
- data/vendor/behave/PROJECT_INFO.rst +21 -0
- data/vendor/behave/README.rst +112 -0
- data/vendor/behave/VERSION.txt +1 -0
- data/vendor/behave/behave.ini +22 -0
- data/vendor/behave/behave/__init__.py +30 -0
- data/vendor/behave/behave/__main__.py +187 -0
- data/vendor/behave/behave/_stepimport.py +185 -0
- data/vendor/behave/behave/_types.py +134 -0
- data/vendor/behave/behave/api/__init__.py +7 -0
- data/vendor/behave/behave/api/async_step.py +283 -0
- data/vendor/behave/behave/capture.py +227 -0
- data/vendor/behave/behave/compat/__init__.py +5 -0
- data/vendor/behave/behave/compat/collections.py +20 -0
- data/vendor/behave/behave/configuration.py +788 -0
- data/vendor/behave/behave/contrib/__init__.py +0 -0
- data/vendor/behave/behave/contrib/scenario_autoretry.py +73 -0
- data/vendor/behave/behave/formatter/__init__.py +12 -0
- data/vendor/behave/behave/formatter/_builtins.py +39 -0
- data/vendor/behave/behave/formatter/_registry.py +135 -0
- data/vendor/behave/behave/formatter/ansi_escapes.py +91 -0
- data/vendor/behave/behave/formatter/base.py +200 -0
- data/vendor/behave/behave/formatter/formatters.py +57 -0
- data/vendor/behave/behave/formatter/json.py +253 -0
- data/vendor/behave/behave/formatter/null.py +12 -0
- data/vendor/behave/behave/formatter/plain.py +158 -0
- data/vendor/behave/behave/formatter/pretty.py +351 -0
- data/vendor/behave/behave/formatter/progress.py +287 -0
- data/vendor/behave/behave/formatter/rerun.py +114 -0
- data/vendor/behave/behave/formatter/sphinx_steps.py +372 -0
- data/vendor/behave/behave/formatter/sphinx_util.py +118 -0
- data/vendor/behave/behave/formatter/steps.py +497 -0
- data/vendor/behave/behave/formatter/tags.py +178 -0
- data/vendor/behave/behave/i18n.py +614 -0
- data/vendor/behave/behave/importer.py +102 -0
- data/vendor/behave/behave/json_parser.py +264 -0
- data/vendor/behave/behave/log_capture.py +233 -0
- data/vendor/behave/behave/matchers.py +402 -0
- data/vendor/behave/behave/model.py +1737 -0
- data/vendor/behave/behave/model_core.py +416 -0
- data/vendor/behave/behave/model_describe.py +105 -0
- data/vendor/behave/behave/parser.py +615 -0
- data/vendor/behave/behave/reporter/__init__.py +0 -0
- data/vendor/behave/behave/reporter/base.py +45 -0
- data/vendor/behave/behave/reporter/junit.py +473 -0
- data/vendor/behave/behave/reporter/summary.py +94 -0
- data/vendor/behave/behave/runner.py +753 -0
- data/vendor/behave/behave/runner_util.py +417 -0
- data/vendor/behave/behave/step_registry.py +112 -0
- data/vendor/behave/behave/tag_expression.py +111 -0
- data/vendor/behave/behave/tag_matcher.py +465 -0
- data/vendor/behave/behave/textutil.py +137 -0
- data/vendor/behave/behave/userdata.py +130 -0
- data/vendor/behave/behave4cmd0/__all_steps__.py +12 -0
- data/vendor/behave/behave4cmd0/__init__.py +5 -0
- data/vendor/behave/behave4cmd0/__setup.py +11 -0
- data/vendor/behave/behave4cmd0/command_shell.py +216 -0
- data/vendor/behave/behave4cmd0/command_shell_proc.py +256 -0
- data/vendor/behave/behave4cmd0/command_steps.py +532 -0
- data/vendor/behave/behave4cmd0/command_util.py +147 -0
- data/vendor/behave/behave4cmd0/failing_steps.py +49 -0
- data/vendor/behave/behave4cmd0/log/__init__.py +1 -0
- data/vendor/behave/behave4cmd0/log/steps.py +395 -0
- data/vendor/behave/behave4cmd0/note_steps.py +29 -0
- data/vendor/behave/behave4cmd0/passing_steps.py +36 -0
- data/vendor/behave/behave4cmd0/pathutil.py +146 -0
- data/vendor/behave/behave4cmd0/setup_command_shell.py +24 -0
- data/vendor/behave/behave4cmd0/textutil.py +304 -0
- data/vendor/behave/bin/behave +44 -0
- data/vendor/behave/bin/behave.cmd +10 -0
- data/vendor/behave/bin/behave.junit_filter.py +85 -0
- data/vendor/behave/bin/behave.step_durations.py +163 -0
- data/vendor/behave/bin/behave2cucumber_json.py +63 -0
- data/vendor/behave/bin/behave_cmd.py +44 -0
- data/vendor/behave/bin/convert_i18n_yaml.py +77 -0
- data/vendor/behave/bin/explore_platform_encoding.py +24 -0
- data/vendor/behave/bin/i18n.yml +621 -0
- data/vendor/behave/bin/invoke +8 -0
- data/vendor/behave/bin/invoke.cmd +9 -0
- data/vendor/behave/bin/json.format.py +167 -0
- data/vendor/behave/bin/jsonschema_validate.py +122 -0
- data/vendor/behave/bin/make_localpi.py +279 -0
- data/vendor/behave/bin/project_bootstrap.sh +30 -0
- data/vendor/behave/bin/toxcmd.py +270 -0
- data/vendor/behave/bin/toxcmd3.py +270 -0
- data/vendor/behave/conftest.py +27 -0
- data/vendor/behave/docs/Makefile +154 -0
- data/vendor/behave/docs/_static/agogo.css +501 -0
- data/vendor/behave/docs/_static/behave_logo.png +0 -0
- data/vendor/behave/docs/_static/behave_logo1.png +0 -0
- data/vendor/behave/docs/_static/behave_logo2.png +0 -0
- data/vendor/behave/docs/_static/behave_logo3.png +0 -0
- data/vendor/behave/docs/_themes/LICENSE +45 -0
- data/vendor/behave/docs/_themes/kr/layout.html +17 -0
- data/vendor/behave/docs/_themes/kr/relations.html +19 -0
- data/vendor/behave/docs/_themes/kr/static/flasky.css_t +480 -0
- data/vendor/behave/docs/_themes/kr/static/small_flask.css +90 -0
- data/vendor/behave/docs/_themes/kr/theme.conf +7 -0
- data/vendor/behave/docs/_themes/kr_small/layout.html +22 -0
- data/vendor/behave/docs/_themes/kr_small/static/flasky.css_t +287 -0
- data/vendor/behave/docs/_themes/kr_small/theme.conf +10 -0
- data/vendor/behave/docs/api.rst +408 -0
- data/vendor/behave/docs/appendix.rst +19 -0
- data/vendor/behave/docs/behave.rst +640 -0
- data/vendor/behave/docs/behave.rst-template +86 -0
- data/vendor/behave/docs/behave_ecosystem.rst +81 -0
- data/vendor/behave/docs/comparison.rst +85 -0
- data/vendor/behave/docs/conf.py +293 -0
- data/vendor/behave/docs/context_attributes.rst +66 -0
- data/vendor/behave/docs/django.rst +192 -0
- data/vendor/behave/docs/formatters.rst +61 -0
- data/vendor/behave/docs/gherkin.rst +673 -0
- data/vendor/behave/docs/index.rst +57 -0
- data/vendor/behave/docs/install.rst +60 -0
- data/vendor/behave/docs/more_info.rst +184 -0
- data/vendor/behave/docs/new_and_noteworthy.rst +18 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.4.rst +11 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.5.rst +814 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.6.rst +255 -0
- data/vendor/behave/docs/parse_builtin_types.rst +59 -0
- data/vendor/behave/docs/philosophy.rst +235 -0
- data/vendor/behave/docs/regular_expressions.rst +71 -0
- data/vendor/behave/docs/related.rst +14 -0
- data/vendor/behave/docs/test_domains.rst +62 -0
- data/vendor/behave/docs/tutorial.rst +636 -0
- data/vendor/behave/docs/update_behave_rst.py +100 -0
- data/vendor/behave/etc/json/behave.json-schema +172 -0
- data/vendor/behave/etc/junit.xml/behave_junit.xsd +103 -0
- data/vendor/behave/etc/junit.xml/junit-4.xsd +92 -0
- data/vendor/behave/examples/async_step/README.txt +8 -0
- data/vendor/behave/examples/async_step/behave.ini +14 -0
- data/vendor/behave/examples/async_step/features/async_dispatch.feature +8 -0
- data/vendor/behave/examples/async_step/features/async_run.feature +6 -0
- data/vendor/behave/examples/async_step/features/environment.py +28 -0
- data/vendor/behave/examples/async_step/features/steps/async_dispatch_steps.py +26 -0
- data/vendor/behave/examples/async_step/features/steps/async_steps34.py +10 -0
- data/vendor/behave/examples/async_step/features/steps/async_steps35.py +10 -0
- data/vendor/behave/examples/async_step/testrun_example.async_dispatch.txt +11 -0
- data/vendor/behave/examples/async_step/testrun_example.async_run.txt +9 -0
- data/vendor/behave/examples/env_vars/README.rst +26 -0
- data/vendor/behave/examples/env_vars/behave.ini +15 -0
- data/vendor/behave/examples/env_vars/behave_run.output_example.txt +12 -0
- data/vendor/behave/examples/env_vars/features/env_var.feature +6 -0
- data/vendor/behave/examples/env_vars/features/steps/env_var_steps.py +38 -0
- data/vendor/behave/features/README.txt +12 -0
- data/vendor/behave/features/background.feature +392 -0
- data/vendor/behave/features/capture_stderr.feature +172 -0
- data/vendor/behave/features/capture_stdout.feature +125 -0
- data/vendor/behave/features/cmdline.lang_list.feature +33 -0
- data/vendor/behave/features/configuration.default_paths.feature +116 -0
- data/vendor/behave/features/context.global_params.feature +35 -0
- data/vendor/behave/features/context.local_params.feature +17 -0
- data/vendor/behave/features/directory_layout.advanced.feature +147 -0
- data/vendor/behave/features/directory_layout.basic.feature +75 -0
- data/vendor/behave/features/directory_layout.basic2.feature +87 -0
- data/vendor/behave/features/environment.py +53 -0
- data/vendor/behave/features/exploratory_testing.with_table.feature +141 -0
- data/vendor/behave/features/feature.description.feature +0 -0
- data/vendor/behave/features/feature.exclude_from_run.feature +96 -0
- data/vendor/behave/features/formatter.help.feature +30 -0
- data/vendor/behave/features/formatter.json.feature +420 -0
- data/vendor/behave/features/formatter.progress3.feature +235 -0
- data/vendor/behave/features/formatter.rerun.feature +296 -0
- data/vendor/behave/features/formatter.steps.feature +181 -0
- data/vendor/behave/features/formatter.steps_catalog.feature +100 -0
- data/vendor/behave/features/formatter.steps_doc.feature +140 -0
- data/vendor/behave/features/formatter.steps_usage.feature +404 -0
- data/vendor/behave/features/formatter.tags.feature +134 -0
- data/vendor/behave/features/formatter.tags_location.feature +183 -0
- data/vendor/behave/features/formatter.user_defined.feature +196 -0
- data/vendor/behave/features/i18n.unicode_problems.feature +445 -0
- data/vendor/behave/features/logcapture.clear_handlers.feature +114 -0
- data/vendor/behave/features/logcapture.feature +188 -0
- data/vendor/behave/features/logcapture.filter.feature +130 -0
- data/vendor/behave/features/logging.no_capture.feature +99 -0
- data/vendor/behave/features/logging.setup_format.feature +157 -0
- data/vendor/behave/features/logging.setup_level.feature +168 -0
- data/vendor/behave/features/logging.setup_with_configfile.feature +137 -0
- data/vendor/behave/features/parser.background.sad_cases.feature +129 -0
- data/vendor/behave/features/parser.feature.sad_cases.feature +144 -0
- data/vendor/behave/features/runner.abort_by_user.feature +305 -0
- data/vendor/behave/features/runner.continue_after_failed_step.feature +136 -0
- data/vendor/behave/features/runner.default_format.feature +175 -0
- data/vendor/behave/features/runner.dry_run.feature +184 -0
- data/vendor/behave/features/runner.feature_listfile.feature +223 -0
- data/vendor/behave/features/runner.hook_errors.feature +382 -0
- data/vendor/behave/features/runner.multiple_formatters.feature +285 -0
- data/vendor/behave/features/runner.scenario_autoretry.feature +131 -0
- data/vendor/behave/features/runner.select_files_by_regexp.example.feature +71 -0
- data/vendor/behave/features/runner.select_files_by_regexp.feature +84 -0
- data/vendor/behave/features/runner.select_scenarios_by_file_location.feature +403 -0
- data/vendor/behave/features/runner.select_scenarios_by_name.feature +289 -0
- data/vendor/behave/features/runner.select_scenarios_by_tag.feature +225 -0
- data/vendor/behave/features/runner.stop_after_failure.feature +122 -0
- data/vendor/behave/features/runner.tag_logic.feature +67 -0
- data/vendor/behave/features/runner.unknown_formatter.feature +23 -0
- data/vendor/behave/features/runner.use_stage_implementations.feature +126 -0
- data/vendor/behave/features/scenario.description.feature +171 -0
- data/vendor/behave/features/scenario.exclude_from_run.feature +217 -0
- data/vendor/behave/features/scenario_outline.basics.feature +100 -0
- data/vendor/behave/features/scenario_outline.improved.feature +177 -0
- data/vendor/behave/features/scenario_outline.name_annotation.feature +157 -0
- data/vendor/behave/features/scenario_outline.parametrized.feature +401 -0
- data/vendor/behave/features/scenario_outline.tagged_examples.feature +118 -0
- data/vendor/behave/features/step.async_steps.feature +225 -0
- data/vendor/behave/features/step.duplicated_step.feature +106 -0
- data/vendor/behave/features/step.execute_steps.feature +59 -0
- data/vendor/behave/features/step.execute_steps.with_table.feature +65 -0
- data/vendor/behave/features/step.import_other_step_module.feature +103 -0
- data/vendor/behave/features/step.pending_steps.feature +128 -0
- data/vendor/behave/features/step.undefined_steps.feature +307 -0
- data/vendor/behave/features/step.use_step_library.feature +44 -0
- data/vendor/behave/features/step_dialect.generic_steps.feature +189 -0
- data/vendor/behave/features/step_dialect.given_when_then.feature +89 -0
- data/vendor/behave/features/step_param.builtin_types.with_float.feature +239 -0
- data/vendor/behave/features/step_param.builtin_types.with_integer.feature +305 -0
- data/vendor/behave/features/step_param.custom_types.feature +134 -0
- data/vendor/behave/features/steps/behave_active_tags_steps.py +86 -0
- data/vendor/behave/features/steps/behave_context_steps.py +67 -0
- data/vendor/behave/features/steps/behave_model_tag_logic_steps.py +105 -0
- data/vendor/behave/features/steps/behave_model_util.py +105 -0
- data/vendor/behave/features/steps/behave_select_files_steps.py +83 -0
- data/vendor/behave/features/steps/behave_tag_expression_steps.py +166 -0
- data/vendor/behave/features/steps/behave_undefined_steps.py +101 -0
- data/vendor/behave/features/steps/use_steplib_behave4cmd.py +12 -0
- data/vendor/behave/features/summary.undefined_steps.feature +114 -0
- data/vendor/behave/features/tags.active_tags.feature +385 -0
- data/vendor/behave/features/tags.default_tags.feature +104 -0
- data/vendor/behave/features/tags.tag_expression.feature +105 -0
- data/vendor/behave/features/userdata.feature +331 -0
- data/vendor/behave/invoke.yaml +21 -0
- data/vendor/behave/issue.features/README.txt +17 -0
- data/vendor/behave/issue.features/environment.py +97 -0
- data/vendor/behave/issue.features/issue0030.feature +21 -0
- data/vendor/behave/issue.features/issue0031.feature +16 -0
- data/vendor/behave/issue.features/issue0032.feature +28 -0
- data/vendor/behave/issue.features/issue0035.feature +74 -0
- data/vendor/behave/issue.features/issue0040.feature +154 -0
- data/vendor/behave/issue.features/issue0041.feature +135 -0
- data/vendor/behave/issue.features/issue0042.feature +230 -0
- data/vendor/behave/issue.features/issue0044.feature +51 -0
- data/vendor/behave/issue.features/issue0046.feature +77 -0
- data/vendor/behave/issue.features/issue0052.feature +66 -0
- data/vendor/behave/issue.features/issue0059.feature +29 -0
- data/vendor/behave/issue.features/issue0063.feature +102 -0
- data/vendor/behave/issue.features/issue0064.feature +97 -0
- data/vendor/behave/issue.features/issue0065.feature +18 -0
- data/vendor/behave/issue.features/issue0066.feature +80 -0
- data/vendor/behave/issue.features/issue0067.feature +90 -0
- data/vendor/behave/issue.features/issue0069.feature +64 -0
- data/vendor/behave/issue.features/issue0072.feature +32 -0
- data/vendor/behave/issue.features/issue0073.feature +228 -0
- data/vendor/behave/issue.features/issue0075.feature +18 -0
- data/vendor/behave/issue.features/issue0077.feature +89 -0
- data/vendor/behave/issue.features/issue0080.feature +49 -0
- data/vendor/behave/issue.features/issue0081.feature +138 -0
- data/vendor/behave/issue.features/issue0083.feature +69 -0
- data/vendor/behave/issue.features/issue0084.feature +69 -0
- data/vendor/behave/issue.features/issue0085.feature +119 -0
- data/vendor/behave/issue.features/issue0092.feature +66 -0
- data/vendor/behave/issue.features/issue0096.feature +173 -0
- data/vendor/behave/issue.features/issue0099.feature +130 -0
- data/vendor/behave/issue.features/issue0109.feature +60 -0
- data/vendor/behave/issue.features/issue0111.feature +53 -0
- data/vendor/behave/issue.features/issue0112.feature +64 -0
- data/vendor/behave/issue.features/issue0114.feature +118 -0
- data/vendor/behave/issue.features/issue0116.feature +71 -0
- data/vendor/behave/issue.features/issue0125.feature +49 -0
- data/vendor/behave/issue.features/issue0127.feature +64 -0
- data/vendor/behave/issue.features/issue0139.feature +67 -0
- data/vendor/behave/issue.features/issue0142.feature +37 -0
- data/vendor/behave/issue.features/issue0143.feature +54 -0
- data/vendor/behave/issue.features/issue0145.feature +63 -0
- data/vendor/behave/issue.features/issue0148.feature +105 -0
- data/vendor/behave/issue.features/issue0152.feature +52 -0
- data/vendor/behave/issue.features/issue0159.feature +74 -0
- data/vendor/behave/issue.features/issue0162.feature +86 -0
- data/vendor/behave/issue.features/issue0171.feature +16 -0
- data/vendor/behave/issue.features/issue0172.feature +51 -0
- data/vendor/behave/issue.features/issue0175.feature +91 -0
- data/vendor/behave/issue.features/issue0177.feature +40 -0
- data/vendor/behave/issue.features/issue0181.feature +36 -0
- data/vendor/behave/issue.features/issue0184.feature +144 -0
- data/vendor/behave/issue.features/issue0186.feature +12 -0
- data/vendor/behave/issue.features/issue0188.feature +60 -0
- data/vendor/behave/issue.features/issue0191.feature +178 -0
- data/vendor/behave/issue.features/issue0194.feature +215 -0
- data/vendor/behave/issue.features/issue0197.feature +11 -0
- data/vendor/behave/issue.features/issue0216.feature +129 -0
- data/vendor/behave/issue.features/issue0226.feature +51 -0
- data/vendor/behave/issue.features/issue0228.feature +41 -0
- data/vendor/behave/issue.features/issue0230.feature +46 -0
- data/vendor/behave/issue.features/issue0231.feature +77 -0
- data/vendor/behave/issue.features/issue0238.feature +52 -0
- data/vendor/behave/issue.features/issue0251.feature +15 -0
- data/vendor/behave/issue.features/issue0280.feature +118 -0
- data/vendor/behave/issue.features/issue0288.feature +95 -0
- data/vendor/behave/issue.features/issue0300.feature +49 -0
- data/vendor/behave/issue.features/issue0302.feature +91 -0
- data/vendor/behave/issue.features/issue0309.feature +52 -0
- data/vendor/behave/issue.features/issue0330.feature +124 -0
- data/vendor/behave/issue.features/issue0349.feature +9 -0
- data/vendor/behave/issue.features/issue0361.feature +79 -0
- data/vendor/behave/issue.features/issue0383.feature +76 -0
- data/vendor/behave/issue.features/issue0384.feature +103 -0
- data/vendor/behave/issue.features/issue0385.feature +109 -0
- data/vendor/behave/issue.features/issue0424.feature +66 -0
- data/vendor/behave/issue.features/issue0446.feature +116 -0
- data/vendor/behave/issue.features/issue0449.feature +42 -0
- data/vendor/behave/issue.features/issue0453.feature +42 -0
- data/vendor/behave/issue.features/issue0457.feature +65 -0
- data/vendor/behave/issue.features/issue0462.feature +38 -0
- data/vendor/behave/issue.features/issue0476.feature +39 -0
- data/vendor/behave/issue.features/issue0487.feature +92 -0
- data/vendor/behave/issue.features/issue0506.feature +77 -0
- data/vendor/behave/issue.features/issue0510.feature +51 -0
- data/vendor/behave/issue.features/requirements.txt +12 -0
- data/vendor/behave/issue.features/steps/ansi_steps.py +20 -0
- data/vendor/behave/issue.features/steps/behave_hooks_steps.py +10 -0
- data/vendor/behave/issue.features/steps/use_steplib_behave4cmd.py +13 -0
- data/vendor/behave/more.features/formatter.json.validate_output.feature +37 -0
- data/vendor/behave/more.features/steps/tutorial_steps.py +16 -0
- data/vendor/behave/more.features/steps/use_steplib_behave4cmd.py +7 -0
- data/vendor/behave/more.features/tutorial.feature +6 -0
- data/vendor/behave/py.requirements/README.txt +5 -0
- data/vendor/behave/py.requirements/all.txt +16 -0
- data/vendor/behave/py.requirements/basic.txt +21 -0
- data/vendor/behave/py.requirements/develop.txt +28 -0
- data/vendor/behave/py.requirements/docs.txt +6 -0
- data/vendor/behave/py.requirements/json.txt +7 -0
- data/vendor/behave/py.requirements/more_py26.txt +8 -0
- data/vendor/behave/py.requirements/testing.txt +10 -0
- data/vendor/behave/pytest.ini +24 -0
- data/vendor/behave/setup.cfg +29 -0
- data/vendor/behave/setup.py +118 -0
- data/vendor/behave/setuptools_behave.py +130 -0
- data/vendor/behave/tasks/__behave.py +45 -0
- data/vendor/behave/tasks/__init__.py +55 -0
- data/vendor/behave/tasks/__main__.py +70 -0
- data/vendor/behave/tasks/_setup.py +135 -0
- data/vendor/behave/tasks/_vendor/README.rst +35 -0
- data/vendor/behave/tasks/_vendor/invoke.zip +0 -0
- data/vendor/behave/tasks/_vendor/path.py +1725 -0
- data/vendor/behave/tasks/_vendor/pathlib.py +1280 -0
- data/vendor/behave/tasks/_vendor/six.py +868 -0
- data/vendor/behave/tasks/clean.py +246 -0
- data/vendor/behave/tasks/docs.py +97 -0
- data/vendor/behave/tasks/requirements.txt +17 -0
- data/vendor/behave/tasks/test.py +192 -0
- data/vendor/behave/test/__init__.py +0 -0
- data/vendor/behave/test/_importer_candidate.py +3 -0
- data/vendor/behave/test/reporters/__init__.py +0 -0
- data/vendor/behave/test/reporters/test_summary.py +240 -0
- data/vendor/behave/test/test_ansi_escapes.py +73 -0
- data/vendor/behave/test/test_configuration.py +172 -0
- data/vendor/behave/test/test_formatter.py +265 -0
- data/vendor/behave/test/test_formatter_progress.py +39 -0
- data/vendor/behave/test/test_formatter_rerun.py +97 -0
- data/vendor/behave/test/test_formatter_tags.py +57 -0
- data/vendor/behave/test/test_importer.py +151 -0
- data/vendor/behave/test/test_log_capture.py +29 -0
- data/vendor/behave/test/test_matchers.py +236 -0
- data/vendor/behave/test/test_model.py +871 -0
- data/vendor/behave/test/test_parser.py +1590 -0
- data/vendor/behave/test/test_runner.py +1074 -0
- data/vendor/behave/test/test_step_registry.py +96 -0
- data/vendor/behave/test/test_tag_expression.py +506 -0
- data/vendor/behave/test/test_tag_expression2.py +462 -0
- data/vendor/behave/test/test_tag_matcher.py +729 -0
- data/vendor/behave/test/test_userdata.py +184 -0
- data/vendor/behave/tests/README.txt +12 -0
- data/vendor/behave/tests/__init__.py +0 -0
- data/vendor/behave/tests/api/__ONLY_PY34_or_newer.txt +0 -0
- data/vendor/behave/tests/api/__init__.py +0 -0
- data/vendor/behave/tests/api/_test_async_step34.py +130 -0
- data/vendor/behave/tests/api/_test_async_step35.py +75 -0
- data/vendor/behave/tests/api/test_async_step.py +18 -0
- data/vendor/behave/tests/api/testing_support.py +94 -0
- data/vendor/behave/tests/api/testing_support_async.py +21 -0
- data/vendor/behave/tests/issues/test_issue0336.py +66 -0
- data/vendor/behave/tests/issues/test_issue0449.py +55 -0
- data/vendor/behave/tests/issues/test_issue0453.py +62 -0
- data/vendor/behave/tests/issues/test_issue0458.py +54 -0
- data/vendor/behave/tests/issues/test_issue0495.py +65 -0
- data/vendor/behave/tests/unit/__init__.py +0 -0
- data/vendor/behave/tests/unit/test_behave4cmd_command_shell_proc.py +135 -0
- data/vendor/behave/tests/unit/test_capture.py +280 -0
- data/vendor/behave/tests/unit/test_model_core.py +56 -0
- data/vendor/behave/tests/unit/test_textutil.py +267 -0
- data/vendor/behave/tools/test-features/background.feature +9 -0
- data/vendor/behave/tools/test-features/environment.py +8 -0
- data/vendor/behave/tools/test-features/french.feature +11 -0
- data/vendor/behave/tools/test-features/outline.feature +39 -0
- data/vendor/behave/tools/test-features/parse.feature +10 -0
- data/vendor/behave/tools/test-features/step-data.feature +60 -0
- data/vendor/behave/tools/test-features/steps/steps.py +120 -0
- data/vendor/behave/tools/test-features/tags.feature +18 -0
- data/vendor/behave/tox.ini +159 -0
- metadata +562 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.. _id.appendix.regular_expressions:
|
|
2
|
+
|
|
3
|
+
==============================================================================
|
|
4
|
+
Regular Expressions
|
|
5
|
+
==============================================================================
|
|
6
|
+
|
|
7
|
+
.. index:: regular expressions, regexp
|
|
8
|
+
|
|
9
|
+
The following tables provide a overview of the `regular expressions`_ syntax.
|
|
10
|
+
See also `Python regular expressions`_ description in the Python `re module`_.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
===================== =========================================================
|
|
14
|
+
Special Characters Description
|
|
15
|
+
===================== =========================================================
|
|
16
|
+
``.`` Matches any character (dot).
|
|
17
|
+
``^`` "^...", matches start-of-string (caret).
|
|
18
|
+
``$`` "...$", matches end-of-string (dollar sign).
|
|
19
|
+
``|`` "A|B", matches "A" or "B".
|
|
20
|
+
``\`` Escape character.
|
|
21
|
+
``\.`` EXAMPLE: Matches character '.' (dot).
|
|
22
|
+
``\\`` EXAMPLE: Matches character '``\``' (backslash).
|
|
23
|
+
===================== =========================================================
|
|
24
|
+
|
|
25
|
+
To select or match characters from a special set of characters,
|
|
26
|
+
a character set must be defined.
|
|
27
|
+
|
|
28
|
+
===================== =========================================================
|
|
29
|
+
Character sets Description
|
|
30
|
+
===================== =========================================================
|
|
31
|
+
``[...]`` Define a character set, like ``[A-Za-z]``.
|
|
32
|
+
``\d`` Matches digit character: [0-9]
|
|
33
|
+
``\D`` Matches non-digit character.
|
|
34
|
+
``\s`` Matches whitespace character: ``[ \t\n\r\f\v]``
|
|
35
|
+
``\S`` Matches non-whitespace character
|
|
36
|
+
``\w`` Matches alphanumeric character: ``[a-zA-Z0-9_]``
|
|
37
|
+
``\W`` Matches non-alphanumeric character.
|
|
38
|
+
===================== =========================================================
|
|
39
|
+
|
|
40
|
+
A text part must be group to extract it as part (parameter).
|
|
41
|
+
|
|
42
|
+
===================== =========================================================
|
|
43
|
+
Grouping Description
|
|
44
|
+
===================== =========================================================
|
|
45
|
+
``(...)`` Group a regular expression pattern (anonymous group).
|
|
46
|
+
``\number`` Matches text of earlier group by index, like: "``\1``".
|
|
47
|
+
``(?P<name>...)`` Matches pattern and stores it in parameter "name".
|
|
48
|
+
``(?P=name)`` Match whatever text was matched by earlier group "name".
|
|
49
|
+
``(?:...)`` Matches pattern, but does non capture any text.
|
|
50
|
+
``(?#...)`` Comment (is ignored), describes pattern details.
|
|
51
|
+
===================== =========================================================
|
|
52
|
+
|
|
53
|
+
If a *group*, *character* or *character set* should be repeated several times,
|
|
54
|
+
it is necessary to specify the cardinality of the regular expression pattern.
|
|
55
|
+
|
|
56
|
+
===================== ==============================================================
|
|
57
|
+
Cardinality Description
|
|
58
|
+
===================== ==============================================================
|
|
59
|
+
``?`` Pattern with cardinality 0..1: optional part (question mark).
|
|
60
|
+
``*`` Pattern with cardinality zero or more, 0.. (asterisk).
|
|
61
|
+
``+`` Pattern with cardinality one or more, 1.. (plus sign).
|
|
62
|
+
``{m}`` Matches ``m`` repetitions of a pattern.
|
|
63
|
+
``{m,n}`` Matches from ``m`` to ``n`` repetitions of a pattern.
|
|
64
|
+
``[A-Za-z]+`` EXAMPLE: Matches one or more alphabetical characters.
|
|
65
|
+
===================== ==============================================================
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
.. _`regular expressions`: http://en.wikipedia.org/wiki/Regular_expression
|
|
69
|
+
.. _Python regular expressions: https://docs.python.org/2/library/re.html#module-re
|
|
70
|
+
.. _re module: https://docs.python.org/2/library/re.html#module-re
|
|
71
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.. _id.appendix.related:
|
|
2
|
+
|
|
3
|
+
===============================
|
|
4
|
+
Software that Enhances *behave*
|
|
5
|
+
===============================
|
|
6
|
+
|
|
7
|
+
* Mock
|
|
8
|
+
* nose.tools and nose.twistedtools
|
|
9
|
+
* mechanize for pretending to be a browser
|
|
10
|
+
* selenium webdriver for actually driving a browser
|
|
11
|
+
* wsgi_intercept for providing more easily testable WSGI servers
|
|
12
|
+
* BeautifulSoup, lxml and html5lib for parsing HTML
|
|
13
|
+
* ...
|
|
14
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.. _id.appendix.test_domain:
|
|
2
|
+
|
|
3
|
+
Testing Domains
|
|
4
|
+
==============================================================================
|
|
5
|
+
|
|
6
|
+
Behave and other BDD frameworks allow you to provide **step libraries**
|
|
7
|
+
to reuse step definitions in similar projects that address the same
|
|
8
|
+
problem domain.
|
|
9
|
+
|
|
10
|
+
.. _behave: https://github.com/behave/behave
|
|
11
|
+
.. _Selenium: http://docs.seleniumhq.org/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Step Libraries
|
|
15
|
+
------------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
Support of the following testing domains is currently known:
|
|
18
|
+
|
|
19
|
+
=============== ================= ===========================================================
|
|
20
|
+
Testing Domain Name Description
|
|
21
|
+
=============== ================= ===========================================================
|
|
22
|
+
Command-line `behave4cmd`_ Test command-line tools, like behave, etc. (coming soon).
|
|
23
|
+
Web Apps `behave-django`_ Test Django Web apps with behave (solution 1).
|
|
24
|
+
Web Apps `django-behave`_ Test Django Web apps with behave (solution 2).
|
|
25
|
+
Web, SMS, ... `behaving`_ Test Web Apps, Email, SMS, Personas (step library).
|
|
26
|
+
=============== ================= ===========================================================
|
|
27
|
+
|
|
28
|
+
.. _behave4cmd: https://github.com/behave/behave4cmd
|
|
29
|
+
.. _behave-django: https://github.com/behave/behave-django
|
|
30
|
+
.. _behaving: https://github.com/ggozad/behaving
|
|
31
|
+
.. _django-behave: https://github.com/django-behave/django-behave
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Step Usage Examples
|
|
36
|
+
------------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
This examples show how you can use `behave`_ for testing a specific problem domain.
|
|
39
|
+
This examples are normally not a full-blown step library (that can be reused),
|
|
40
|
+
but give you an example (or prototype), how the problem can be solved.
|
|
41
|
+
|
|
42
|
+
=============== ==================== ===========================================================
|
|
43
|
+
Testing Domain Name Description
|
|
44
|
+
=============== ==================== ===========================================================
|
|
45
|
+
GUI `Squish test`_ Use `Squish and Behave`_ for GUI testing (cross-platform).
|
|
46
|
+
Robot Control `behave4poppy`_ Use behave to control a robot via `pypot`_.
|
|
47
|
+
Web `pyramid_behave`_ Use `behave to test pyramid`_.
|
|
48
|
+
Web `pycabara-tutorial`_ Use pycabara (with `behave`_ and `Selenium`_).
|
|
49
|
+
=============== ==================== ===========================================================
|
|
50
|
+
|
|
51
|
+
.. seealso::
|
|
52
|
+
|
|
53
|
+
* google-search: `behave python example <https://www.google.com/?q=behave%20python%20example>`_
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
.. _behave4poppy: https://github.com/chbrun/behave4poppy
|
|
57
|
+
.. _`Squish test`: http://www.froglogic.com/squish/gui-testing/
|
|
58
|
+
.. _`Squish and Behave`: http://kb.froglogic.com/display/KB/BDD+with+Squish+and+Behave
|
|
59
|
+
.. _pycabara-tutorial: https://github.com/excellaco/pycabara-tutorial
|
|
60
|
+
.. _pypot: https://github.com/poppy-project/pypot
|
|
61
|
+
.. _pyramid_behave: https://github.com/wwitzel3/pyramid_behave
|
|
62
|
+
.. _`behave to test pyramid`: https://blog.safaribooksonline.com/2014/01/10/using-behave-with-pyramid/
|
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
.. _tutorial:
|
|
2
|
+
|
|
3
|
+
========
|
|
4
|
+
Tutorial
|
|
5
|
+
========
|
|
6
|
+
|
|
7
|
+
First, :doc:`install behave <install>`.
|
|
8
|
+
|
|
9
|
+
Now make a directory called "features". In that directory create a file
|
|
10
|
+
called "tutorial.feature" containing:
|
|
11
|
+
|
|
12
|
+
.. code-block:: gherkin
|
|
13
|
+
|
|
14
|
+
Feature: showing off behave
|
|
15
|
+
|
|
16
|
+
Scenario: run a simple test
|
|
17
|
+
Given we have behave installed
|
|
18
|
+
When we implement a test
|
|
19
|
+
Then behave will test it for us!
|
|
20
|
+
|
|
21
|
+
Make a new directory called "features/steps". In that directory create a
|
|
22
|
+
file called "tutorial.py" containing:
|
|
23
|
+
|
|
24
|
+
.. code-block:: python
|
|
25
|
+
|
|
26
|
+
from behave import *
|
|
27
|
+
|
|
28
|
+
@given('we have behave installed')
|
|
29
|
+
def step_impl(context):
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
@when('we implement a test')
|
|
33
|
+
def step_impl(context):
|
|
34
|
+
assert True is not False
|
|
35
|
+
|
|
36
|
+
@then('behave will test it for us!')
|
|
37
|
+
def step_impl(context):
|
|
38
|
+
assert context.failed is False
|
|
39
|
+
|
|
40
|
+
Run behave::
|
|
41
|
+
|
|
42
|
+
% behave
|
|
43
|
+
Feature: showing off behave # features/tutorial.feature:1
|
|
44
|
+
|
|
45
|
+
Scenario: run a simple test # features/tutorial.feature:3
|
|
46
|
+
Given we have behave installed # features/steps/tutorial.py:3
|
|
47
|
+
When we implement a test # features/steps/tutorial.py:7
|
|
48
|
+
Then behave will test it for us! # features/steps/tutorial.py:11
|
|
49
|
+
|
|
50
|
+
1 feature passed, 0 failed, 0 skipped
|
|
51
|
+
1 scenario passed, 0 failed, 0 skipped
|
|
52
|
+
3 steps passed, 0 failed, 0 skipped, 0 undefined
|
|
53
|
+
|
|
54
|
+
Now, continue reading to learn how to make the most of *behave*.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
Features
|
|
58
|
+
========
|
|
59
|
+
|
|
60
|
+
*behave* operates on directories containing:
|
|
61
|
+
|
|
62
|
+
1. `feature files`_ written by your Business Analyst / Sponsor / whoever
|
|
63
|
+
with your behaviour scenarios in it, and
|
|
64
|
+
2. a "steps" directory with `Python step implementations`_ for the
|
|
65
|
+
scenarios.
|
|
66
|
+
|
|
67
|
+
You may optionally include some `environmental controls`_ (code to run
|
|
68
|
+
before and after steps, scenarios, features or the whole shooting
|
|
69
|
+
match).
|
|
70
|
+
|
|
71
|
+
The minimum requirement for a features directory is::
|
|
72
|
+
|
|
73
|
+
features/
|
|
74
|
+
features/everything.feature
|
|
75
|
+
features/steps/
|
|
76
|
+
features/steps/steps.py
|
|
77
|
+
|
|
78
|
+
A more complex directory might look like::
|
|
79
|
+
|
|
80
|
+
features/
|
|
81
|
+
features/signup.feature
|
|
82
|
+
features/login.feature
|
|
83
|
+
features/account_details.feature
|
|
84
|
+
features/environment.py
|
|
85
|
+
features/steps/
|
|
86
|
+
features/steps/website.py
|
|
87
|
+
features/steps/utils.py
|
|
88
|
+
|
|
89
|
+
If you're having trouble setting things up and want to see what *behave* is
|
|
90
|
+
doing in attempting to find your features use the "-v" (verbose)
|
|
91
|
+
command-line switch.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
Feature Files
|
|
95
|
+
=============
|
|
96
|
+
|
|
97
|
+
A feature file has a :ref:`natural language format <chapter.gherkin>`
|
|
98
|
+
describing a feature or part of a feature with representative examples of
|
|
99
|
+
expected outcomes.
|
|
100
|
+
They're plain-text (encoded in UTF-8) and look something like:
|
|
101
|
+
|
|
102
|
+
.. code-block:: gherkin
|
|
103
|
+
|
|
104
|
+
Feature: Fight or flight
|
|
105
|
+
In order to increase the ninja survival rate,
|
|
106
|
+
As a ninja commander
|
|
107
|
+
I want my ninjas to decide whether to take on an
|
|
108
|
+
opponent based on their skill levels
|
|
109
|
+
|
|
110
|
+
Scenario: Weaker opponent
|
|
111
|
+
Given the ninja has a third level black-belt
|
|
112
|
+
When attacked by a samurai
|
|
113
|
+
Then the ninja should engage the opponent
|
|
114
|
+
|
|
115
|
+
Scenario: Stronger opponent
|
|
116
|
+
Given the ninja has a third level black-belt
|
|
117
|
+
When attacked by Chuck Norris
|
|
118
|
+
Then the ninja should run for his life
|
|
119
|
+
|
|
120
|
+
The "Given", "When" and "Then" parts of this prose form the actual steps
|
|
121
|
+
that will be taken by *behave* in testing your system. These map to `Python
|
|
122
|
+
step implementations`_. As a general guide:
|
|
123
|
+
|
|
124
|
+
**Given** we *put the system in a known state* before the
|
|
125
|
+
user (or external system) starts interacting with the system (in the When
|
|
126
|
+
steps). Avoid talking about user interaction in givens.
|
|
127
|
+
|
|
128
|
+
**When** we *take key actions* the user (or external system) performs. This
|
|
129
|
+
is the interaction with your system which should (or perhaps should not)
|
|
130
|
+
cause some state to change.
|
|
131
|
+
|
|
132
|
+
**Then** we *observe outcomes*.
|
|
133
|
+
|
|
134
|
+
You may also include "And" or "But" as a step - these are renamed by *behave*
|
|
135
|
+
to take the name of their preceding step, so:
|
|
136
|
+
|
|
137
|
+
.. code-block:: gherkin
|
|
138
|
+
|
|
139
|
+
Scenario: Stronger opponent
|
|
140
|
+
Given the ninja has a third level black-belt
|
|
141
|
+
When attacked by Chuck Norris
|
|
142
|
+
Then the ninja should run for his life
|
|
143
|
+
And fall off a cliff
|
|
144
|
+
|
|
145
|
+
In this case *behave* will look for a step definition for
|
|
146
|
+
``"Then fall off a cliff"``.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
Scenario Outlines
|
|
150
|
+
-----------------
|
|
151
|
+
|
|
152
|
+
Sometimes a scenario should be run with a number of variables giving a set
|
|
153
|
+
of known states, actions to take and expected outcomes, all using the same
|
|
154
|
+
basic actions. You may use a Scenario Outline to achieve this:
|
|
155
|
+
|
|
156
|
+
.. code-block:: gherkin
|
|
157
|
+
|
|
158
|
+
Scenario Outline: Blenders
|
|
159
|
+
Given I put <thing> in a blender,
|
|
160
|
+
when I switch the blender on
|
|
161
|
+
then it should transform into <other thing>
|
|
162
|
+
|
|
163
|
+
Examples: Amphibians
|
|
164
|
+
| thing | other thing |
|
|
165
|
+
| Red Tree Frog | mush |
|
|
166
|
+
|
|
167
|
+
Examples: Consumer Electronics
|
|
168
|
+
| thing | other thing |
|
|
169
|
+
| iPhone | toxic waste |
|
|
170
|
+
| Galaxy Nexus | toxic waste |
|
|
171
|
+
|
|
172
|
+
*behave* will run the scenario once for each (non-heading) line appearing
|
|
173
|
+
in the example data tables.
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
Step Data
|
|
177
|
+
---------
|
|
178
|
+
|
|
179
|
+
Sometimes it's useful to associate a table of data with your step.
|
|
180
|
+
|
|
181
|
+
Any text block following a step wrapped in ``"""`` lines will be associated
|
|
182
|
+
with the step. For example:
|
|
183
|
+
|
|
184
|
+
.. code-block:: gherkin
|
|
185
|
+
|
|
186
|
+
Scenario: some scenario
|
|
187
|
+
Given a sample text loaded into the frobulator
|
|
188
|
+
"""
|
|
189
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
|
|
190
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
191
|
+
"""
|
|
192
|
+
When we activate the frobulator
|
|
193
|
+
Then we will find it similar to English
|
|
194
|
+
|
|
195
|
+
The text is available to the Python step code as the ".text" attribute
|
|
196
|
+
in the :class:`~behave.runner.Context` variable passed into each step
|
|
197
|
+
function.
|
|
198
|
+
|
|
199
|
+
You may also associate a table of data with a step by simply entering it,
|
|
200
|
+
indented, following the step. This can be useful for loading specific
|
|
201
|
+
required data into a model.
|
|
202
|
+
|
|
203
|
+
.. code-block:: gherkin
|
|
204
|
+
|
|
205
|
+
Scenario: some scenario
|
|
206
|
+
Given a set of specific users
|
|
207
|
+
| name | department |
|
|
208
|
+
| Barry | Beer Cans |
|
|
209
|
+
| Pudey | Silly Walks |
|
|
210
|
+
| Two-Lumps | Silly Walks |
|
|
211
|
+
|
|
212
|
+
When we count the number of people in each department
|
|
213
|
+
Then we will find two people in "Silly Walks"
|
|
214
|
+
But we will find one person in "Beer Cans"
|
|
215
|
+
|
|
216
|
+
The table is available to the Python step code as the ".table" attribute
|
|
217
|
+
in the :class:`~behave.runner.Context` variable passed into each step
|
|
218
|
+
function. The table for the example above could be accessed like so:
|
|
219
|
+
|
|
220
|
+
.. code-block:: python
|
|
221
|
+
|
|
222
|
+
@given('a set of specific users')
|
|
223
|
+
def step_impl(context):
|
|
224
|
+
for row in context.table:
|
|
225
|
+
model.add_user(name=row['name'], department=row['department'])
|
|
226
|
+
|
|
227
|
+
There's a variety of ways to access the table data - see the
|
|
228
|
+
:class:`~behave.model.Table` API documentation for the full details.
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
Python Step Implementations
|
|
233
|
+
===========================
|
|
234
|
+
|
|
235
|
+
Steps used in the scenarios are implemented in Python files in the "steps"
|
|
236
|
+
directory. You can call these whatever you like as long as they use
|
|
237
|
+
the python ``*.py`` file extension. You don't need to tell *behave* which
|
|
238
|
+
ones to use - it'll use all of them.
|
|
239
|
+
|
|
240
|
+
The full detail of the Python side of *behave* is in the
|
|
241
|
+
:doc:`API documentation <api>`.
|
|
242
|
+
|
|
243
|
+
Steps are identified using decorators which match the predicate from the
|
|
244
|
+
feature file: **given**, **when**, **then** and **step** (variants with Title case are also
|
|
245
|
+
available if that's your preference.) The decorator accepts a string
|
|
246
|
+
containing the rest of the phrase used in the scenario step it belongs to.
|
|
247
|
+
|
|
248
|
+
Given a Scenario:
|
|
249
|
+
|
|
250
|
+
.. code-block:: gherkin
|
|
251
|
+
|
|
252
|
+
Scenario: Search for an account
|
|
253
|
+
Given I search for a valid account
|
|
254
|
+
Then I will see the account details
|
|
255
|
+
|
|
256
|
+
Step code implementing the two steps here might look like
|
|
257
|
+
(using selenium webdriver and some other helpers):
|
|
258
|
+
|
|
259
|
+
.. code-block:: python
|
|
260
|
+
|
|
261
|
+
@given('I search for a valid account')
|
|
262
|
+
def step_impl(context):
|
|
263
|
+
context.browser.get('http://localhost:8000/index')
|
|
264
|
+
form = get_element(context.browser, tag='form')
|
|
265
|
+
get_element(form, name="msisdn").send_keys('61415551234')
|
|
266
|
+
form.submit()
|
|
267
|
+
|
|
268
|
+
@then('I will see the account details')
|
|
269
|
+
def step_impl(context):
|
|
270
|
+
elements = find_elements(context.browser, id='no-account')
|
|
271
|
+
eq_(elements, [], 'account not found')
|
|
272
|
+
h = get_element(context.browser, id='account-head')
|
|
273
|
+
ok_(h.text.startswith("Account 61415551234"),
|
|
274
|
+
'Heading %r has wrong text' % h.text)
|
|
275
|
+
|
|
276
|
+
The ``step`` decorator matches the step to *any* step type, "given", "when"
|
|
277
|
+
or "then". The "and" and "but" step types are renamed internally to take
|
|
278
|
+
the preceding step's keyword (so an "and" following a "given" will become a
|
|
279
|
+
"given" internally and use a **given** decorated step).
|
|
280
|
+
|
|
281
|
+
If you find you'd like your step implementation to invoke another step you
|
|
282
|
+
may do so with the :class:`~behave.runner.Context` method
|
|
283
|
+
:func:`~behave.runner.Context.execute_steps`.
|
|
284
|
+
|
|
285
|
+
This function allows you to, for example:
|
|
286
|
+
|
|
287
|
+
.. code-block:: python
|
|
288
|
+
|
|
289
|
+
@when('I do the same thing as before')
|
|
290
|
+
def step_impl(context):
|
|
291
|
+
context.execute_steps('''
|
|
292
|
+
when I press the big red button
|
|
293
|
+
and I duck
|
|
294
|
+
''')
|
|
295
|
+
|
|
296
|
+
This will cause the "when I do the same thing as before" step to execute
|
|
297
|
+
the other two steps as though they had also appeared in the scenario file.
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
Step Parameters
|
|
301
|
+
---------------
|
|
302
|
+
|
|
303
|
+
You may find that your feature steps sometimes include very common phrases
|
|
304
|
+
with only some variation. For example:
|
|
305
|
+
|
|
306
|
+
.. code-block:: gherkin
|
|
307
|
+
|
|
308
|
+
Scenario: look up a book
|
|
309
|
+
Given I search for a valid book
|
|
310
|
+
Then the result page will include "success"
|
|
311
|
+
|
|
312
|
+
Scenario: look up an invalid book
|
|
313
|
+
Given I search for a invalid book
|
|
314
|
+
Then the result page will include "failure"
|
|
315
|
+
|
|
316
|
+
You may define a single Python step that handles both of those Then
|
|
317
|
+
clauses (with a Given step that puts some text into
|
|
318
|
+
``context.response``):
|
|
319
|
+
|
|
320
|
+
.. code-block:: python
|
|
321
|
+
|
|
322
|
+
@then('the result page will include "{text}"')
|
|
323
|
+
def step_impl(context, text):
|
|
324
|
+
if text not in context.response:
|
|
325
|
+
fail('%r not in %r' % (text, context.response))
|
|
326
|
+
|
|
327
|
+
There are several parsers available in *behave* (by default):
|
|
328
|
+
|
|
329
|
+
**parse** (the default, based on: :pypi:`parse`)
|
|
330
|
+
Provides a simple parser that replaces regular expressions for step parameters
|
|
331
|
+
with a readable syntax like ``{param:Type}``.
|
|
332
|
+
The syntax is inspired by the Python builtin ``string.format()`` function.
|
|
333
|
+
Step parameters must use the named fields syntax of :pypi:`parse`
|
|
334
|
+
in step definitions. The named fields are extracted,
|
|
335
|
+
optionally type converted and then used as step function arguments.
|
|
336
|
+
|
|
337
|
+
Supports type conversions by using type converters
|
|
338
|
+
(see :func:`~behave.register_type()`).
|
|
339
|
+
|
|
340
|
+
**cfparse** (extends: :pypi:`parse`, requires: :pypi:`parse_type`)
|
|
341
|
+
Provides an extended parser with "Cardinality Field" (CF) support.
|
|
342
|
+
Automatically creates missing type converters for related cardinality
|
|
343
|
+
as long as a type converter for cardinality=1 is provided.
|
|
344
|
+
Supports parse expressions like:
|
|
345
|
+
|
|
346
|
+
* ``{values:Type+}`` (cardinality=1..N, many)
|
|
347
|
+
* ``{values:Type*}`` (cardinality=0..N, many0)
|
|
348
|
+
* ``{value:Type?}`` (cardinality=0..1, optional).
|
|
349
|
+
|
|
350
|
+
Supports type conversions (as above).
|
|
351
|
+
|
|
352
|
+
**re**
|
|
353
|
+
This uses full regular expressions to parse the clause text. You will
|
|
354
|
+
need to use named groups "(?P<name>...)" to define the variables pulled
|
|
355
|
+
from the text and passed to your ``step()`` function.
|
|
356
|
+
|
|
357
|
+
Type conversion is **not supported**.
|
|
358
|
+
A step function writer may implement type conversion
|
|
359
|
+
inside the step function (implementation).
|
|
360
|
+
|
|
361
|
+
To specify which parser to use invoke :func:`~behave.use_step_matcher`
|
|
362
|
+
with the name of the matcher to use. You may change matcher to suit
|
|
363
|
+
specific step functions - the last call to ``use_step_matcher`` before a step
|
|
364
|
+
function declaration will be the one it uses.
|
|
365
|
+
|
|
366
|
+
.. note::
|
|
367
|
+
|
|
368
|
+
The function :func:`~behave.matchers.step_matcher()` is becoming deprecated.
|
|
369
|
+
Use :func:`~behave.use_step_matcher()` instead.
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
Context
|
|
373
|
+
-------
|
|
374
|
+
|
|
375
|
+
You'll have noticed the "context" variable that's passed around. It's a
|
|
376
|
+
clever place where you and *behave* can store information to share around.
|
|
377
|
+
It runs at three levels, automatically managed by *behave*.
|
|
378
|
+
|
|
379
|
+
When *behave* launches into a new feature or scenario it adds a new layer
|
|
380
|
+
to the context, allowing the new activity level to add new values, or
|
|
381
|
+
overwrite ones previously defined, for the duration of that activity. These
|
|
382
|
+
can be thought of as scopes.
|
|
383
|
+
|
|
384
|
+
You can define values in your `environmental controls`_ file which may be
|
|
385
|
+
set at the feature level and then overridden for some scenarios. Changes
|
|
386
|
+
made at the scenario level won't permanently affect the value set at the
|
|
387
|
+
feature level.
|
|
388
|
+
|
|
389
|
+
You may also use it to share values between steps. For example, in some
|
|
390
|
+
steps you define you might have:
|
|
391
|
+
|
|
392
|
+
.. code-block:: python
|
|
393
|
+
|
|
394
|
+
@given('I request a new widget for an account via SOAP')
|
|
395
|
+
def step_impl(context):
|
|
396
|
+
client = Client("http://127.0.0.1:8000/soap/")
|
|
397
|
+
context.response = client.Allocate(customer_first='Firstname',
|
|
398
|
+
customer_last='Lastname', colour='red')
|
|
399
|
+
|
|
400
|
+
@then('I should receive an OK SOAP response')
|
|
401
|
+
def step_impl(context):
|
|
402
|
+
eq_(context.response['ok'], 1)
|
|
403
|
+
|
|
404
|
+
There's also some values added to the context by *behave* itself:
|
|
405
|
+
|
|
406
|
+
**table**
|
|
407
|
+
This holds any table data associated with a step.
|
|
408
|
+
|
|
409
|
+
**text**
|
|
410
|
+
This holds any multi-line text associated with a step.
|
|
411
|
+
|
|
412
|
+
**failed**
|
|
413
|
+
This is set at the root of the context when any step fails. It is
|
|
414
|
+
sometimes useful to use this combined with the ``--stop`` command-line
|
|
415
|
+
option to prevent some mis-behaving resource from being cleaned up in an
|
|
416
|
+
``after_feature()`` or similar (for example, a web browser being driven
|
|
417
|
+
by Selenium.)
|
|
418
|
+
|
|
419
|
+
The *context* variable in all cases is an instance of
|
|
420
|
+
:class:`behave.runner.Context`.
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
Environmental Controls
|
|
424
|
+
======================
|
|
425
|
+
|
|
426
|
+
The environment.py module may define code to run before and after certain
|
|
427
|
+
events during your testing:
|
|
428
|
+
|
|
429
|
+
**before_step(context, step), after_step(context, step)**
|
|
430
|
+
These run before and after every step.
|
|
431
|
+
**before_scenario(context, scenario), after_scenario(context, scenario)**
|
|
432
|
+
These run before and after each scenario is run.
|
|
433
|
+
**before_feature(context, feature), after_feature(context, feature)**
|
|
434
|
+
These run before and after each feature file is exercised.
|
|
435
|
+
**before_tag(context, tag), after_tag(context, tag)**
|
|
436
|
+
These run before and after a section tagged with the given name. They are
|
|
437
|
+
invoked for each tag encountered in the order they're found in the
|
|
438
|
+
feature file. See `controlling things with tags`_.
|
|
439
|
+
**before_all(context), after_all(context)**
|
|
440
|
+
These run before and after the whole shooting match.
|
|
441
|
+
|
|
442
|
+
The feature, scenario and step objects represent the information parsed
|
|
443
|
+
from the feature file. They have a number of attributes:
|
|
444
|
+
|
|
445
|
+
**keyword**
|
|
446
|
+
"Feature", "Scenario", "Given", etc.
|
|
447
|
+
**name**
|
|
448
|
+
The name of the step (the text after the keyword.)
|
|
449
|
+
**tags**
|
|
450
|
+
A list of the tags attached to the section or step.
|
|
451
|
+
See `controlling things with tags`_.
|
|
452
|
+
**filename** and **line**
|
|
453
|
+
The file name (or "<string>") and line number of the statement.
|
|
454
|
+
|
|
455
|
+
A common use-case for environmental controls might be to set up a web
|
|
456
|
+
server and browser to run all your tests in. For example:
|
|
457
|
+
|
|
458
|
+
.. code-block:: python
|
|
459
|
+
|
|
460
|
+
import threading
|
|
461
|
+
from wsgiref import simple_server
|
|
462
|
+
from selenium import webdriver
|
|
463
|
+
from my_application import model
|
|
464
|
+
from my_application import web_app
|
|
465
|
+
|
|
466
|
+
def before_all(context):
|
|
467
|
+
context.server = simple_server.WSGIServer(('', 8000))
|
|
468
|
+
context.server.set_app(web_app.main(environment='test'))
|
|
469
|
+
context.thread = threading.Thread(target=context.server.serve_forever)
|
|
470
|
+
context.thread.start()
|
|
471
|
+
context.browser = webdriver.Chrome()
|
|
472
|
+
|
|
473
|
+
def after_all(context):
|
|
474
|
+
context.server.shutdown()
|
|
475
|
+
context.thread.join()
|
|
476
|
+
context.browser.quit()
|
|
477
|
+
|
|
478
|
+
def before_feature(context, feature):
|
|
479
|
+
model.init(environment='test')
|
|
480
|
+
|
|
481
|
+
Of course if you wish you could have a new browser for each feature, or to
|
|
482
|
+
retain the database state between features or even initialise the database
|
|
483
|
+
for to each scenario.
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
.. _`controlling things with tags`:
|
|
487
|
+
|
|
488
|
+
Controlling Things With Tags
|
|
489
|
+
============================
|
|
490
|
+
|
|
491
|
+
You may also "tag" parts of your feature file. At the simplest level this
|
|
492
|
+
allows *behave* to selectively check parts of your feature set.
|
|
493
|
+
|
|
494
|
+
Given a feature file with:
|
|
495
|
+
|
|
496
|
+
.. code-block:: gherkin
|
|
497
|
+
|
|
498
|
+
Feature: Fight or flight
|
|
499
|
+
In order to increase the ninja survival rate,
|
|
500
|
+
As a ninja commander
|
|
501
|
+
I want my ninjas to decide whether to take on an
|
|
502
|
+
opponent based on their skill levels
|
|
503
|
+
|
|
504
|
+
@slow
|
|
505
|
+
Scenario: Weaker opponent
|
|
506
|
+
Given the ninja has a third level black-belt
|
|
507
|
+
When attacked by a samurai
|
|
508
|
+
Then the ninja should engage the opponent
|
|
509
|
+
|
|
510
|
+
Scenario: Stronger opponent
|
|
511
|
+
Given the ninja has a third level black-belt
|
|
512
|
+
When attacked by Chuck Norris
|
|
513
|
+
Then the ninja should run for his life
|
|
514
|
+
|
|
515
|
+
then running ``behave --tags=slow`` will run just the scenarios tagged
|
|
516
|
+
``@slow``. If you wish to check everything *except* the slow ones then you
|
|
517
|
+
may run ``behave --tags=-slow``.
|
|
518
|
+
|
|
519
|
+
Another common use-case is to tag a scenario you're working on with
|
|
520
|
+
``@wip`` and then ``behave --tags=wip`` to just test that one case.
|
|
521
|
+
|
|
522
|
+
Tag selection on the command-line may be combined:
|
|
523
|
+
|
|
524
|
+
* ``--tags=wip,slow``
|
|
525
|
+
This will select all the cases tagged *either* "wip" or "slow".
|
|
526
|
+
|
|
527
|
+
* ``--tags=wip --tags=slow``
|
|
528
|
+
This will select all the cases tagged *both* "wip" and "slow".
|
|
529
|
+
|
|
530
|
+
If a feature or scenario is tagged and then skipped because of a
|
|
531
|
+
command-line control then the *before_* and *after_* environment functions
|
|
532
|
+
will not be called for that feature or scenario. Note that *behave* has
|
|
533
|
+
additional support specifically for testing `works in progress`_.
|
|
534
|
+
|
|
535
|
+
The tags attached to a feature and scenario are available in
|
|
536
|
+
the environment functions via the "feature" or "scenario" object passed to
|
|
537
|
+
them. On those objects there is an attribute called "tags" which is a list
|
|
538
|
+
of the tag names attached, in the order they're found in the features file.
|
|
539
|
+
|
|
540
|
+
There are also `environmental controls`_ specific to tags, so in the above
|
|
541
|
+
example *behave* will attempt to invoke an ``environment.py`` function
|
|
542
|
+
``before_tag`` and ``after_tag`` before and after the Scenario tagged
|
|
543
|
+
``@slow``, passing in the name "slow". If multiple tags are present then
|
|
544
|
+
the functions will be called multiple times with each tag in the order
|
|
545
|
+
they're defined in the feature file.
|
|
546
|
+
|
|
547
|
+
Re-visiting the example from above; if only some of the features required a
|
|
548
|
+
browser and web server then you could tag them ``@browser``:
|
|
549
|
+
|
|
550
|
+
.. code-block:: python
|
|
551
|
+
|
|
552
|
+
def before_feature(context, feature):
|
|
553
|
+
model.init(environment='test')
|
|
554
|
+
if 'browser' in feature.tags:
|
|
555
|
+
context.server = simple_server.WSGIServer(('', 8000))
|
|
556
|
+
context.server.set_app(web_app.main(environment='test'))
|
|
557
|
+
context.thread = threading.Thread(target=context.server.serve_forever)
|
|
558
|
+
context.thread.start()
|
|
559
|
+
context.browser = webdriver.Chrome()
|
|
560
|
+
|
|
561
|
+
def after_feature(context, feature):
|
|
562
|
+
if 'browser' in feature.tags:
|
|
563
|
+
context.server.shutdown()
|
|
564
|
+
context.thread.join()
|
|
565
|
+
context.browser.quit()
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
Works In Progress
|
|
569
|
+
=================
|
|
570
|
+
|
|
571
|
+
*behave* supports the concept of a highly-unstable "work in progress"
|
|
572
|
+
scenario that you're actively developing. This scenario may produce strange
|
|
573
|
+
logging, or odd output to stdout or just plain interact in unexpected ways
|
|
574
|
+
with *behave*'s scenario runner.
|
|
575
|
+
|
|
576
|
+
To make testing such scenarios simpler we've implemented a "-w"
|
|
577
|
+
command-line flag. This flag:
|
|
578
|
+
|
|
579
|
+
1. turns off stdout capture
|
|
580
|
+
2. turns off logging capture; you will still need to configure your own
|
|
581
|
+
logging handlers - we recommend a ``before_all()`` with:
|
|
582
|
+
|
|
583
|
+
.. code-block:: python
|
|
584
|
+
|
|
585
|
+
if not context.config.log_capture:
|
|
586
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
587
|
+
|
|
588
|
+
3. turns off pretty output - no ANSI escape sequences to confuse your
|
|
589
|
+
scenario's output
|
|
590
|
+
4. only runs scenarios tagged with "@wip"
|
|
591
|
+
5. stops at the first error
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
.. index::
|
|
595
|
+
single: debug-on-error
|
|
596
|
+
|
|
597
|
+
.. _debug-on-error:
|
|
598
|
+
|
|
599
|
+
Debug-on-Error (in Case of Step Failures)
|
|
600
|
+
=========================================
|
|
601
|
+
|
|
602
|
+
A "debug on error/failure" functionality can easily be provided,
|
|
603
|
+
by using the ``after_step()`` hook.
|
|
604
|
+
The debugger is started when a step fails.
|
|
605
|
+
|
|
606
|
+
It is in general a good idea to enable this functionality only when needed
|
|
607
|
+
(in interactive mode). The functionality is enabled (in this example)
|
|
608
|
+
by using the user-specific configuration data. A user can:
|
|
609
|
+
|
|
610
|
+
* provide a userdata define on command-line
|
|
611
|
+
* store a value in the "behave.userdata" section of behave's configuration file
|
|
612
|
+
|
|
613
|
+
.. code-block:: python
|
|
614
|
+
|
|
615
|
+
# -- FILE: features/environment.py
|
|
616
|
+
# USE: behave -D BEHAVE_DEBUG_ON_ERROR (to enable debug-on-error)
|
|
617
|
+
# USE: behave -D BEHAVE_DEBUG_ON_ERROR=yes (to enable debug-on-error)
|
|
618
|
+
# USE: behave -D BEHAVE_DEBUG_ON_ERROR=no (to disable debug-on-error)
|
|
619
|
+
|
|
620
|
+
BEHAVE_DEBUG_ON_ERROR = False
|
|
621
|
+
|
|
622
|
+
def setup_debug_on_error(userdata):
|
|
623
|
+
global BEHAVE_DEBUG_ON_ERROR
|
|
624
|
+
BEHAVE_DEBUG_ON_ERROR = userdata.getbool("BEHAVE_DEBUG_ON_ERROR")
|
|
625
|
+
|
|
626
|
+
def before_all(context):
|
|
627
|
+
setup_debug_on_error(context.config.userdata)
|
|
628
|
+
|
|
629
|
+
def after_step(context, step):
|
|
630
|
+
if BEHAVE_DEBUG_ON_ERROR and step.status == "failed":
|
|
631
|
+
# -- ENTER DEBUGGER: Zoom in on failure location.
|
|
632
|
+
# NOTE: Use IPython debugger, same for pdb (basic python debugger).
|
|
633
|
+
import ipdb
|
|
634
|
+
ipdb.post_mortem(step.exc_traceback)
|
|
635
|
+
|
|
636
|
+
|