Class: Cucumber::Messages::TestStepFinished

Inherits:
Message
  • Object
show all
Defined in:
lib/cucumber/messages/test_step_finished.rb

Overview

Represents the TestStepFinished message in Cucumber’s message protocol.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

camelize, from_json, #to_h, #to_json

Constructor Details

#initialize(test_case_started_id: '', test_step_id: '', test_step_result: TestStepResult.new, timestamp: Timestamp.new) ⇒ TestStepFinished

Returns a new instance of TestStepFinished.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cucumber/messages/test_step_finished.rb', line 19

def initialize(
  test_case_started_id: '',
  test_step_id: '',
  test_step_result: TestStepResult.new,
  timestamp: Timestamp.new
)
  @test_case_started_id = test_case_started_id
  @test_step_id = test_step_id
  @test_step_result = test_step_result
  @timestamp = timestamp
  super()
end

Instance Attribute Details

#test_case_started_idObject (readonly)

Returns the value of attribute test_case_started_id.



11
12
13
# File 'lib/cucumber/messages/test_step_finished.rb', line 11

def test_case_started_id
  @test_case_started_id
end

#test_step_idObject (readonly)

Returns the value of attribute test_step_id.



13
14
15
# File 'lib/cucumber/messages/test_step_finished.rb', line 13

def test_step_id
  @test_step_id
end

#test_step_resultObject (readonly)

Returns the value of attribute test_step_result.



15
16
17
# File 'lib/cucumber/messages/test_step_finished.rb', line 15

def test_step_result
  @test_step_result
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



17
18
19
# File 'lib/cucumber/messages/test_step_finished.rb', line 17

def timestamp
  @timestamp
end

Class Method Details

.from_h(hash) ⇒ Object

Returns a new TestStepFinished from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.

Cucumber::Messages::TestStepFinished.from_h(some_hash) # => #<Cucumber::Messages::TestStepFinished:0x... ...>


39
40
41
42
43
44
45
46
47
48
# File 'lib/cucumber/messages/test_step_finished.rb', line 39

def self.from_h(hash)
  return nil if hash.nil?

  new(
    test_case_started_id: hash[:testCaseStartedId],
    test_step_id: hash[:testStepId],
    test_step_result: TestStepResult.from_h(hash[:testStepResult]),
    timestamp: Timestamp.from_h(hash[:timestamp])
  )
end