class Cucumber::Formatter::Failures
Failure formatter Will only output information when a test fails The output structure is:
Feature title
Scenario title Step text Full stacktrace
Attributes
indent[W]
runtime[R]
Public Class Methods
new(runtime, path_or_io, options)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 21 def initialize(runtime, path_or_io, options) @runtime = runtime @io = ensure_io(path_or_io) @options = options @exceptions = [] @indent = 0 @prefixes = options[:prefixes] || {} @delayed_messages = [] @previous_step_keyword = nil @snippets_input = [] @output = [] end
Public Instance Methods
after_background(_background)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 57 def after_background(_background) @in_background = false end
after_features(features)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 40 def after_features(features) print_summary(features) end
after_table_row(table_row)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 85 def after_table_row(table_row) return unless table_row.exception @table_row = " Row: #{table_row.name}" exception(table_row.exception, table_row.status, 6) end
after_test_step(test_step, result)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 91 def after_test_step(test_step, result) collect_snippet_data(test_step, result) end
background_name(keyword, name, *_args)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 61 def background_name(keyword, name, *_args) simple_name = name.split("\n").first @background = " #{keyword}: #{simple_name}" end
before_background(_background)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 53 def before_background(_background) @in_background = true end
before_feature(_feature)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 44 def before_feature(_feature) @background_failure = false end
before_features(_features)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 34 def before_features(_features) print_profile_information @io.puts 'Testing has started...' @io.flush end
exception(exception, status, indent = 6)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 75 def exception(exception, status, indent = 6) unless @background_failure print_scenario_summary print_exception(exception, status, indent) @io.puts @io.flush end @background_failure = @in_background end
feature_name(keyword, name)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 48 def feature_name(keyword, name) simple_name = name.split("\n").first @feature = "#{keyword}: #{simple_name}" end
scenario_name(keyword, name, *_args)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 66 def scenario_name(keyword, name, *_args) simple_name = name.split("\n").first @scenario = " #{keyword}: #{simple_name}" end
step_name(keyword, step_match, *_args)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 71 def step_name(keyword, step_match, *_args) @step = " #{keyword}#{step_match.format_args}" end
Private Instance Methods
print_scenario_summary()
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 97 def print_scenario_summary @io.puts @feature unless @feature.nil? @io.puts @scenario ? @scenario : @background @io.puts @step unless @step.nil? @io.puts @table_row unless @table_row.nil? @feature = nil @background = nil @scenario = nil @step = nil @table_row = nil end
print_summary(features)
click to toggle source
# File lib/cucumber/formatter/failures.rb, line 110 def print_summary(features) @io.puts print_stats(features, @options) print_snippets(@options) print_passing_wip(@options) end