Module: AllureRSpec::DSL::Example

Defined in:
lib/robotest/dsl.rb

Constant Summary collapse

@@step_count =
0
@@current_example_location =
nil

Instance Method Summary collapse

Instance Method Details

#cstep(step, *tags, &block) ⇒ Object

to run even after failure



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/robotest/dsl.rb', line 29

def cstep(step, *tags, &block) # to run even after failure
  __increment_step_count
  [:step_group] ||= {}
  tags = tags[0].nil? ? {} : tags[0]
  [:step_group][@@step_count] = tags
  [:step_name] = step

  suite = __description([:example_group])
  test = __description()
  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) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/robotest/dsl.rb', line 8

def step(step, *tags, &block)
  __increment_step_count
  [:step_group] ||= {}
  tags = tags[0].nil? ? {} : tags[0]
  [:step_group][@@step_count] = tags
  [:step_name] = step

  suite = __description([:example_group])
  test = __description()
  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