Class: Cucumber::Messages::TestRunHookStarted
- Defined in:
- lib/cucumber/messages/test_run_hook_started.rb
Overview
Represents the TestRunHookStarted message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#hook_id ⇒ Object
readonly
Identifier for the hook that will be executed.
-
#id ⇒ Object
readonly
Unique identifier for this hook execution.
-
#test_run_started_id ⇒ Object
readonly
Identifier for the test run that this hook execution belongs to.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#worker_id ⇒ Object
readonly
An identifier for the worker process running this hook, if parallel workers are in use.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new TestRunHookStarted from the given hash.
Instance Method Summary collapse
-
#initialize(id: '', test_run_started_id: '', hook_id: '', worker_id: nil, timestamp: Timestamp.new) ⇒ TestRunHookStarted
constructor
A new instance of TestRunHookStarted.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(id: '', test_run_started_id: '', hook_id: '', worker_id: nil, timestamp: Timestamp.new) ⇒ TestRunHookStarted
Returns a new instance of TestRunHookStarted.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 33 def initialize( id: '', test_run_started_id: '', hook_id: '', worker_id: nil, timestamp: Timestamp.new ) @id = id @test_run_started_id = test_run_started_id @hook_id = hook_id @worker_id = worker_id @timestamp = super() end |
Instance Attribute Details
#hook_id ⇒ Object (readonly)
Identifier for the hook that will be executed
24 25 26 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 24 def hook_id @hook_id end |
#id ⇒ Object (readonly)
Unique identifier for this hook execution
14 15 16 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 14 def id @id end |
#test_run_started_id ⇒ Object (readonly)
Identifier for the test run that this hook execution belongs to
19 20 21 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 19 def test_run_started_id @test_run_started_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
31 32 33 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 31 def @timestamp end |
#worker_id ⇒ Object (readonly)
An identifier for the worker process running this hook, if parallel workers are in use. The identifier will be unique per worker, but no particular format is defined - it could be an index, uuid, machine name etc - and as such should be assumed that it’s not human readable.
29 30 31 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 29 def worker_id @worker_id end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new TestRunHookStarted from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::TestRunHookStarted.from_h(some_hash) # => #<Cucumber::Messages::TestRunHookStarted:0x... ...>
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 55 def self.from_h(hash) return nil if hash.nil? new( id: hash[:id], test_run_started_id: hash[:testRunStartedId], hook_id: hash[:hookId], worker_id: hash[:workerId], timestamp: Timestamp.from_h(hash[:timestamp]) ) end |