class CucumberStatistics::Formatter
Public Class Methods
new(step_mother, io, options)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 3 def initialize(step_mother, io, options) @step_mother = step_mother @io = io @options = options @overall_statistics = OverallStatistics.new @step_statistics = StepStatistics.new @scenario_statistics = ScenarioStatistics.new @feature_statistics = FeatureStatistics.new @unused_steps = UnusedSteps.new end
Public Instance Methods
after_feature(feature)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 77 def after_feature(feature) @feature_file = feature.location.to_s @feature_duration = Time.now - @feature_start_time @feature_statistics.record @feature_name, @feature_duration, @feature_file end
after_feature_element(feature_element)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 43 def after_feature_element(feature_element) @scenario_duration = Time.now - @scenario_start_time @scenario_statistics.record @scenario_name, @scenario_duration, @scenario_file_colon_line end
after_features(features)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 87 def after_features(features) @overall_statistics.end_time = Time.now # gather unused steps @step_mother.unmatched_step_definitions.each do |step_definition| @unused_steps.record step_definition.regexp_source, step_definition.location.to_s end @step_statistics.calculate Renderer.render_combined_statistics @step_statistics, @scenario_statistics, @feature_statistics, @overall_statistics end
after_step(step)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 73 def after_step(step) @overall_statistics.step_count_inc end
after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 26 def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line) step_definition = step_match.step_definition unless step_definition.nil? # nil if it's from a scenario outline @step_statistics.record step_definition.expression, @step_duration, file_colon_line end end
before_feature(feature)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 51 def before_feature(feature) @feature_name = '' @feature_file = '' @feature_start_time = Time.now end
before_feature_element(feature_element)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 37 def before_feature_element(feature_element) @scenario_name = '' @scenario_file_colon_line = '' @scenario_start_time = Time.now end
before_features(features)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 83 def before_features(features) @overall_statistics.start_time = Time.now end
before_step_result(*args)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 22 def before_step_result(*args) @step_duration = Time.now - @step_start_time end
before_test_step(step)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 18 def before_test_step(step) @step_start_time = Time.now end
feature_name(keyword, name)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 68 def feature_name(keyword, name) @overall_statistics.feature_count_inc @feature_name = name end
scenario_name(keyword, name, file_colon_line, source_indent)
click to toggle source
# File lib/cucumber_statistics/formatter.rb, line 62 def scenario_name(keyword, name, file_colon_line, source_indent) @overall_statistics.scenario_count_inc @scenario_name = name @scenario_file_colon_line = file_colon_line end