Class: Cucumber::Messages::TestStepStarted

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

Overview

Represents the TestStepStarted 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: '', timestamp: Timestamp.new) ⇒ TestStepStarted

Returns a new instance of TestStepStarted.



17
18
19
20
21
22
23
24
25
26
# File 'lib/cucumber/messages/test_step_started.rb', line 17

def initialize(
  test_case_started_id: '',
  test_step_id: '',
  timestamp: Timestamp.new
)
  @test_case_started_id = test_case_started_id
  @test_step_id = test_step_id
  @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_started.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_started.rb', line 13

def test_step_id
  @test_step_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



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

def timestamp
  @timestamp
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


35
36
37
38
39
40
41
42
43
# File 'lib/cucumber/messages/test_step_started.rb', line 35

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

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