Module: QAT::Formatter::Loggable

Includes:
Mdc, Logger
Included in:
Console, Dashboard
Defined in:
lib/qat/formatter/loggable.rb,
lib/qat/formatter/loggable/mdc.rb,
lib/qat/formatter/loggable/scenario_info.rb

Overview

Helper module to manage formatters based on QAT::Logger

Since:

  • 0.1.0

Defined Under Namespace

Modules: Mdc, ScenarioInfo

Instance Method Summary collapse

Methods included from Mdc

#mdc_add_status_failed!, #mdc_add_step!, #mdc_after_feature!, #mdc_before_feature!, #mdc_before_scenario!, #mdc_remove_step!, #mdc_reset_scenario!

Instance Method Details

#begin_test_step(step) {|type| ... } ⇒ Symbol

Parses a test step and determines it’s type: after step, before scenario or before step. Allows a block to be used to execute in the middle of the processing

Parameters:

  • step (Cucumber::Core::Test::Step)

    Step to parse

Yields:

  • (type)

    Block to execute in the middle of processing

Yield Parameters:

  • type (Symbol)

    Type of the test step

Returns:

  • (Symbol)

    type Type of the test step

Since:

  • 0.1.0



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/qat/formatter/loggable.rb', line 34

def begin_test_step step
  #World: step.location = /usr/local/rvm/gems/ruby-2.2.3/gems/cucumber-2.0.2/lib/cucumber/filters/prepare_world.rb:27
  # step.to_s = "Before hook"

  #Hooks: step.location = /home/mgomes/Projects/qat/src/qat/lib/qat/cucumber/hooks.rb:53
  # step.to_s = "Before hook"

  #Stepdef: step.location = features/formatter.feature:8
  # step.to_s = step name

  type = set_type(step)

  yield type if block_given? and type

  set_step_status(type)

  type
end

#check_outputter(name) ⇒ Object

Since:

  • 0.1.0



14
15
16
17
18
# File 'lib/qat/formatter/loggable.rb', line 14

def check_outputter name
  return if name.respond_to? :write #Is an IO

  add_outputter_with name
end

#ensure_outputter(name) ⇒ Object

Since:

  • 0.1.0



21
22
23
24
25
# File 'lib/qat/formatter/loggable.rb', line 21

def ensure_outputter name
  raise ArgumentError.new "No outputter configured for formatter #{self.class.name}" if name.respond_to? :write

  add_outputter_with name
end