Class: Gurke::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/gurke/reporter.rb

Overview

A Reporter provides callbacks that will be executed whenever a specific execution step starts or ends.

Direct Known Subclasses

Gurke::Reporters::NullReporter

Constant Summary collapse

CALLBACKS =

List of all callback methods as symbols.

%i[
  before_features
  before_feature
  before_scenario
  before_step
  start_features
  start_feature
  start_scenario
  start_background
  start_step
  end_features
  end_feature
  end_scenario
  end_background
  end_step
  after_features
  after_feature
  after_scenario
  after_step

  retry_scenario
].freeze

Instance Method Summary collapse

Instance Method Details

#after_feature(_feature) ⇒ Object

Called after each feature and after all hooks.

Parameters:

  • feature (Feature)

    Current feature.



241
242
243
244
# File 'lib/gurke/reporter.rb', line 241

def after_feature(_feature)
  raise NotImplementedError.new \
    "#{self.class.name}#after_feature must be implemented in subclass."
end

#after_features(_features) ⇒ Object

Called after all features and after all hooks.

Parameters:

  • features (Array<Feature>)

    List of all features.



263
264
265
266
# File 'lib/gurke/reporter.rb', line 263

def after_features(_features)
  raise NotImplementedError.new \
    "#{self.class.name}#after_features must be implemented in subclass."
end

#after_scenario(_scenario) ⇒ Object

Called after each scenario and after all hooks.

Parameters:

  • scenario (Scenario)

    Current scenario.

  • feature (Feature)

    Current feature.



219
220
221
222
# File 'lib/gurke/reporter.rb', line 219

def after_scenario(_scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#after_scenario must be implemented in subclass."
end

#after_step(_step_result, _scenario) ⇒ Object

Called after each step, after all step hook.

Parameters:

  • step_result (StepResult)

    Result of current Step.

  • scenario (Scenario)

    Current scenario.

  • feature (Feature)

    Current feature.



184
185
186
187
# File 'lib/gurke/reporter.rb', line 184

def after_step(_step_result, _scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#after_step must be implemented in subclass."
end

#before_feature(_feature) ⇒ Object

Called for each feature before it starts, but before any before-feature hook is run.

Parameters:

  • feature (Feature)

    The feature that is going to be executed now.



73
74
75
76
# File 'lib/gurke/reporter.rb', line 73

def before_feature(_feature)
  raise NotImplementedError.new \
    "#{self.class.name}#start_feature must be implemented in subclass."
end

#before_features(_features) ⇒ Object

Called before the execution of any feature and before any before-features hook is invoked.

Parameters:

  • features (Array<Feature>)

    List of all features that are going to be executed.



47
48
49
50
# File 'lib/gurke/reporter.rb', line 47

def before_features(_features)
  raise NotImplementedError.new \
    "#{self.class.name}#before_features must be implemented in subclass."
end

#before_scenario(_scenario) ⇒ Object

Called for each each scenario before it starts. Will be called before any hooks for the given scenario is executed.

Parameters:

  • scenario (Scenario)

    Current scenario.



98
99
100
101
# File 'lib/gurke/reporter.rb', line 98

def before_scenario(_scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#before_scenario must be implemented in subclass."
end

#before_step(_step, _scenario) ⇒ Object

Called before each step and before any before-step hook.

Parameters:

  • step (Step)

    Current Step.

  • scenario (Scenario)

    Current scenario.



146
147
148
149
# File 'lib/gurke/reporter.rb', line 146

def before_step(_step, _scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#before_step must be implemented in subclass."
end

#end_background(_background, _scenario) ⇒ Object

Called after each background.

Parameters:

  • background (Background)

    Current background.

  • scenario (Scenario)

    Current scenario.



134
135
136
137
# File 'lib/gurke/reporter.rb', line 134

def end_background(_background, _scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#end_background must be implemented in subclass."
end

#end_feature(_feature) ⇒ Object

Called after each feature but before any after hook.

Parameters:

  • feature (Feature)

    Current feature.



230
231
232
233
# File 'lib/gurke/reporter.rb', line 230

def end_feature(_feature)
  raise NotImplementedError.new \
    "#{self.class.name}#end_feature must be implemented in subclass."
end

#end_features(_features) ⇒ Object

Called after all features but before any after-features hook.

Parameters:

  • features (Array<Feature>)

    List of all features.



252
253
254
255
# File 'lib/gurke/reporter.rb', line 252

def end_features(_features)
  raise NotImplementedError.new \
    "#{self.class.name}#end_features must be implemented in subclass."
end

#end_scenario(_scenario) ⇒ Object

Called after each scenario but before any after hook.

Parameters:

  • scenario (Scenario)

    Current scenario.

  • feature (Feature)

    Current feature.



196
197
198
199
# File 'lib/gurke/reporter.rb', line 196

def end_scenario(_scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#end_scenario must be implemented in subclass."
end

#end_step(_step_result, _scenario) ⇒ Object

Called after each step but before any after-step hook.

Parameters:

  • step_result (StepResult)

    Result of current Step.

  • scenario (Scenario)

    Current scenario.

  • feature (Feature)

    Current feature.



171
172
173
174
# File 'lib/gurke/reporter.rb', line 171

def end_step(_step_result, _scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#end_step must be implemented in subclass."
end

#retry_scenario(_scenario) ⇒ Object

Called when a flaky scenario is retried.

Parameters:

  • scenario (Scenario)

    Current scenario.



207
208
209
210
# File 'lib/gurke/reporter.rb', line 207

def retry_scenario(_scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#retry_scenario must be implemented in subclass."
end

#start_background(_background, _scenario) ⇒ Object

Called before each background.

Parameters:

  • background (Background)

    Current background.

  • scenario (Scenario)

    Current scenario.



122
123
124
125
# File 'lib/gurke/reporter.rb', line 122

def start_background(_background, _scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#start_background must be implemented in subclass."
end

#start_feature(_feature) ⇒ Object

Called for each feature before it starts, but after all before-feature hooks.

Parameters:

  • feature (Feature)

    The feature that is going to be executed now.



86
87
88
89
# File 'lib/gurke/reporter.rb', line 86

def start_feature(_feature)
  raise NotImplementedError.new \
    "#{self.class.name}#start_feature must be implemented in subclass."
end

#start_features(_features) ⇒ Object

Called before the execute of any feature, but after all before-features hooks.

Parameters:

  • features (Array<Feature>)

    List of all features that are going to be executed.



60
61
62
63
# File 'lib/gurke/reporter.rb', line 60

def start_features(_features)
  raise NotImplementedError.new \
    "#{self.class.name}#before_features must be implemented in subclass."
end

#start_scenario(_scenario) ⇒ Object

Called for each each scenario before it starts, but after all before hooks for given scenario.

Parameters:

  • scenario (Scenario)

    Current scenario.



110
111
112
113
# File 'lib/gurke/reporter.rb', line 110

def start_scenario(_scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#start_scenario must be implemented in subclass."
end

#start_step(_step, _scenario) ⇒ Object

Called before each step and after all before-step hooks.

Parameters:

  • step (Step)

    Current Step.

  • scenario (Scenario)

    Current scenario.



158
159
160
161
# File 'lib/gurke/reporter.rb', line 158

def start_step(_step, _scenario)
  raise NotImplementedError.new \
    "#{self.class.name}#start_step must be implemented in subclass."
end