scenario_progress_formatter.rb revision 97bd5e6eaa773b8d91d4580bc8e773faea3e1bb4
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksaclass ScenarioProgressFormatter < Cucumber::Formatter::Progress
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @failed_scenario_steps << @processed_steps if @failed
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa tag = format_string(tag_name, :tag).indent(SCENARIO_INDENT)
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa @io.puts(tag)
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa def feature_name(keyword, name)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @current_feature = "Feature: #{name}"
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa @io.puts("#{keyword}: #{name}")
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa def background_name(keyword, name, file_colon_line, source_indent)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @processed_steps << "Background: #{name}"
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa print_feature_element_name(keyword, name, file_colon_line, source_indent)
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa def scenario_name(keyword, name, file_colon_line, source_indent)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @processed_steps << "Scenario: #{name}"
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa print_feature_element_name(keyword, name, file_colon_line, source_indent)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa def step_name(keyword, step_match, status, source_indent, background, file_colon_line)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa name_to_report = format_step(keyword, step_match, status, source_indent)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @processed_steps << "Step: #{name_to_report}"
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa def exception(exception, status)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa return if @hide_this_step
97bd5e6eaa773b8d91d4580bc8e773faea3e1bb4Eugen Kuksa return if exception.is_a?(Cucumber::Pending)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @processed_steps << format_exception(exception, status, EXCEPTION_INDENT)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @failed = true
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa def print_feature_element_name(keyword, name, file_colon_line, source_indent)
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa names = name.empty? ? [name] : name.split("\n")
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa line = "#{keyword}: #{names[0]}".indent(SCENARIO_INDENT)
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa @io.print(line)
dca1e74407ea4cab39b5da1c2af73f8efe68d395Eugen Kuksa @io.print(' [...]') if names[1..-1].present?
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa def print_summary(features)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa print_steps(:pending)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa print_failure_details
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa print_stats(features, @options)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa print_snippets(@options)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa print_passing_wip(@options)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa def print_failure_details
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa if @failed_scenario_steps.any?
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @io.puts(format_string("(::) steps of failed scenarios (::)", :failed))
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @failed_scenario_steps.each do |failed_scenario|
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa failed_scenario.each do |step|
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa @io.puts step.indent(SCENARIO_INDENT)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa def format_exception(e, status, indent)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa message = "#{e.message} (#{e.class})".force_encoding("UTF-8")
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa if ENV['CUCUMBER_TRUNCATE_OUTPUT']
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa message = linebreaks(message, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa string = "#{message}\n#{e.backtrace.join("\n")}".indent(indent)
a44c794981080bb4ae655ed23bbe3dd1c930ab7bEugen Kuksa format_string(string, status)