Class: Rutema::RunnerMessage
- Defined in:
- lib/rutema/core/framework.rb
Overview
Message container continually being emitted by runners (see Runners module) during test execution
These messages inform about the progress of test execution. Test errors are propagated through instances of this class as well. If it's an engine error (e.g. during parsing), then an ErrorMessage will be used in that case.
Instance Attribute Summary collapse
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#err ⇒ Object
Returns the value of attribute err.
-
#is_special ⇒ Object
Returns the value of attribute is_special.
-
#number ⇒ Object
Returns the value of attribute number.
-
#out ⇒ Object
Returns the value of attribute out.
-
#status ⇒ Object
Returns the value of attribute status.
Attributes inherited from Message
Instance Method Summary collapse
-
#initialize(params) ⇒ RunnerMessage
constructor
Initialize a new runner message from data passed in a hash.
- #output ⇒ Object
-
#to_s ⇒ Object
Convert the instance to a convenient textual representation.
Constructor Details
#initialize(params) ⇒ RunnerMessage
Initialize a new runner message from data passed in a hash
Additionally to the keys of the Message initializer the following keys of the hash are being utilized:
- "duration" - the time a test step took for execution
- "status" - the status of the respective step
:timestamp- most often the timestamp of the creation of the message, defaults toTime.now
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/rutema/core/framework.rb', line 88 def initialize(params) super @duration = params.fetch("duration", 0) @status = params.fetch("status", :none) @number = params.fetch("number", 1) @out = params.fetch("out", "") @err = params.fetch("err", "") @backtrace = params.fetch("backtrace", []) @is_special = params.fetch("is_special", "") end |
Instance Attribute Details
#duration ⇒ Object
Returns the value of attribute duration.
77 78 79 |
# File 'lib/rutema/core/framework.rb', line 77 def duration @duration end |
#err ⇒ Object
Returns the value of attribute err.
77 78 79 |
# File 'lib/rutema/core/framework.rb', line 77 def err @err end |
#is_special ⇒ Object
Returns the value of attribute is_special.
77 78 79 |
# File 'lib/rutema/core/framework.rb', line 77 def is_special @is_special end |
#number ⇒ Object
Returns the value of attribute number.
77 78 79 |
# File 'lib/rutema/core/framework.rb', line 77 def number @number end |
#out ⇒ Object
Returns the value of attribute out.
77 78 79 |
# File 'lib/rutema/core/framework.rb', line 77 def out @out end |
#status ⇒ Object
Returns the value of attribute status.
77 78 79 |
# File 'lib/rutema/core/framework.rb', line 77 def status @status end |
Instance Method Details
#output ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/rutema/core/framework.rb', line 110 def output msg = "" msg << "#{@out}\n" unless @out.empty? msg << @err unless @err.empty? msg << "\n#{@backtrace.is_a?(Array) ? @backtrace.join("\n") : @backtrace}" unless @backtrace.empty? return msg.chomp end |
#to_s ⇒ Object
Convert the instance to a convenient textual representation
101 102 103 104 105 106 107 108 |
# File 'lib/rutema/core/framework.rb', line 101 def to_s msg = "#{@test}:" msg << " #{@timestamp.strftime("%H:%M:%S")} :" msg << "#{@text}." unless @text.empty? outpt = output msg << " Output:\n#{outpt}" unless outpt.empty? || @status != :error return msg end |