Module: Rutema::Elements::Standard

Defined in:
lib/rutema/elements/general.rb

Instance Method Summary collapse

Instance Method Details

#element_fail(step) ⇒ Object

Fails a test

Configuration

No configuration necessary

Extras

The attribute text can be used to set the error message for the step

Example Elements

<fail/> <fail text=β€œOn Purpose!”/>



99
100
101
102
103
104
105
106
# File 'lib/rutema/elements/general.rb', line 99

def element_fail step
  step.cmd=Patir::RubyCommand.new("fail",File.expand_path(File.dirname(__FILE__))) do |cmd|
     msg="Fail! "
     msg<<step.text if step.has_text?
     raise msg
   end
   return step
end

#element_wait(step) ⇒ Object

Waits for a while

Configuration

No configuration necessary

Extras

Requires the attribute timeout setting the time to wait in seconds

Example Elements

<wait timeout=β€œ5”/>

Raises:

  • (Rutema::ParserError)


81
82
83
84
85
86
87
# File 'lib/rutema/elements/general.rb', line 81

def element_wait step
   raise Rutema::ParserError,"No timeout attribute for wait step" unless step.has_timeout?
   step.cmd=Patir::RubyCommand.new("wait",File.expand_path(File.dirname(__FILE__))) do |cmd|
     sleep step.timeout
   end
   return step
end