Class: Cucumber::Formatter::Summary

Inherits:
Object
  • Object
show all
Includes:
Console, Io
Defined in:
lib/cucumber/formatter/summary.rb

Overview

Summary formatter, outputting feature / scenario titles plus failure details

Constant Summary

Constants included from ANSIColor

ANSIColor::ALIASES

Constants included from Term::ANSIColor

Term::ANSIColor::ATTRIBUTES, Term::ANSIColor::ATTRIBUTE_NAMES, Term::ANSIColor::COLORED_REGEXP

Instance Method Summary collapse

Methods included from Console

#collect_snippet_data, #collect_undefined_parameter_type_names, #do_print_passing_wip, #do_print_profile_information, #do_print_snippets, #do_print_undefined_parameter_type_snippet, #exception_message_string, #format_step, #format_string, #indent, #linebreaks, #on_attach_called, #print_element_messages, #print_elements, #print_exception, #print_passing_wip, #print_profile_information, #print_snippets, #print_statistics

Methods included from ANSIColor

apply_custom_colors, #cukes, #green_cukes, #red_cukes, #yellow_cukes

Methods included from Term::ANSIColor

#attributes, included, #uncolored

Methods included from Duration

#format_duration

Methods included from Io

ensure_dir, ensure_file, ensure_io, included, io?, url?

Constructor Details

#initialize(config) ⇒ Summary

Returns a new instance of Summary.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cucumber/formatter/summary.rb', line 18

def initialize(config)
  @config = config
  @io = ensure_io(config.out_stream, config.error_stream)
  @ast_lookup = AstLookup.new(config)
  @counts = ConsoleCounts.new(@config)
  @issues = ConsoleIssues.new(@config, @ast_lookup)
  @failed_results = []
  @start_time = Time.now

  @config.on_event :test_case_started do |event|
    print_feature event.test_case
    print_test_case event.test_case
  end

  @config.on_event :test_case_finished do |event|
    print_result event.result
  end

  @config.on_event :test_step_finished do |event|
    collect_failed_result(event.test_step, event.result)
  end

  @config.on_event :test_run_finished do |_event|
    duration = Time.now - @start_time
    @io.puts
    print_elements(@failed_results, :failed, 'steps')
    print_statistics(duration, @config, @counts, @issues)
  end
end