Class: Cucumber::Formatter::SuperProfile

Inherits:
Progress
  • Object
show all
Includes:
Io
Defined in:
lib/cucumber/formatter/super_profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, path_or_io, options) ⇒ SuperProfile

Returns a new instance of SuperProfile.



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

def initialize(step_mother, path_or_io, options)
  super
  @example_times = []
end

Instance Attribute Details

#step_motherObject (readonly)

Returns the value of attribute step_mother.



10
11
12
# File 'lib/cucumber/formatter/super_profile.rb', line 10

def step_mother
  @step_mother
end

Instance Method Details

#after_features(features) ⇒ Object



45
46
47
48
49
50
# File 'lib/cucumber/formatter/super_profile.rb', line 45

def after_features(features)
  super
  dump_example_times
  dump_file_times
  @io.flush
end

#after_steps(*args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cucumber/formatter/super_profile.rb', line 27

def after_steps(*args)
  super
  my_time = Time.now - @time

  @example_times << [
    !@exception_raised,
    @scenario[:file_colon_line],
    @scenario[:name],
    Time.now - @time
  ] if @scenario

  # @io.print "feature took #{my_time}"
end

#before_features(features) ⇒ Object



17
18
19
20
# File 'lib/cucumber/formatter/super_profile.rb', line 17

def before_features(features)
  top = (SHOW_TOP==-1 ? 'all' : "top #{SHOW_TOP}")
  @io.print "Super Profiling enabled: show #{top} tests > #{SHOW_ABOVE} seconds.\n"
end

#before_steps(*args) ⇒ Object



22
23
24
25
# File 'lib/cucumber/formatter/super_profile.rb', line 22

def before_steps(*args)
  super
  @time = Time.now
end

#scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object



41
42
43
# File 'lib/cucumber/formatter/super_profile.rb', line 41

def scenario_name(keyword, name, file_colon_line, source_indent)
  @scenario = {name: name, file_colon_line: file_colon_line} 
end