Class: Cucumber::Messages::TestCaseStarted
- Defined in:
- lib/cucumber/messages/test_case_started.rb
Overview
Represents the TestCaseStarted message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#attempt ⇒ Object
readonly
-
The first attempt should have value 0, and for each retry the value should increase by 1.
-
-
#id ⇒ Object
readonly
-
Because a ‘TestCase` can be run multiple times (in case of a retry), we use this field to group messages relating to the same attempt.
-
-
#test_case_id ⇒ Object
readonly
Returns the value of attribute test_case_id.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#worker_id ⇒ Object
readonly
An identifier for the worker process running this test case, if test cases are being run in parallel.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new TestCaseStarted from the given hash.
Instance Method Summary collapse
-
#initialize(attempt: 0, id: '', test_case_id: '', worker_id: nil, timestamp: Timestamp.new) ⇒ TestCaseStarted
constructor
A new instance of TestCaseStarted.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(attempt: 0, id: '', test_case_id: '', worker_id: nil, timestamp: Timestamp.new) ⇒ TestCaseStarted
Returns a new instance of TestCaseStarted.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cucumber/messages/test_case_started.rb', line 34 def initialize( attempt: 0, id: '', test_case_id: '', worker_id: nil, timestamp: Timestamp.new ) @attempt = attempt @id = id @test_case_id = test_case_id @worker_id = worker_id @timestamp = super() end |
Instance Attribute Details
#attempt ⇒ Object (readonly)
*
The first attempt should have value 0, and for each retry the value
should increase by 1.
16 17 18 |
# File 'lib/cucumber/messages/test_case_started.rb', line 16 def attempt @attempt end |
#id ⇒ Object (readonly)
*
Because a `TestCase` can be run multiple times (in case of a retry),
we use this field to group messages relating to the same attempt.
23 24 25 |
# File 'lib/cucumber/messages/test_case_started.rb', line 23 def id @id end |
#test_case_id ⇒ Object (readonly)
Returns the value of attribute test_case_id.
25 26 27 |
# File 'lib/cucumber/messages/test_case_started.rb', line 25 def test_case_id @test_case_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
32 33 34 |
# File 'lib/cucumber/messages/test_case_started.rb', line 32 def @timestamp end |
#worker_id ⇒ Object (readonly)
An identifier for the worker process running this test case, if test cases are being run in parallel. 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.
30 31 32 |
# File 'lib/cucumber/messages/test_case_started.rb', line 30 def worker_id @worker_id end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new TestCaseStarted from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::TestCaseStarted.from_h(some_hash) # => #<Cucumber::Messages::TestCaseStarted:0x... ...>
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cucumber/messages/test_case_started.rb', line 56 def self.from_h(hash) return nil if hash.nil? new( attempt: hash[:attempt], id: hash[:id], test_case_id: hash[:testCaseId], worker_id: hash[:workerId], timestamp: Timestamp.from_h(hash[:timestamp]) ) end |