module AllureRSpec::DSL::Example

Public Instance Methods

cstep(step, *tags, &block) click to toggle source
# File lib/robotest/dsl.rb, line 29
def cstep(step, *tags, &block) # to run even after failure
  __increment_step_count
  metadata[:step_group] ||= {}
  tags = tags[0].nil? ? {} : tags[0]
  metadata[:step_group][@@step_count] = tags
  metadata[:step_name] = step

  suite = __description(metadata[:example_group])
  test = __description(metadata)
  begin
    AllureRubyAdaptorApi::Builder.start_step(suite, test, step)
    __with_step step, &block
    __set_step_status('passed')
    AllureRubyAdaptorApi::Builder.stop_step(suite, test, step)
  rescue Exception => e
    __set_step_status('failed')
    AllureRubyAdaptorApi::Builder.stop_step(suite, test, step, :failed)
  end
end
step(step, *tags, &block) click to toggle source
# File lib/robotest/dsl.rb, line 8
def step(step, *tags, &block)
  __increment_step_count
  metadata[:step_group] ||= {}
  tags = tags[0].nil? ? {} : tags[0]
  metadata[:step_group][@@step_count] = tags
  metadata[:step_name] = step

  suite = __description(metadata[:example_group])
  test = __description(metadata)
  begin
    AllureRubyAdaptorApi::Builder.start_step(suite, test, step)
    __with_step step, &block
    __set_step_status('passed')
    AllureRubyAdaptorApi::Builder.stop_step(suite, test, step)
  rescue Exception => e
    __set_step_status('failed')
    AllureRubyAdaptorApi::Builder.stop_step(suite, test, step, :failed)
    raise e
  end
end

Private Instance Methods

__increment_step_count() click to toggle source
# File lib/robotest/dsl.rb, line 51
def __increment_step_count
  if @@current_example_location != metadata[:location]
    __reset_step_count
    @@current_example_location = metadata[:location]
  else
    @@step_count += 1
  end
end
__reset_step_count() click to toggle source
# File lib/robotest/dsl.rb, line 60
def __reset_step_count
  @@step_count = 0
end
__set_step_status(status) click to toggle source
# File lib/robotest/dsl.rb, line 64
def __set_step_status(status)
  metadata[:step_group][@@step_count][:status] = status
end