Class: Cucumber::Formatter::Progress

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

Overview

The formatter used for --format progress

Direct Known Subclasses

Usage

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 Attribute Summary collapse

Instance Method Summary collapse

Methods included from Io

ensure_dir, ensure_file, ensure_io

Methods included from Console

#collect_failing_scenarios, #collect_snippet_data, #embed, #empty_messages, #format_step, #format_string, #linebreaks, #print_elements, #print_exception, #print_failing_scenarios, #print_message, #print_messages, #print_passing_wip, #print_profile_information, #print_snippets, #print_statistics, #print_stats, #print_steps, #print_table_row_messages, #puts

Methods included from ANSIColor

#cukes, define_grey, define_real_grey, #green_cukes, #grey, #red_cukes, #yellow_cukes

Methods included from Term::ANSIColor

attributes, coloring=, coloring?, #uncolored

Methods included from Summary

#scenario_summary, #step_summary

Methods included from Duration

#format_duration

Constructor Details

#initialize(runtime, path_or_io, options) ⇒ Progress

Returns a new instance of Progress.



14
15
16
17
18
19
# File 'lib/cucumber/formatter/progress.rb', line 14

def initialize(runtime, path_or_io, options)
  @runtime, @io, @options = runtime, ensure_io(path_or_io), options
  @previous_step_keyword = nil
  @snippets_input = []
  @total_duration = 0
end

Instance Attribute Details

#runtimeObject (readonly)

Returns the value of attribute runtime.



12
13
14
# File 'lib/cucumber/formatter/progress.rb', line 12

def runtime
  @runtime
end

Instance Method Details

#after_test_case(_test_case, result) ⇒ Object



34
35
36
# File 'lib/cucumber/formatter/progress.rb', line 34

def after_test_case(_test_case, result)
  @total_duration += DurationExtractor.new(result).result_duration
end

#after_test_step(test_step, result) ⇒ Object



29
30
31
32
# File 'lib/cucumber/formatter/progress.rb', line 29

def after_test_step(test_step, result)
  progress(result.to_sym) if !HookQueryVisitor.new(test_step).hook? || result.failed?
  collect_snippet_data(test_step, result) unless HookQueryVisitor.new(test_step).hook?
end

#before_test_case(_test_case) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/cucumber/formatter/progress.rb', line 21

def before_test_case(_test_case)
  unless @profile_information_printed
    print_profile_information
    @profile_information_printed = true
  end
  @previous_step_keyword = nil
end

#doneObject



38
39
40
41
42
# File 'lib/cucumber/formatter/progress.rb', line 38

def done
  @io.puts
  @io.puts
  print_summary
end