class Cucumber::Formatter::Progress

The formatter used for --format progress

Constants

CHARS
TestCaseData

Attributes

config[R]
runtime[R]
summary[R]

Public Class Methods

new(config) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 20
def initialize(config)
  @config, @io = config, ensure_io(config.out_stream)
  @previous_step_keyword = nil
  @snippets_input = []
  @total_duration = 0
  @summary = Cucumber::Core::Report::Summary.new(config.event_bus)
  @matches = {}
  @pending_step_matches = []
  @failed_results = []
  @failed_test_cases = []
  @passed_test_cases = []
  @counts = ConsoleCounts.new(config)
  @issues = ConsoleIssues.new(config)
  config.on_event :step_activated, &method(:on_step_activated)
  config.on_event :test_case_started, &method(:on_test_case_started)
  config.on_event :test_step_finished, &method(:on_test_step_finished)
  config.on_event :test_case_finished, &method(:on_test_case_finished)
  config.on_event :test_run_finished, &method(:on_test_run_finished)
end

Public Instance Methods

on_step_activated(event) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 40
def on_step_activated(event)
  @matches[event.test_step.source] = event.step_match
end
on_test_case_finished(event) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 63
def on_test_case_finished(event)
  test_case = event.test_case
  result = event.result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
  @failed_test_cases << test_case if result.failed?
  @passed_test_cases << test_case if result.passed?
  @total_duration += DurationExtractor.new(result).result_duration
end
on_test_case_started(_event) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 44
def on_test_case_started(_event)
  unless @profile_information_printed
    do_print_profile_information(config.profiles) unless config.skip_profile_information? || config.profiles.nil? || config.profiles.empty?
    @profile_information_printed = true
  end
  @previous_step_keyword = nil
end
on_test_run_finished(_event) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 71
def on_test_run_finished(_event)
  @io.puts
  @io.puts
  print_summary
end
on_test_step_finished(event) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 52
def on_test_step_finished(event)
  test_step = event.test_step
  result = event.result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
  progress(result.to_sym) if !HookQueryVisitor.new(test_step).hook? || result.failed?

  return if HookQueryVisitor.new(test_step).hook?
  collect_snippet_data(test_step, result)
  @pending_step_matches << @matches[test_step.source] if result.pending?
  @failed_results << result if result.failed?
end

Private Instance Methods

print_summary() click to toggle source
progress(status) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 102
def progress(status)
  char = CHARS[status]
  @io.print(format_string(char, status))
  @io.flush
end
table_header_cell?(status) click to toggle source
# File lib/cucumber/formatter/progress.rb, line 108
def table_header_cell?(status)
  status == :skipped_param
end