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.



239
240
241
242
# File 'lib/gurke/reporter.rb', line 239

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.



261
262
263
264
# File 'lib/gurke/reporter.rb', line 261

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.



217
218
219
220
# File 'lib/gurke/reporter.rb', line 217

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.



182
183
184
185
# File 'lib/gurke/reporter.rb', line 182

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.



71
72
73
74
# File 'lib/gurke/reporter.rb', line 71

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.



45
46
47
48
# File 'lib/gurke/reporter.rb', line 45

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.



96
97
98
99
# File 'lib/gurke/reporter.rb', line 96

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.



144
145
146
147
# File 'lib/gurke/reporter.rb', line 144

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.



132
133
134
135
# File 'lib/gurke/reporter.rb', line 132

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.



228
229
230
231
# File 'lib/gurke/reporter.rb', line 228

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.



250
251
252
253
# File 'lib/gurke/reporter.rb', line 250

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.



194
195
196
197
# File 'lib/gurke/reporter.rb', line 194

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.



169
170
171
172
# File 'lib/gurke/reporter.rb', line 169

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.



205
206
207
208
# File 'lib/gurke/reporter.rb', line 205

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.



120
121
122
123
# File 'lib/gurke/reporter.rb', line 120

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.



84
85
86
87
# File 'lib/gurke/reporter.rb', line 84

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.



58
59
60
61
# File 'lib/gurke/reporter.rb', line 58

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.



108
109
110
111
# File 'lib/gurke/reporter.rb', line 108

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.



156
157
158
159
# File 'lib/gurke/reporter.rb', line 156

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