Class: Rutema::ReportState

Inherits:
Object
  • Object
show all
Defined in:
lib/rutema/core/framework.rb

Overview

While executing tests the state of each test is collected in an instance of ReportState and the collection is at the end passed to the available block reporters

ReportState assumes the timestamp of the first message, the status of the last message and accumulates the duration reported by all messages in it's collection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ ReportState

Returns a new instance of ReportState.



128
129
130
131
132
133
134
135
# File 'lib/rutema/core/framework.rb', line 128

def initialize(message)
  @test = message.test
  @timestamp = message.timestamp
  @duration = message.duration
  @status = message.status
  @steps = [message]
  @is_special = message.is_special
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



126
127
128
# File 'lib/rutema/core/framework.rb', line 126

def duration
  @duration
end

#is_specialObject (readonly)

Returns the value of attribute is_special.



126
127
128
# File 'lib/rutema/core/framework.rb', line 126

def is_special
  @is_special
end

#statusObject (readonly)

Returns the value of attribute status.



126
127
128
# File 'lib/rutema/core/framework.rb', line 126

def status
  @status
end

#stepsObject

Returns the value of attribute steps.



125
126
127
# File 'lib/rutema/core/framework.rb', line 125

def steps
  @steps
end

#testObject (readonly)

Returns the value of attribute test.



126
127
128
# File 'lib/rutema/core/framework.rb', line 126

def test
  @test
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



126
127
128
# File 'lib/rutema/core/framework.rb', line 126

def timestamp
  @timestamp
end

Instance Method Details

#<<(message) ⇒ Object



137
138
139
140
141
142
# File 'lib/rutema/core/framework.rb', line 137

def <<(message)
  @steps << message
  @duration += message.duration
  @status = message.status unless message.status.nil? \
    || (!@status.nil? && STATUS_CODES.find_index(message.status) < STATUS_CODES.find_index(@status))
end