cucumber 2.99.0 → 3.0.0
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 +4 -4
- data/.cucumberproignore +6 -0
- data/.gitattributes +32 -0
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +991 -0
- data/.travis.yml +56 -10
- data/{History.md → CHANGELOG.md} +166 -32
- data/CONTRIBUTING.md +21 -1
- data/Gemfile +18 -5
- data/README.md +13 -4
- data/Rakefile +12 -2
- data/appveyor.yml +27 -0
- data/bin/cucumber +2 -1
- data/cucumber.gemspec +15 -10
- data/cucumber.yml +10 -11
- data/examples/i18n/Rakefile +1 -1
- data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +8 -3
- data/examples/i18n/ar/lib/calculator.rb +2 -2
- data/examples/i18n/bg/features/step_definitions/calculator_steps.rb +6 -6
- data/examples/i18n/bg/features/support/env.rb +6 -1
- data/examples/i18n/bg/lib/calculator.rb +2 -1
- data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/ca/lib/calculadora.rb +2 -2
- data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/cs/lib/calculator.rb +3 -3
- data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +10 -5
- data/examples/i18n/da/lib/lommeregner.rb +2 -2
- data/examples/i18n/de/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/de/lib/calculator.rb +2 -2
- data/examples/i18n/el/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/el/lib/calculator.rb +2 -2
- data/examples/i18n/en/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/en/lib/calculator.rb +2 -2
- data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +4 -4
- data/examples/i18n/en-lol/features/support/env.rb +6 -2
- data/examples/i18n/en-lol/lib/basket.rb +2 -2
- data/examples/i18n/en-lol/lib/belly.rb +2 -2
- data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/eo/lib/calculator.rb +2 -2
- data/examples/i18n/es/features/step_definitions/calculador_steps.rb +10 -5
- data/examples/i18n/es/lib/calculador.rb +2 -2
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +10 -5
- data/examples/i18n/et/lib/kalkulaator.rb +3 -3
- data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +9 -4
- data/examples/i18n/fi/lib/laskin.rb +1 -1
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +8 -8
- data/examples/i18n/fr/features/support/env.rb +7 -2
- data/examples/i18n/fr/lib/calculatrice.rb +2 -2
- data/examples/i18n/he/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/he/lib/calculator.rb +1 -1
- data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/hi/lib/calculator.rb +1 -1
- data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +9 -5
- data/examples/i18n/ht/lib/kalkilatris.rb +2 -2
- data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/hu/lib/calculator.rb +1 -1
- data/examples/i18n/id/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/id/lib/calculator.rb +2 -2
- data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +10 -5
- data/examples/i18n/it/lib/calcolatrice.rb +3 -3
- data/examples/i18n/ja/features/step_definitions/calculator_steps.rb +3 -3
- data/examples/i18n/ja/features/support/env.rb +7 -2
- data/examples/i18n/ja/lib/calculator.rb +2 -2
- data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/ko/lib/calculator.rb +2 -2
- data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/lt/lib/calculator.rb +2 -2
- data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/lv/lib/calculator.rb +2 -2
- data/examples/i18n/no/features/step_definitions/kalkulator_steps.rb +3 -3
- data/examples/i18n/no/features/support/env.rb +7 -2
- data/examples/i18n/no/lib/kalkulator.rb +2 -2
- data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/pl/features/support/env.rb +6 -1
- data/examples/i18n/pl/lib/calculator.rb +2 -2
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +3 -3
- data/examples/i18n/pt/features/support/env.rb +7 -2
- data/examples/i18n/pt/lib/calculadora.rb +1 -1
- data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +11 -6
- data/examples/i18n/ro/lib/calculator.rb +1 -1
- data/examples/i18n/ru/features/step_definitions/calculator_steps.rb +5 -5
- data/examples/i18n/ru/features/support/env.rb +6 -1
- data/examples/i18n/ru/lib/calculator.rb +2 -1
- data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/sk/lib/calculator.rb +2 -2
- data/examples/i18n/sr-Cyrl/features/step_definitions/calculator_steps.rb +3 -3
- data/examples/i18n/sr-Cyrl/features/support/env.rb +7 -2
- data/examples/i18n/sr-Cyrl/lib/calculator.rb +2 -2
- data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/sr-Latn/lib/calculator.rb +2 -2
- data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +9 -4
- data/examples/i18n/sv/lib/kalkulator.rb +2 -2
- data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +10 -5
- data/examples/i18n/tr/lib/hesap_makinesi.rb +2 -2
- data/examples/i18n/uk/features/step_definitions/calculator_steps.rb +4 -4
- data/examples/i18n/uk/features/support/env.rb +6 -1
- data/examples/i18n/uk/lib/calculator.rb +2 -1
- data/examples/i18n/uz/features/step_definitions/calculator_steps.rb +4 -4
- data/examples/i18n/uz/features/support/env.rb +6 -1
- data/examples/i18n/uz/lib/calculator.rb +2 -1
- data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +11 -6
- data/examples/i18n/zh-CN/lib/calculator.rb +2 -2
- data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/zh-TW/lib/calculator.rb +2 -2
- data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +3 -3
- data/examples/sinatra/features/step_definitions/add_steps.rb +4 -4
- data/examples/sinatra/features/support/env.rb +6 -1
- data/examples/tcl/features/step_definitions/fib_steps.rb +2 -2
- data/examples/tcl/features/support/env.rb +2 -1
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +4 -4
- data/examples/watir/features/step_definitions/search_steps.rb +6 -5
- data/examples/watir/features/support/env.rb +5 -1
- data/examples/watir/features/support/screenshots.rb +5 -5
- data/features/docs/api/list_step_defs_as_json.feature +21 -7
- data/features/docs/api/listen_for_events.feature +9 -8
- data/features/docs/api/run_cli_main_with_existing_runtime.feature +1 -0
- data/features/docs/cli/dry_run.feature +3 -0
- data/features/docs/cli/execute_with_tag_filter.feature +8 -6
- data/features/docs/cli/fail_fast.feature +2 -0
- data/features/docs/cli/help.feature +8 -0
- data/features/docs/{gherkin/language_help.feature → cli/i18n.feature} +6 -6
- data/features/docs/cli/randomize.feature +2 -2
- data/features/docs/cli/retry_failing_tests.feature +75 -15
- data/features/docs/cli/run_scenarios_matching_name.feature +1 -0
- data/features/docs/cli/specifying_multiple_formatters.feature +3 -0
- data/features/docs/cli/strict_mode.feature +6 -0
- data/features/docs/defining_steps/ambiguous_steps.feature +89 -0
- data/features/docs/defining_steps/nested_steps.feature +5 -1
- data/features/docs/defining_steps/nested_steps_i18n.feature +3 -0
- data/features/docs/defining_steps/nested_steps_with_second_arg.feature +2 -0
- data/features/docs/defining_steps/printing_messages.feature +1 -2
- data/features/docs/defining_steps/skip_scenario.feature +1 -34
- data/features/docs/defining_steps/snippets.feature +18 -18
- data/features/docs/events/gherkin_source_read_event.feature +43 -0
- data/features/docs/events/step_activated_event.feature +36 -0
- data/features/docs/events/step_definition_registered_event.feature +29 -0
- data/features/docs/events/test_case_finished_event.feature +35 -0
- data/features/docs/events/test_case_started_event.feature +54 -0
- data/features/docs/events/test_run_finished_event.feature +40 -0
- data/features/docs/events/test_run_started_event.feature +41 -0
- data/features/docs/events/test_step_finished_event.feature +47 -0
- data/features/docs/events/test_step_started_event.feature +43 -0
- data/features/docs/exception_in_after_hook.feature +3 -2
- data/features/docs/exception_in_after_step_hook.feature +2 -0
- data/features/docs/exception_in_around_hook.feature +2 -0
- data/features/docs/exception_in_before_hook.feature +3 -1
- data/features/docs/extending_cucumber/custom_formatter.feature +12 -48
- data/features/docs/formatters/json_formatter.feature +4 -4
- data/features/docs/formatters/junit_formatter.feature +7 -6
- data/features/docs/formatters/pretty_formatter.feature +1 -0
- data/features/docs/formatters/progress_formatter.feature +1 -0
- data/features/docs/formatters/rerun_formatter.feature +2 -0
- data/features/docs/formatters/summary_formatter.feature +35 -0
- data/features/docs/formatters/usage_formatter.feature +3 -0
- data/features/docs/getting_started.feature +2 -1
- data/features/docs/gherkin/background.feature +5 -5
- data/features/docs/gherkin/doc_strings.feature +2 -0
- data/features/docs/gherkin/expand_option_for_outlines.feature +1 -0
- data/features/docs/gherkin/outlines.feature +6 -4
- data/features/docs/gherkin/unicode_table.feature +2 -1
- data/features/docs/gherkin/using_descriptions.feature +1 -0
- data/features/docs/gherkin/using_star_notation.feature +1 -1
- data/features/docs/post_configuration_hook.feature +1 -17
- data/features/docs/rake_task.feature +5 -0
- data/features/docs/raketask.feature +3 -1
- data/features/docs/work_in_progress.feature +5 -2
- data/features/docs/writing_support_code/after_step_hooks.feature +3 -1
- data/features/docs/writing_support_code/around_hooks.feature +6 -0
- data/features/docs/writing_support_code/before_hook.feature +1 -0
- data/features/docs/writing_support_code/hook_order.feature +3 -1
- data/features/docs/writing_support_code/parameter_types.feature +53 -0
- data/features/docs/writing_support_code/tagged_hooks.feature +1 -1
- data/features/docs/writing_support_code/world.feature +129 -0
- data/features/lib/step_definitions/aruba_steps.rb +5 -10
- data/features/lib/step_definitions/cli_steps.rb +4 -0
- data/features/lib/step_definitions/cucumber_steps.rb +9 -12
- data/features/lib/step_definitions/iso-8859-1_steps.rb +9 -5
- data/features/lib/step_definitions/json_steps.rb +2 -1
- data/features/lib/step_definitions/junit_steps.rb +2 -1
- data/features/lib/step_definitions/language_steps.rb +3 -2
- data/features/lib/step_definitions/profile_steps.rb +7 -6
- data/features/lib/step_definitions/retry_steps.rb +33 -13
- data/features/lib/step_definitions/ruby_steps.rb +2 -1
- data/features/lib/support/env.rb +3 -2
- data/features/lib/support/fake_wire_server.rb +17 -3
- data/features/lib/support/feature_factory.rb +2 -1
- data/features/lib/support/normalise_output.rb +14 -12
- data/features/lib/support/parameter_types.rb +5 -0
- data/gem_tasks/contributors.rake +10 -6
- data/gem_tasks/cov.rake +1 -0
- data/gem_tasks/downloads.rb +1 -0
- data/gem_tasks/environment.rake +2 -5
- data/gem_tasks/examples.rake +3 -2
- data/gem_tasks/fix_cr_lf.rake +19 -7
- data/gem_tasks/flog.rake +4 -3
- data/gem_tasks/rspec.rake +2 -1
- data/gem_tasks/sass.rake +2 -1
- data/lib/autotest/cucumber.rb +1 -0
- data/lib/autotest/cucumber_mixin.rb +17 -16
- data/lib/autotest/cucumber_rails.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
- data/lib/autotest/cucumber_rspec.rb +1 -0
- data/lib/autotest/cucumber_rspec2.rb +1 -0
- data/lib/autotest/discover.rb +3 -2
- data/lib/cucumber/cli/configuration.rb +12 -21
- data/lib/cucumber/cli/main.rb +8 -7
- data/lib/cucumber/cli/options.rb +341 -217
- data/lib/cucumber/cli/profile_loader.rb +26 -21
- data/lib/cucumber/cli/rerun_file.rb +1 -0
- data/lib/cucumber/configuration.rb +54 -37
- data/lib/cucumber/constantize.rb +2 -1
- data/lib/cucumber/core_ext/string.rb +2 -1
- data/lib/cucumber/deprecate.rb +4 -3
- data/lib/cucumber/encoding.rb +1 -0
- data/lib/cucumber/errors.rb +3 -1
- data/lib/cucumber/events/gherkin_source_read.rb +17 -0
- data/lib/cucumber/events/{step_match.rb → step_activated.rb} +5 -2
- data/lib/cucumber/events/step_definition_registered.rb +24 -0
- data/lib/cucumber/events/test_case_finished.rb +18 -0
- data/lib/cucumber/events/test_case_started.rb +15 -0
- data/lib/cucumber/events/test_run_finished.rb +12 -0
- data/lib/cucumber/events/test_run_started.rb +16 -0
- data/lib/cucumber/events/test_step_finished.rb +20 -0
- data/lib/cucumber/events/test_step_started.rb +17 -0
- data/lib/cucumber/events.rb +23 -3
- data/lib/cucumber/file_specs.rb +1 -0
- data/lib/cucumber/filters/activate_steps.rb +8 -3
- data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
- data/lib/cucumber/filters/broadcast_test_run_started_event.rb +27 -0
- data/lib/cucumber/filters/gated_receiver.rb +1 -0
- data/lib/cucumber/filters/prepare_world.rb +1 -0
- data/lib/cucumber/filters/quit.rb +1 -0
- data/lib/cucumber/filters/randomizer.rb +1 -0
- data/lib/cucumber/filters/retry.rb +4 -4
- data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -0
- data/lib/cucumber/filters/tag_limits/verifier.rb +2 -1
- data/lib/cucumber/filters/tag_limits.rb +4 -3
- data/lib/cucumber/filters.rb +3 -0
- data/lib/cucumber/formatter/ansicolor.rb +9 -11
- data/lib/cucumber/formatter/backtrace_filter.rb +21 -8
- data/lib/cucumber/formatter/console.rb +72 -66
- data/lib/cucumber/formatter/console_counts.rb +44 -0
- data/lib/cucumber/formatter/console_issues.rb +58 -0
- data/lib/cucumber/formatter/duration.rb +2 -1
- data/lib/cucumber/formatter/duration_extractor.rb +1 -0
- data/lib/cucumber/formatter/fail_fast.rb +4 -2
- data/lib/cucumber/formatter/fanout.rb +1 -0
- data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
- data/lib/cucumber/formatter/html.rb +175 -249
- data/lib/cucumber/formatter/html_builder.rb +120 -0
- data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -0
- data/lib/cucumber/formatter/inline-js.js +30 -0
- data/lib/cucumber/formatter/interceptor.rb +3 -2
- data/lib/cucumber/formatter/io.rb +2 -1
- data/lib/cucumber/formatter/json.rb +33 -30
- data/lib/cucumber/formatter/json_pretty.rb +1 -0
- data/lib/cucumber/formatter/junit.rb +26 -24
- data/lib/cucumber/formatter/legacy_api/adapter.rb +81 -69
- data/lib/cucumber/formatter/legacy_api/ast.rb +27 -22
- data/lib/cucumber/formatter/legacy_api/results.rb +7 -8
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +1 -0
- data/lib/cucumber/formatter/pretty.rb +24 -18
- data/lib/cucumber/formatter/progress.rb +55 -13
- data/lib/cucumber/formatter/rerun.rb +15 -18
- data/lib/cucumber/formatter/stepdefs.rb +1 -0
- data/lib/cucumber/formatter/steps.rb +2 -1
- data/lib/cucumber/formatter/summary.rb +43 -20
- data/lib/cucumber/formatter/unicode.rb +2 -1
- data/lib/cucumber/formatter/usage.rb +33 -28
- data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +2 -1
- data/lib/cucumber/gherkin/formatter/escaping.rb +2 -1
- data/lib/cucumber/gherkin/i18n.rb +1 -0
- data/lib/cucumber/gherkin/steps_parser.rb +1 -0
- data/lib/cucumber/{rb_support/rb_dsl.rb → glue/dsl.rb} +41 -30
- data/lib/cucumber/glue/hook.rb +43 -0
- data/lib/cucumber/glue/invoke_in_world.rb +70 -0
- data/lib/cucumber/glue/proto_world.rb +220 -0
- data/lib/cucumber/{rb_support/rb_language.rb → glue/registry_and_more.rb} +60 -90
- data/lib/cucumber/{rb_support → glue}/snippet.rb +64 -26
- data/lib/cucumber/glue/step_definition.rb +143 -0
- data/lib/cucumber/glue/world_factory.rb +23 -0
- data/lib/cucumber/hooks.rb +9 -8
- data/lib/cucumber/load_path.rb +1 -0
- data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +158 -0
- data/lib/cucumber/multiline_argument/data_table.rb +47 -181
- data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
- data/lib/cucumber/multiline_argument.rb +6 -15
- data/lib/cucumber/platform.rb +4 -5
- data/lib/cucumber/project_initializer.rb +3 -2
- data/lib/cucumber/rake/task.rb +19 -14
- data/lib/cucumber/rspec/disable_option_parser.rb +2 -1
- data/lib/cucumber/rspec/doubles.rb +2 -1
- data/lib/cucumber/running_test_case.rb +3 -27
- data/lib/cucumber/runtime/after_hooks.rb +2 -1
- data/lib/cucumber/runtime/before_hooks.rb +1 -0
- data/lib/cucumber/runtime/for_programming_languages.rb +2 -36
- data/lib/cucumber/runtime/step_hooks.rb +1 -0
- data/lib/cucumber/runtime/support_code.rb +21 -16
- data/lib/cucumber/runtime/user_interface.rb +10 -16
- data/lib/cucumber/runtime.rb +49 -32
- data/lib/cucumber/step_argument.rb +1 -2
- data/lib/cucumber/step_definition_light.rb +2 -0
- data/lib/cucumber/step_definitions.rb +1 -0
- data/lib/cucumber/step_match.rb +30 -15
- data/lib/cucumber/step_match_search.rb +3 -3
- data/lib/cucumber/term/ansicolor.rb +2 -1
- data/lib/cucumber/unit.rb +1 -0
- data/lib/cucumber/version +1 -1
- data/lib/cucumber.rb +1 -13
- data/lib/simplecov_setup.rb +2 -1
- data/scripts/invite-collaborator +40 -0
- data/scripts/update-changelog +86 -0
- data/spec/cucumber/cli/configuration_spec.rb +109 -98
- data/spec/cucumber/cli/main_spec.rb +8 -7
- data/spec/cucumber/cli/options_spec.rb +114 -79
- data/spec/cucumber/cli/profile_loader_spec.rb +25 -5
- data/spec/cucumber/cli/rerun_spec.rb +21 -20
- data/spec/cucumber/configuration_spec.rb +48 -47
- data/spec/cucumber/constantize_spec.rb +3 -2
- data/spec/cucumber/events_spec.rb +9 -0
- data/spec/cucumber/file_specs_spec.rb +26 -25
- data/spec/cucumber/filters/activate_steps_spec.rb +25 -22
- data/spec/cucumber/filters/gated_receiver_spec.rb +7 -6
- data/spec/cucumber/filters/retry_spec.rb +42 -23
- data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +12 -11
- data/spec/cucumber/filters/tag_limits/verifier_spec.rb +15 -14
- data/spec/cucumber/filters/tag_limits_spec.rb +9 -8
- data/spec/cucumber/formatter/ansicolor_spec.rb +10 -9
- data/spec/cucumber/formatter/backtrace_filter_spec.rb +32 -0
- data/spec/cucumber/formatter/console_counts_spec.rb +14 -0
- data/spec/cucumber/formatter/duration_spec.rb +4 -3
- data/spec/cucumber/formatter/fail_fast_spec.rb +27 -27
- data/spec/cucumber/formatter/html_spec.rb +65 -60
- data/spec/cucumber/formatter/interceptor_spec.rb +1 -0
- data/spec/cucumber/formatter/json_spec.rb +71 -97
- data/spec/cucumber/formatter/junit_spec.rb +46 -47
- data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +134 -141
- data/spec/cucumber/formatter/pretty_spec.rb +105 -117
- data/spec/cucumber/formatter/progress_spec.rb +22 -21
- data/spec/cucumber/formatter/rerun_spec.rb +70 -64
- data/spec/cucumber/formatter/spec_helper.rb +14 -12
- data/spec/cucumber/{rb_support/rb_world_spec.rb → glue/proto_world_spec.rb} +22 -6
- data/spec/cucumber/glue/registry_and_more_spec.rb +213 -0
- data/spec/cucumber/{rb_support → glue}/snippet_spec.rb +62 -25
- data/spec/cucumber/glue/step_definition_spec.rb +207 -0
- data/spec/cucumber/hooks_spec.rb +5 -4
- data/spec/cucumber/multiline_argument/data_table_spec.rb +179 -129
- data/spec/cucumber/project_initializer_spec.rb +12 -11
- data/spec/cucumber/rake/forked_spec.rb +22 -17
- data/spec/cucumber/rake/task_spec.rb +21 -20
- data/spec/cucumber/running_test_case_spec.rb +36 -35
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +2 -30
- data/spec/cucumber/runtime/support_code_spec.rb +1 -0
- data/spec/cucumber/runtime_spec.rb +3 -2
- data/spec/cucumber/step_argument_spec.rb +6 -5
- data/spec/cucumber/step_match_search_spec.rb +32 -41
- data/spec/cucumber/step_match_spec.rb +34 -33
- data/spec/cucumber/world/pending_spec.rb +12 -11
- data/spec/spec_helper.rb +1 -0
- data/spec/support/standard_step_actions.rb +2 -1
- metadata +132 -61
- data/features/docs/formatters/debug_formatter.feature +0 -47
- data/features/docs/formatters/formatter_step_file_colon_line.feature +0 -44
- data/features/docs/writing_support_code/transforms.feature +0 -98
- data/features/lib/step_definitions/wire_steps.rb +0 -58
- data/gem_tasks/cucumber.rake +0 -25
- data/lib/cucumber/ast.rb +0 -13
- data/lib/cucumber/core_ext/instance_exec.rb +0 -70
- data/lib/cucumber/events/after_test_case.rb +0 -25
- data/lib/cucumber/events/after_test_step.rb +0 -30
- data/lib/cucumber/events/before_test_case.rb +0 -18
- data/lib/cucumber/events/before_test_step.rb +0 -23
- data/lib/cucumber/events/bus.rb +0 -86
- data/lib/cucumber/events/finished_testing.rb +0 -9
- data/lib/cucumber/formatter/debug.rb +0 -35
- data/lib/cucumber/formatter/event_bus_report.rb +0 -38
- data/lib/cucumber/rb_support/rb_hook.rb +0 -19
- data/lib/cucumber/rb_support/rb_step_definition.rb +0 -131
- data/lib/cucumber/rb_support/rb_transform.rb +0 -59
- data/lib/cucumber/rb_support/rb_world.rb +0 -149
- data/spec/cucumber/core_ext/instance_exec_spec.rb +0 -4
- data/spec/cucumber/events/bus_spec.rb +0 -94
- data/spec/cucumber/formatter/debug_spec.rb +0 -64
- data/spec/cucumber/formatter/event_bus_report_spec.rb +0 -88
- data/spec/cucumber/rb_support/rb_language_spec.rb +0 -243
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +0 -199
- data/spec/cucumber/rb_support/rb_transform_spec.rb +0 -46
- data/spec/cucumber_spec.rb +0 -39
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'builder'
|
|
3
|
+
require 'pathname'
|
|
4
|
+
|
|
5
|
+
module Cucumber
|
|
6
|
+
module Formatter
|
|
7
|
+
class HtmlBuilder < Builder::XmlMarkup
|
|
8
|
+
VALID_EMBED_TYPES = [:text, :image].freeze
|
|
9
|
+
|
|
10
|
+
class InvalidEmbedTypeError < ::StandardError
|
|
11
|
+
MESSAGE = 'Invalid embed type. Valid types are :text and :image.'.freeze
|
|
12
|
+
|
|
13
|
+
def initialize(message=MESSAGE)
|
|
14
|
+
super(message)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def embed(type: nil, src: nil, label: nil, id: nil)
|
|
19
|
+
prepend_to_span('embed', string_to_embed(type: type, src: src, label: label, id: id))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def declare!
|
|
23
|
+
super(:DOCTYPE, :html, :PUBLIC, '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def build_document!
|
|
27
|
+
declare! # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
28
|
+
|
|
29
|
+
self << '<html xmlns ="http://www.w3.org/1999/xhtml">'
|
|
30
|
+
|
|
31
|
+
set_head_tags
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def format_features!(features)
|
|
35
|
+
step_count = features && features.step_count || 0
|
|
36
|
+
|
|
37
|
+
self << '<body>'
|
|
38
|
+
self << "<!-- Step count #{step_count}-->"
|
|
39
|
+
self << '<div class="cucumber">'
|
|
40
|
+
|
|
41
|
+
div(id: 'cucumber-header') do
|
|
42
|
+
div(id: 'label') do
|
|
43
|
+
h1 'Cucumber Features'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
summary_div
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
def string_to_embed(type: nil, src: nil, label: nil, id: nil)
|
|
53
|
+
raise ::ArgumentError, 'missing required argument' unless type && src && label && id # for Ruby 2.0 compatibility
|
|
54
|
+
raise InvalidEmbedTypeError unless VALID_EMBED_TYPES.include?(type)
|
|
55
|
+
|
|
56
|
+
if type == :image
|
|
57
|
+
%{<a href="" onclick="img=document.getElementById('#{id}'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false">#{label}</a><br>
|
|
58
|
+
<img id="#{id}" style="display: none" src="#{src}"/>}
|
|
59
|
+
else
|
|
60
|
+
%{<a id="#{id}" href="#{src}" title="#{label}">#{label}</a>}
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def summary_div
|
|
65
|
+
div(id: 'summary') do
|
|
66
|
+
p('', id: 'totals')
|
|
67
|
+
p('', id: 'duration')
|
|
68
|
+
|
|
69
|
+
expand_collapse
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def expand_collapse
|
|
74
|
+
div(id: 'expand-collapse') do
|
|
75
|
+
p('Expand All', id: 'expander')
|
|
76
|
+
p('Collapse All', id: 'collapser')
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def prepend_to_span(span_class, content)
|
|
81
|
+
span(class: span_class) do |pre|
|
|
82
|
+
pre << content
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def inline_css
|
|
87
|
+
style(type: 'text/css') do
|
|
88
|
+
pn = ::Pathname.new(::File.dirname(__FILE__) + '/cucumber.css')
|
|
89
|
+
self << pn.read
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def inline_js
|
|
94
|
+
script(type: 'text/javascript') do
|
|
95
|
+
self << inline_jquery
|
|
96
|
+
self << inline_js_content
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def inline_jquery
|
|
101
|
+
pn = ::Pathname.new(::File.dirname(__FILE__) + '/jquery-min.js')
|
|
102
|
+
pn.read
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def inline_js_content # rubocop:disable
|
|
106
|
+
pn = ::Pathname.new(::File.dirname(__FILE__) + '/inline-js.js')
|
|
107
|
+
pn.read
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def set_head_tags
|
|
111
|
+
head do
|
|
112
|
+
meta('http-equiv' => 'Content-Type', :content => 'text/html;charset=utf-8')
|
|
113
|
+
title 'Cucumber'
|
|
114
|
+
inline_css
|
|
115
|
+
inline_js
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
SCENARIOS = "h3[id^='scenario_'],h3[id^=background_]";
|
|
2
|
+
|
|
3
|
+
$(document).ready(function() {
|
|
4
|
+
$(SCENARIOS).css('cursor', 'pointer');
|
|
5
|
+
$(SCENARIOS).click(function() {
|
|
6
|
+
$(this).siblings().toggle(250);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
$("#collapser").css('cursor', 'pointer');
|
|
10
|
+
$("#collapser").click(function() {
|
|
11
|
+
$(SCENARIOS).siblings().hide();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
$("#expander").css('cursor', 'pointer');
|
|
15
|
+
$("#expander").click(function() {
|
|
16
|
+
$(SCENARIOS).siblings().show();
|
|
17
|
+
});
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
function moveProgressBar(percentDone) {
|
|
21
|
+
$("cucumber-header").css('width', percentDone +"%");
|
|
22
|
+
}
|
|
23
|
+
function makeRed(element_id) {
|
|
24
|
+
$('#'+element_id).css('background', '#C40D0D');
|
|
25
|
+
$('#'+element_id).css('color', '#FFFFFF');
|
|
26
|
+
}
|
|
27
|
+
function makeYellow(element_id) {
|
|
28
|
+
$('#'+element_id).css('background', '#FAF834');
|
|
29
|
+
$('#'+element_id).css('color', '#000000');
|
|
30
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'thread'
|
|
2
3
|
|
|
3
4
|
module Cucumber
|
|
@@ -12,7 +13,7 @@ module Cucumber
|
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def write(str)
|
|
15
|
-
lock.synchronize do
|
|
16
|
+
lock.synchronize do
|
|
16
17
|
@buffer << str if @wrapped
|
|
17
18
|
return @pipe.write(str)
|
|
18
19
|
end
|
|
@@ -70,7 +71,7 @@ module Cucumber
|
|
|
70
71
|
end
|
|
71
72
|
end
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
private
|
|
74
75
|
def lock
|
|
75
76
|
@lock||=Mutex.new
|
|
76
77
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Cucumber
|
|
2
3
|
module Formatter
|
|
3
4
|
module Io
|
|
@@ -27,7 +28,7 @@ module Cucumber
|
|
|
27
28
|
raise "You *must* specify --out DIR for the #{name} formatter" unless String === path
|
|
28
29
|
raise "I can't write #{name} reports to a file - it has to be a directory" if File.file?(path)
|
|
29
30
|
FileUtils.mkdir_p(path) unless File.directory?(path)
|
|
30
|
-
path
|
|
31
|
+
File.absolute_path path
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'multi_json'
|
|
2
3
|
require 'base64'
|
|
3
4
|
require 'cucumber/formatter/backtrace_filter'
|
|
@@ -11,16 +12,17 @@ module Cucumber
|
|
|
11
12
|
include Io
|
|
12
13
|
|
|
13
14
|
def initialize(config)
|
|
14
|
-
config.on_event :before_test_case, &method(:on_before_test_case)
|
|
15
|
-
config.on_event :after_test_case, &method(:on_after_test_case)
|
|
16
|
-
config.on_event :before_test_step, &method(:on_before_test_step)
|
|
17
|
-
config.on_event :after_test_step, &method(:on_after_test_step)
|
|
18
|
-
config.on_event :finished_testing, &method(:on_finished_testing)
|
|
19
15
|
@io = ensure_io(config.out_stream)
|
|
20
16
|
@feature_hashes = []
|
|
17
|
+
@step_or_hook_hash = {}
|
|
18
|
+
config.on_event :test_case_started, &method(:on_test_case_started)
|
|
19
|
+
config.on_event :test_case_finished, &method(:on_test_case_finished)
|
|
20
|
+
config.on_event :test_step_started, &method(:on_test_step_started)
|
|
21
|
+
config.on_event :test_step_finished, &method(:on_test_step_finished)
|
|
22
|
+
config.on_event :test_run_finished, &method(:on_test_run_finished)
|
|
21
23
|
end
|
|
22
24
|
|
|
23
|
-
def
|
|
25
|
+
def on_test_case_started(event)
|
|
24
26
|
test_case = event.test_case
|
|
25
27
|
builder = Builder.new(test_case)
|
|
26
28
|
unless same_feature_as_previous_test_case?(test_case.feature)
|
|
@@ -38,7 +40,7 @@ module Cucumber
|
|
|
38
40
|
@any_step_failed = false
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
def
|
|
43
|
+
def on_test_step_started(event)
|
|
42
44
|
test_step = event.test_step
|
|
43
45
|
return if internal_hook?(test_step)
|
|
44
46
|
hook_query = HookQueryVisitor.new(test_step)
|
|
@@ -56,20 +58,21 @@ module Cucumber
|
|
|
56
58
|
@step_hash = @step_or_hook_hash
|
|
57
59
|
end
|
|
58
60
|
|
|
59
|
-
def
|
|
60
|
-
test_step = event.
|
|
61
|
-
result =
|
|
61
|
+
def on_test_step_finished(event)
|
|
62
|
+
test_step, result = *event.attributes
|
|
63
|
+
result = result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
|
|
62
64
|
return if internal_hook?(test_step)
|
|
63
65
|
add_match_and_result(test_step, result)
|
|
64
66
|
@any_step_failed = true if result.failed?
|
|
65
67
|
end
|
|
66
68
|
|
|
67
|
-
def
|
|
68
|
-
result = event.
|
|
69
|
+
def on_test_case_finished(event)
|
|
70
|
+
_test_case, result = *event.attributes
|
|
71
|
+
result = result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
|
|
69
72
|
add_failed_around_hook(result) if result.failed? && !@any_step_failed
|
|
70
73
|
end
|
|
71
74
|
|
|
72
|
-
def
|
|
75
|
+
def on_test_run_finished(_event)
|
|
73
76
|
@io.write(MultiJson.dump(@feature_hashes, pretty: true))
|
|
74
77
|
end
|
|
75
78
|
|
|
@@ -99,7 +102,7 @@ module Cucumber
|
|
|
99
102
|
end
|
|
100
103
|
|
|
101
104
|
def first_step_after_background?(test_step)
|
|
102
|
-
test_step.source[1].
|
|
105
|
+
test_step.source[1].to_s != @element_hash[:name]
|
|
103
106
|
end
|
|
104
107
|
|
|
105
108
|
def internal_hook?(test_step)
|
|
@@ -127,7 +130,7 @@ module Cucumber
|
|
|
127
130
|
when :after_step
|
|
128
131
|
return after_step_hooks
|
|
129
132
|
else
|
|
130
|
-
fail '
|
|
133
|
+
fail 'Unknown hook type ' + hook_query.type.to_s
|
|
131
134
|
end
|
|
132
135
|
end
|
|
133
136
|
|
|
@@ -158,7 +161,7 @@ module Cucumber
|
|
|
158
161
|
def create_step_hash(step_source)
|
|
159
162
|
step_hash = {
|
|
160
163
|
keyword: step_source.keyword,
|
|
161
|
-
name: step_source.
|
|
164
|
+
name: step_source.to_s,
|
|
162
165
|
line: step_source.location.line
|
|
163
166
|
}
|
|
164
167
|
step_hash[:comments] = Formatter.create_comments_array(step_source.comments) unless step_source.comments.empty?
|
|
@@ -168,7 +171,7 @@ module Cucumber
|
|
|
168
171
|
end
|
|
169
172
|
|
|
170
173
|
def create_doc_string_hash(doc_string)
|
|
171
|
-
content_type = doc_string.content_type ? doc_string.content_type :
|
|
174
|
+
content_type = doc_string.content_type ? doc_string.content_type : ''
|
|
172
175
|
{
|
|
173
176
|
value: doc_string.content,
|
|
174
177
|
content_type: content_type,
|
|
@@ -190,12 +193,12 @@ module Cucumber
|
|
|
190
193
|
def add_failed_around_hook(result)
|
|
191
194
|
@step_or_hook_hash = {}
|
|
192
195
|
around_hooks << @step_or_hook_hash
|
|
193
|
-
@step_or_hook_hash[:match] = { location:
|
|
196
|
+
@step_or_hook_hash[:match] = { location: 'unknown_hook_location:1' }
|
|
194
197
|
|
|
195
198
|
@step_or_hook_hash[:result] = create_result_hash(result)
|
|
196
199
|
end
|
|
197
200
|
|
|
198
|
-
def create_match_hash(test_step,
|
|
201
|
+
def create_match_hash(test_step, _result)
|
|
199
202
|
{ location: test_step.action_location.to_s }
|
|
200
203
|
end
|
|
201
204
|
|
|
@@ -216,7 +219,7 @@ module Cucumber
|
|
|
216
219
|
|
|
217
220
|
def encode64(data)
|
|
218
221
|
# strip newlines from the encoded data
|
|
219
|
-
Base64.encode64(data).
|
|
222
|
+
Base64.encode64(data).delete("\n")
|
|
220
223
|
end
|
|
221
224
|
|
|
222
225
|
class Builder
|
|
@@ -237,17 +240,17 @@ module Cucumber
|
|
|
237
240
|
uri: feature.file,
|
|
238
241
|
id: create_id(feature),
|
|
239
242
|
keyword: feature.keyword,
|
|
240
|
-
name: feature.
|
|
243
|
+
name: feature.to_s,
|
|
241
244
|
description: feature.description,
|
|
242
245
|
line: feature.location.line
|
|
243
246
|
}
|
|
244
247
|
unless feature.tags.empty?
|
|
245
248
|
@feature_hash[:tags] = create_tags_array(feature.tags)
|
|
246
|
-
if @test_case_hash[:tags]
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
@test_case_hash[:tags] = if @test_case_hash[:tags]
|
|
250
|
+
@feature_hash[:tags] + @test_case_hash[:tags]
|
|
251
|
+
else
|
|
252
|
+
@feature_hash[:tags]
|
|
253
|
+
end
|
|
251
254
|
end
|
|
252
255
|
@feature_hash[:comments] = Formatter.create_comments_array(feature.comments) unless feature.comments.empty?
|
|
253
256
|
@test_case_hash[:id].insert(0, @feature_hash[:id] + ';')
|
|
@@ -256,7 +259,7 @@ module Cucumber
|
|
|
256
259
|
def background(background)
|
|
257
260
|
@background_hash = {
|
|
258
261
|
keyword: background.keyword,
|
|
259
|
-
name: background.
|
|
262
|
+
name: background.to_s,
|
|
260
263
|
description: background.description,
|
|
261
264
|
line: background.location.line,
|
|
262
265
|
type: 'background'
|
|
@@ -268,7 +271,7 @@ module Cucumber
|
|
|
268
271
|
@test_case_hash = {
|
|
269
272
|
id: create_id(scenario),
|
|
270
273
|
keyword: scenario.keyword,
|
|
271
|
-
name: scenario.
|
|
274
|
+
name: scenario.to_s,
|
|
272
275
|
description: scenario.description,
|
|
273
276
|
line: scenario.location.line,
|
|
274
277
|
type: 'scenario'
|
|
@@ -281,7 +284,7 @@ module Cucumber
|
|
|
281
284
|
@test_case_hash = {
|
|
282
285
|
id: create_id(scenario) + ';' + @example_id,
|
|
283
286
|
keyword: scenario.keyword,
|
|
284
|
-
name: scenario.
|
|
287
|
+
name: scenario.to_s,
|
|
285
288
|
description: scenario.description,
|
|
286
289
|
line: @row.location.line,
|
|
287
290
|
type: 'scenario'
|
|
@@ -314,7 +317,7 @@ module Cucumber
|
|
|
314
317
|
private
|
|
315
318
|
|
|
316
319
|
def create_id(element)
|
|
317
|
-
element.
|
|
320
|
+
element.to_s.downcase.tr(' ', '-')
|
|
318
321
|
end
|
|
319
322
|
|
|
320
323
|
def create_tags_array(tags)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'builder'
|
|
2
3
|
require 'cucumber/formatter/backtrace_filter'
|
|
3
4
|
require 'cucumber/formatter/io'
|
|
@@ -18,11 +19,11 @@ module Cucumber
|
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def initialize(config)
|
|
21
|
-
config.on_event :
|
|
22
|
-
config.on_event :
|
|
23
|
-
config.on_event :
|
|
24
|
-
config.on_event :
|
|
25
|
-
@reportdir = ensure_dir(config.out_stream,
|
|
22
|
+
config.on_event :test_case_started, &method(:on_test_case_started)
|
|
23
|
+
config.on_event :test_case_finished, &method(:on_test_case_finished)
|
|
24
|
+
config.on_event :test_step_finished, &method(:on_test_step_finished)
|
|
25
|
+
config.on_event :test_run_finished, &method(:on_test_run_finished)
|
|
26
|
+
@reportdir = ensure_dir(config.out_stream, 'junit')
|
|
26
27
|
@config = config
|
|
27
28
|
@features_data = Hash.new { |h,k| h[k] = {
|
|
28
29
|
feature: nil,
|
|
@@ -35,7 +36,7 @@ module Cucumber
|
|
|
35
36
|
}}
|
|
36
37
|
end
|
|
37
38
|
|
|
38
|
-
def
|
|
39
|
+
def on_test_case_started(event)
|
|
39
40
|
test_case = event.test_case
|
|
40
41
|
unless same_feature_as_previous_test_case?(test_case.feature)
|
|
41
42
|
start_feature(test_case.feature)
|
|
@@ -47,15 +48,16 @@ module Cucumber
|
|
|
47
48
|
@interceptederr = Interceptor::Pipe.wrap(:stderr)
|
|
48
49
|
end
|
|
49
50
|
|
|
50
|
-
def
|
|
51
|
+
def on_test_step_finished(event)
|
|
52
|
+
test_step, result = *event.attributes
|
|
51
53
|
return if @failing_step_source
|
|
52
54
|
|
|
53
|
-
@failing_step_source =
|
|
55
|
+
@failing_step_source = test_step.source.last unless result.ok?(@config.strict)
|
|
54
56
|
end
|
|
55
57
|
|
|
56
|
-
def
|
|
57
|
-
test_case = event.
|
|
58
|
-
result =
|
|
58
|
+
def on_test_case_finished(event)
|
|
59
|
+
test_case, result = *event.attributes
|
|
60
|
+
result = result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
|
|
59
61
|
test_case_name = NameBuilder.new(test_case)
|
|
60
62
|
scenario = test_case_name.scenario_name
|
|
61
63
|
scenario_designation = "#{scenario}#{test_case_name.name_suffix}"
|
|
@@ -66,7 +68,7 @@ module Cucumber
|
|
|
66
68
|
Interceptor::Pipe.unwrap! :stderr
|
|
67
69
|
end
|
|
68
70
|
|
|
69
|
-
def
|
|
71
|
+
def on_test_run_finished(_event)
|
|
70
72
|
@features_data.each { |file, data| end_feature(data) }
|
|
71
73
|
end
|
|
72
74
|
|
|
@@ -90,7 +92,7 @@ module Cucumber
|
|
|
90
92
|
:errors => feature_data[:errors],
|
|
91
93
|
:skipped => feature_data[:skipped],
|
|
92
94
|
:tests => feature_data[:tests],
|
|
93
|
-
:time =>
|
|
95
|
+
:time => format('%.6f', feature_data[:time]),
|
|
94
96
|
:name => feature_data[:feature].name ) do
|
|
95
97
|
@testsuite << feature_data[:builder].target!
|
|
96
98
|
end
|
|
@@ -100,10 +102,10 @@ module Cucumber
|
|
|
100
102
|
|
|
101
103
|
def create_output_string(test_case, scenario, result, row_name)
|
|
102
104
|
output = "#{test_case.keyword}: #{scenario}\n\n"
|
|
103
|
-
return output if result.ok?(@config.strict
|
|
104
|
-
if test_case.keyword ==
|
|
105
|
-
output +=
|
|
106
|
-
output += "#{@failing_step_source
|
|
105
|
+
return output if result.ok?(@config.strict)
|
|
106
|
+
if test_case.keyword == 'Scenario'
|
|
107
|
+
output += @failing_step_source.keyword.to_s unless hook?(@failing_step_source)
|
|
108
|
+
output += "#{@failing_step_source}\n"
|
|
107
109
|
else
|
|
108
110
|
output += "Example row: #{row_name}\n"
|
|
109
111
|
end
|
|
@@ -111,7 +113,7 @@ module Cucumber
|
|
|
111
113
|
end
|
|
112
114
|
|
|
113
115
|
def hook?(step)
|
|
114
|
-
[
|
|
116
|
+
['Before hook', 'After hook', 'AfterStep hook'].include? step.text
|
|
115
117
|
end
|
|
116
118
|
|
|
117
119
|
def build_testcase(result, scenario_designation, output)
|
|
@@ -120,8 +122,8 @@ module Cucumber
|
|
|
120
122
|
classname = @current_feature_data[:feature].name
|
|
121
123
|
name = scenario_designation
|
|
122
124
|
|
|
123
|
-
@current_feature_data[:builder].testcase(:classname => classname, :name => name, :time =>
|
|
124
|
-
if !result.passed? && result.ok?(@config.strict
|
|
125
|
+
@current_feature_data[:builder].testcase(:classname => classname, :name => name, :time => format('%.6f', duration)) do
|
|
126
|
+
if !result.passed? && result.ok?(@config.strict)
|
|
125
127
|
@current_feature_data[:builder].skipped
|
|
126
128
|
@current_feature_data[:skipped] += 1
|
|
127
129
|
elsif !result.passed?
|
|
@@ -180,8 +182,8 @@ module Cucumber
|
|
|
180
182
|
attr_reader :scenario_name, :name_suffix, :row_name
|
|
181
183
|
|
|
182
184
|
def initialize(test_case)
|
|
183
|
-
@name_suffix =
|
|
184
|
-
@row_name =
|
|
185
|
+
@name_suffix = ''
|
|
186
|
+
@row_name = ''
|
|
185
187
|
test_case.describe_source_to self
|
|
186
188
|
end
|
|
187
189
|
|
|
@@ -190,12 +192,12 @@ module Cucumber
|
|
|
190
192
|
end
|
|
191
193
|
|
|
192
194
|
def scenario(scenario)
|
|
193
|
-
@scenario_name = (scenario.name.nil? || scenario.name ==
|
|
195
|
+
@scenario_name = (scenario.name.nil? || scenario.name == '') ? 'Unnamed scenario' : scenario.name
|
|
194
196
|
self
|
|
195
197
|
end
|
|
196
198
|
|
|
197
199
|
def scenario_outline(outline)
|
|
198
|
-
@scenario_name = (outline.name.nil? || outline.name ==
|
|
200
|
+
@scenario_name = (outline.name.nil? || outline.name == '') ? 'Unnamed scenario outline' : outline.name
|
|
199
201
|
self
|
|
200
202
|
end
|
|
201
203
|
|