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
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'cucumber/core/filter'
|
|
2
3
|
require 'cucumber/running_test_case'
|
|
3
|
-
require 'cucumber/events
|
|
4
|
-
require 'cucumber/events/after_test_case'
|
|
4
|
+
require 'cucumber/events'
|
|
5
5
|
|
|
6
6
|
module Cucumber
|
|
7
7
|
module Filters
|
|
8
8
|
class Retry < Core::Filter.new(:configuration)
|
|
9
9
|
|
|
10
10
|
def test_case(test_case)
|
|
11
|
-
configuration.on_event(:
|
|
11
|
+
configuration.on_event(:test_case_finished) do |event|
|
|
12
12
|
next unless retry_required?(test_case, event)
|
|
13
13
|
|
|
14
14
|
test_case_counts[test_case] += 1
|
|
15
|
-
|
|
15
|
+
test_case.describe_to(receiver)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
super
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Cucumber
|
|
2
3
|
module Filters
|
|
3
4
|
class TagLimits
|
|
@@ -27,7 +28,7 @@ module Cucumber
|
|
|
27
28
|
attr_reader :tag_limits
|
|
28
29
|
|
|
29
30
|
class Breach
|
|
30
|
-
INDENT = (
|
|
31
|
+
INDENT = (' ' * 2).freeze
|
|
31
32
|
|
|
32
33
|
def initialize(tag_name, limit, locations)
|
|
33
34
|
@tag_name = tag_name
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
require
|
|
3
|
-
require
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'cucumber/filters/gated_receiver'
|
|
3
|
+
require 'cucumber/filters/tag_limits/test_case_index'
|
|
4
|
+
require 'cucumber/filters/tag_limits/verifier'
|
|
4
5
|
|
|
5
6
|
module Cucumber
|
|
6
7
|
module Filters
|
data/lib/cucumber/filters.rb
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'cucumber/filters/activate_steps'
|
|
2
3
|
require 'cucumber/filters/apply_after_step_hooks'
|
|
3
4
|
require 'cucumber/filters/apply_before_hooks'
|
|
4
5
|
require 'cucumber/filters/apply_after_hooks'
|
|
5
6
|
require 'cucumber/filters/apply_around_hooks'
|
|
7
|
+
require 'cucumber/filters/broadcast_test_run_started_event'
|
|
6
8
|
require 'cucumber/filters/prepare_world'
|
|
7
9
|
require 'cucumber/filters/quit'
|
|
8
10
|
require 'cucumber/filters/randomizer'
|
|
11
|
+
require 'cucumber/filters/retry'
|
|
9
12
|
require 'cucumber/filters/tag_limits'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'cucumber/platform'
|
|
2
3
|
require 'cucumber/term/ansicolor'
|
|
3
4
|
|
|
@@ -8,7 +9,7 @@ if Cucumber::WINDOWS_MRI
|
|
|
8
9
|
end
|
|
9
10
|
end
|
|
10
11
|
|
|
11
|
-
Cucumber::Term::ANSIColor.coloring = false if !STDOUT.tty? && !ENV.
|
|
12
|
+
Cucumber::Term::ANSIColor.coloring = false if !STDOUT.tty? && !ENV.key?('AUTOTEST')
|
|
12
13
|
|
|
13
14
|
module Cucumber
|
|
14
15
|
module Formatter
|
|
@@ -59,6 +60,7 @@ module Cucumber
|
|
|
59
60
|
end.merge({
|
|
60
61
|
'undefined' => 'yellow',
|
|
61
62
|
'pending' => 'yellow',
|
|
63
|
+
'flaky' => 'yellow',
|
|
62
64
|
'failed' => 'red',
|
|
63
65
|
'passed' => 'green',
|
|
64
66
|
'outline' => 'cyan',
|
|
@@ -104,7 +106,7 @@ module Cucumber
|
|
|
104
106
|
begin
|
|
105
107
|
gem 'genki-ruby-terminfo'
|
|
106
108
|
require 'terminfo'
|
|
107
|
-
case TermInfo.default_object.tigetnum(
|
|
109
|
+
case TermInfo.default_object.tigetnum('colors')
|
|
108
110
|
when 0
|
|
109
111
|
raise "Your terminal doesn't support colours."
|
|
110
112
|
when 1
|
|
@@ -117,9 +119,9 @@ module Cucumber
|
|
|
117
119
|
end
|
|
118
120
|
rescue Exception => e
|
|
119
121
|
if e.class.name == 'TermInfo::TermInfoError'
|
|
120
|
-
STDERR.puts
|
|
122
|
+
STDERR.puts '*** WARNING ***'
|
|
121
123
|
STDERR.puts "You have the genki-ruby-terminfo gem installed, but you haven't set your TERM variable."
|
|
122
|
-
STDERR.puts
|
|
124
|
+
STDERR.puts 'Try setting it to TERM=xterm-256color to get grey colour in output.'
|
|
123
125
|
STDERR.puts "\n"
|
|
124
126
|
alias grey white
|
|
125
127
|
else
|
|
@@ -129,19 +131,15 @@ module Cucumber
|
|
|
129
131
|
end
|
|
130
132
|
|
|
131
133
|
def self.define_real_grey #:nodoc:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"\e[90m#{string}\e[0m"
|
|
135
|
-
else
|
|
136
|
-
string
|
|
137
|
-
end
|
|
134
|
+
define_method :grey do |string|
|
|
135
|
+
::Cucumber::Term::ANSIColor.coloring? ? "\e[90m#{string}\e[0m" : string
|
|
138
136
|
end
|
|
139
137
|
end
|
|
140
138
|
|
|
141
139
|
define_grey
|
|
142
140
|
|
|
143
141
|
def cukes(n)
|
|
144
|
-
(
|
|
142
|
+
('(::) ' * n).strip
|
|
145
143
|
end
|
|
146
144
|
|
|
147
145
|
def green_cukes(n)
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'cucumber/platform'
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
module Cucumber
|
|
5
6
|
module Formatter
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
@backtrace_filters = %w(
|
|
8
|
+
/vendor/rails
|
|
9
|
+
lib/cucumber
|
|
10
|
+
bin/cucumber:
|
|
11
|
+
lib/rspec
|
|
12
|
+
gems/
|
|
13
|
+
minitest
|
|
14
|
+
test/unit
|
|
15
|
+
.gem/ruby
|
|
16
|
+
lib/ruby/
|
|
17
|
+
bin/bundle
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
if ::Cucumber::JRUBY
|
|
21
|
+
@backtrace_filters << 'org/jruby/'
|
|
11
22
|
end
|
|
12
23
|
|
|
24
|
+
BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.join('|'))
|
|
25
|
+
|
|
13
26
|
class BacktraceFilter
|
|
14
27
|
def initialize(exception)
|
|
15
28
|
@exception = exception
|
|
@@ -19,10 +32,10 @@ module Cucumber
|
|
|
19
32
|
return @exception if ::Cucumber.use_full_backtrace
|
|
20
33
|
|
|
21
34
|
pwd_pattern = /#{::Regexp.escape(::Dir.pwd)}\//m
|
|
22
|
-
@exception.backtrace.
|
|
35
|
+
backtrace = @exception.backtrace.map { |line| line.gsub(pwd_pattern, './') }
|
|
23
36
|
|
|
24
|
-
filtered = (
|
|
25
|
-
|
|
37
|
+
filtered = (backtrace || []).reject do |line|
|
|
38
|
+
line =~ BACKTRACE_FILTER_PATTERNS
|
|
26
39
|
end
|
|
27
40
|
|
|
28
41
|
if ::ENV['CUCUMBER_TRUNCATE_OUTPUT']
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'cucumber/formatter/ansicolor'
|
|
2
3
|
require 'cucumber/formatter/duration'
|
|
3
|
-
require 'cucumber/
|
|
4
|
+
require 'cucumber/gherkin/i18n'
|
|
4
5
|
|
|
5
6
|
module Cucumber
|
|
6
7
|
module Formatter
|
|
@@ -28,15 +29,14 @@ module Cucumber
|
|
|
28
29
|
module Console
|
|
29
30
|
extend ANSIColor
|
|
30
31
|
include Duration
|
|
31
|
-
include Summary
|
|
32
32
|
|
|
33
33
|
def format_step(keyword, step_match, status, source_indent)
|
|
34
34
|
comment = if source_indent
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
c = ('# ' + step_match.location.to_s).indent(source_indent)
|
|
36
|
+
format_string(c, :comment)
|
|
37
|
+
else
|
|
38
|
+
''
|
|
39
|
+
end
|
|
40
40
|
|
|
41
41
|
format = format_for(status, :param)
|
|
42
42
|
line = keyword + step_match.format_args(format) + comment
|
|
@@ -59,75 +59,53 @@ module Cucumber
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def print_elements(elements, status, kind)
|
|
62
|
-
if elements.
|
|
62
|
+
return if elements.empty?
|
|
63
|
+
|
|
64
|
+
element_messages = element_messages(elements, status)
|
|
65
|
+
print_element_messages(element_messages, status, kind)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def print_element_messages(element_messages, status, kind)
|
|
69
|
+
if element_messages.any?
|
|
63
70
|
@io.puts(format_string("(::) #{status} #{kind} (::)", status))
|
|
64
71
|
@io.puts
|
|
65
72
|
@io.flush
|
|
66
73
|
end
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
print_exception(element.exception, status, 0)
|
|
71
|
-
else
|
|
72
|
-
message = linebreaks(element.backtrace_line, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
|
|
73
|
-
@io.puts(format_string(message, status))
|
|
74
|
-
end
|
|
75
|
+
element_messages.each do |message|
|
|
76
|
+
@io.puts(format_string(message, status))
|
|
75
77
|
@io.puts
|
|
76
78
|
@io.flush
|
|
77
79
|
end
|
|
78
80
|
end
|
|
79
81
|
|
|
80
|
-
def
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def print_statistics(duration, options)
|
|
86
|
-
failures = collect_failing_scenarios(runtime)
|
|
87
|
-
if !failures.empty?
|
|
88
|
-
print_failing_scenarios(failures, options.custom_profiles, options[:source])
|
|
82
|
+
def print_statistics(duration, config, counts, issues)
|
|
83
|
+
if issues.any?
|
|
84
|
+
@io.puts issues.to_s
|
|
85
|
+
@io.puts
|
|
89
86
|
end
|
|
90
87
|
|
|
91
|
-
@io.puts
|
|
92
|
-
@io.puts
|
|
93
|
-
@io.puts(format_duration(duration)) if duration && options[:duration]
|
|
88
|
+
@io.puts counts.to_s
|
|
89
|
+
@io.puts(format_duration(duration)) if duration && config.duration?
|
|
94
90
|
|
|
95
|
-
if
|
|
91
|
+
if config.randomize?
|
|
96
92
|
@io.puts
|
|
97
|
-
@io.puts "Randomized with seed #{
|
|
93
|
+
@io.puts "Randomized with seed #{config.seed}"
|
|
98
94
|
end
|
|
99
95
|
|
|
100
96
|
@io.flush
|
|
101
97
|
end
|
|
102
98
|
|
|
103
|
-
def
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
example_table_class = Core::Ast::ExamplesTable
|
|
107
|
-
|
|
108
|
-
runtime.scenarios(:failed).select do |s|
|
|
109
|
-
[scenario_class, example_table_class].include?(s.class)
|
|
110
|
-
end.map do |s|
|
|
111
|
-
s.is_a?(example_table_class)? s.scenario_outline : s
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def print_failing_scenarios(failures, custom_profiles, given_source)
|
|
116
|
-
@io.puts format_string("Failing Scenarios:", :failed)
|
|
117
|
-
failures.each do |failure|
|
|
118
|
-
profiles_string = custom_profiles.empty? ? '' : (custom_profiles.map{|profile| "-p #{profile}" }).join(' ') + ' '
|
|
119
|
-
source = given_source ? format_string(" # " + failure.name, :comment) : ''
|
|
120
|
-
@io.puts format_string("cucumber #{profiles_string}" + failure.location, :failed) + source
|
|
121
|
-
end
|
|
122
|
-
@io.puts
|
|
99
|
+
def print_exception(e, status, indent)
|
|
100
|
+
string = exception_message_string(e, indent)
|
|
101
|
+
@io.puts(format_string(string, status))
|
|
123
102
|
end
|
|
124
103
|
|
|
125
|
-
def
|
|
126
|
-
message = "#{e.message} (#{e.class})".force_encoding(
|
|
104
|
+
def exception_message_string(e, indent)
|
|
105
|
+
message = "#{e.message} (#{e.class})".dup.force_encoding('UTF-8')
|
|
127
106
|
message = linebreaks(message, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
|
|
128
107
|
|
|
129
|
-
|
|
130
|
-
@io.puts(format_string(string, status))
|
|
108
|
+
"#{message}\n#{e.backtrace.join("\n")}".indent(indent)
|
|
131
109
|
end
|
|
132
110
|
|
|
133
111
|
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/10655
|
|
@@ -138,21 +116,26 @@ module Cucumber
|
|
|
138
116
|
|
|
139
117
|
def collect_snippet_data(test_step, result)
|
|
140
118
|
# collect snippet data for undefined steps
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
end
|
|
147
|
-
end
|
|
119
|
+
return if hook?(test_step)
|
|
120
|
+
keyword = test_step.source.last.actual_keyword(@previous_step_keyword)
|
|
121
|
+
@previous_step_keyword = keyword
|
|
122
|
+
return unless result.undefined?
|
|
123
|
+
@snippets_input << Console::SnippetData.new(keyword, test_step.source.last)
|
|
148
124
|
end
|
|
149
125
|
|
|
150
126
|
def print_snippets(options)
|
|
151
127
|
return unless options[:snippets]
|
|
152
128
|
return if runtime.steps(:undefined).empty?
|
|
153
129
|
|
|
130
|
+
snippet_text_proc = lambda { |step_keyword, step_name, multiline_arg|
|
|
131
|
+
runtime.snippet_text(step_keyword, step_name, multiline_arg)
|
|
132
|
+
}
|
|
133
|
+
do_print_snippets(snippet_text_proc)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def do_print_snippets(snippet_text_proc)
|
|
154
137
|
snippets = @snippets_input.map do |data|
|
|
155
|
-
|
|
138
|
+
snippet_text_proc.call(data.actual_keyword, data.step.text, data.step.multiline_arg)
|
|
156
139
|
end.uniq
|
|
157
140
|
|
|
158
141
|
text = "\nYou can implement step definitions for undefined steps with these snippets:\n\n"
|
|
@@ -165,10 +148,14 @@ module Cucumber
|
|
|
165
148
|
|
|
166
149
|
def print_passing_wip(options)
|
|
167
150
|
return unless options[:wip]
|
|
168
|
-
|
|
169
|
-
|
|
151
|
+
passed_messages = element_messages(runtime.scenarios(:passed), :passed)
|
|
152
|
+
do_print_passing_wip(passed_messages)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def do_print_passing_wip(passed_messages)
|
|
156
|
+
if passed_messages.any?
|
|
170
157
|
@io.puts format_string("\nThe --wip switch was used, so I didn't expect anything to pass. These scenarios passed:", :failed)
|
|
171
|
-
|
|
158
|
+
print_element_messages(passed_messages, :passed, 'scenarios')
|
|
172
159
|
else
|
|
173
160
|
@io.puts format_string("\nThe --wip switch was used, so the failures were expected. All is good.\n", :passed)
|
|
174
161
|
end
|
|
@@ -217,8 +204,10 @@ module Cucumber
|
|
|
217
204
|
|
|
218
205
|
def print_profile_information
|
|
219
206
|
return if @options[:skip_profile_information] || @options[:profiles].nil? || @options[:profiles].empty?
|
|
220
|
-
|
|
221
|
-
|
|
207
|
+
do_print_profile_information(@options[:profiles])
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def do_print_profile_information(profiles)
|
|
222
211
|
profiles_sentence = profiles.size == 1 ? profiles.first :
|
|
223
212
|
"#{profiles[0...-1].join(', ')} and #{profiles.last}"
|
|
224
213
|
|
|
@@ -240,6 +229,23 @@ module Cucumber
|
|
|
240
229
|
not test_step.source.last.respond_to?(:actual_keyword)
|
|
241
230
|
end
|
|
242
231
|
|
|
232
|
+
def element_messages(elements, status)
|
|
233
|
+
elements.map do |element|
|
|
234
|
+
if status == :failed
|
|
235
|
+
exception_message_string(element.exception, 0)
|
|
236
|
+
else
|
|
237
|
+
linebreaks(element.backtrace_line, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def snippet_text(step_keyword, step_name, multiline_arg)
|
|
243
|
+
keyword = Cucumber::Gherkin::I18n.code_keyword_for(step_keyword).strip
|
|
244
|
+
config.snippet_generators.map { |generator|
|
|
245
|
+
generator.call(keyword, step_name, multiline_arg, config.snippet_type)
|
|
246
|
+
}.join("\n")
|
|
247
|
+
end
|
|
248
|
+
|
|
243
249
|
class SnippetData
|
|
244
250
|
attr_reader :actual_keyword, :step
|
|
245
251
|
def initialize(actual_keyword, step)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'cucumber/formatter/console'
|
|
2
|
+
|
|
3
|
+
module Cucumber
|
|
4
|
+
module Formatter
|
|
5
|
+
class ConsoleCounts
|
|
6
|
+
include Console
|
|
7
|
+
|
|
8
|
+
def initialize(config)
|
|
9
|
+
@summary = Core::Report::Summary.new(config.event_bus)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def to_s
|
|
13
|
+
[
|
|
14
|
+
[scenario_count, status_counts(@summary.test_cases)].compact.join(' '),
|
|
15
|
+
[step_count, status_counts(@summary.test_steps)].compact.join(' ')
|
|
16
|
+
].join("\n")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def scenario_count
|
|
22
|
+
count = @summary.test_cases.total
|
|
23
|
+
"#{count} scenario" + (count == 1 ? '' : 's')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def step_count
|
|
27
|
+
count = @summary.test_steps.total
|
|
28
|
+
"#{count} step" + (count == 1 ? '' : 's')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def status_counts(summary)
|
|
32
|
+
counts = Core::Test::Result::TYPES.map { |status|
|
|
33
|
+
count = summary.total(status)
|
|
34
|
+
[status, count]
|
|
35
|
+
}.select { |status, count|
|
|
36
|
+
count > 0
|
|
37
|
+
}.map { |status, count|
|
|
38
|
+
format_string("#{count} #{status}", status)
|
|
39
|
+
}
|
|
40
|
+
"(#{counts.join(", ")})" if counts.any?
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'cucumber/formatter/console'
|
|
2
|
+
|
|
3
|
+
module Cucumber
|
|
4
|
+
module Formatter
|
|
5
|
+
class ConsoleIssues
|
|
6
|
+
include Console
|
|
7
|
+
|
|
8
|
+
def initialize(config)
|
|
9
|
+
@previous_test_case = nil
|
|
10
|
+
@issues = Hash.new { |h, k| h[k] = [] }
|
|
11
|
+
@config = config
|
|
12
|
+
@config.on_event(:test_case_finished) do |event|
|
|
13
|
+
if event.test_case != @previous_test_case
|
|
14
|
+
@previous_test_case = event.test_case
|
|
15
|
+
@issues[event.result.to_sym] << event.test_case unless event.result.ok?(@config.strict)
|
|
16
|
+
elsif event.result.passed?
|
|
17
|
+
@issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(@config.strict)
|
|
18
|
+
@issues[:failed].delete(event.test_case)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def to_s
|
|
24
|
+
return if @issues.empty?
|
|
25
|
+
result = Core::Test::Result::TYPES.map { |type| scenario_listing(type, @issues[type]) }
|
|
26
|
+
result.flatten.join("\n")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def any?
|
|
30
|
+
@issues.any?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def scenario_listing(type, test_cases)
|
|
36
|
+
return [] if test_cases.empty?
|
|
37
|
+
[ format_string("#{type_heading(type)} Scenarios:", type) ] + test_cases.map { |test_case|
|
|
38
|
+
source = @config.source? ? format_string(" # #{test_case.keyword}: #{test_case.name}", :comment) : ''
|
|
39
|
+
format_string("cucumber #{profiles_string}" + test_case.location, type) + source
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def type_heading(type)
|
|
44
|
+
case type
|
|
45
|
+
when :failed
|
|
46
|
+
'Failing'
|
|
47
|
+
else
|
|
48
|
+
type.to_s.slice(0, 1).capitalize + type.to_s.slice(1..-1)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def profiles_string
|
|
53
|
+
return if @config.custom_profiles.empty?
|
|
54
|
+
@config.custom_profiles.map { |profile| "-p #{profile}" }.join(' ') + ' '
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Cucumber
|
|
2
3
|
module Formatter
|
|
3
4
|
module Duration
|
|
@@ -6,7 +7,7 @@ module Cucumber
|
|
|
6
7
|
# <tt>time</tt> format.
|
|
7
8
|
def format_duration(seconds)
|
|
8
9
|
m, s = seconds.divmod(60)
|
|
9
|
-
"#{m}m#{'%.3f'
|
|
10
|
+
"#{m}m#{format('%.3f', s)}s"
|
|
10
11
|
end
|
|
11
12
|
end
|
|
12
13
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'cucumber/formatter/io'
|
|
2
3
|
require 'cucumber/formatter/console'
|
|
3
4
|
|
|
@@ -7,8 +8,9 @@ module Cucumber
|
|
|
7
8
|
class FailFast
|
|
8
9
|
|
|
9
10
|
def initialize(configuration)
|
|
10
|
-
configuration.on_event :
|
|
11
|
-
|
|
11
|
+
configuration.on_event :test_case_finished do |event|
|
|
12
|
+
_test_case, result = *event.attributes
|
|
13
|
+
Cucumber.wants_to_quit = true unless result.ok?(configuration.strict)
|
|
12
14
|
end
|
|
13
15
|
end
|
|
14
16
|
|