Class: Cucumber::Messages::TestRunFinished
- Defined in:
- lib/cucumber/messages/test_run_finished.rb
Overview
Represents the TestRunFinished message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Any exception thrown during the test run, if any.
-
#message ⇒ Object
readonly
An informative message about the test run.
-
#success ⇒ Object
readonly
A test run is successful if all steps are either passed or skipped, all before/after hooks passed and no other exceptions where thrown.
-
#test_run_started_id ⇒ Object
readonly
Returns the value of attribute test_run_started_id.
-
#timestamp ⇒ Object
readonly
Timestamp when the TestRun is finished.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new TestRunFinished from the given hash.
Instance Method Summary collapse
-
#initialize(message: nil, success: false, timestamp: Timestamp.new, exception: nil, test_run_started_id: nil) ⇒ TestRunFinished
constructor
A new instance of TestRunFinished.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(message: nil, success: false, timestamp: Timestamp.new, exception: nil, test_run_started_id: nil) ⇒ TestRunFinished
Returns a new instance of TestRunFinished.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 33 def initialize( message: nil, success: false, timestamp: Timestamp.new, exception: nil, test_run_started_id: nil ) @message = @success = success @timestamp = @exception = exception @test_run_started_id = test_run_started_id super() end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps.
29 30 31 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 29 def exception @exception end |
#message ⇒ Object (readonly)
An informative message about the test run. Typically additional information about failure, but not necessarily.
14 15 16 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 14 def @message end |
#success ⇒ Object (readonly)
A test run is successful if all steps are either passed or skipped, all before/after hooks passed and no other exceptions where thrown.
19 20 21 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 19 def success @success end |
#test_run_started_id ⇒ Object (readonly)
Returns the value of attribute test_run_started_id.
31 32 33 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 31 def test_run_started_id @test_run_started_id end |
#timestamp ⇒ Object (readonly)
Timestamp when the TestRun is finished
24 25 26 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 24 def @timestamp end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new TestRunFinished from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::TestRunFinished.from_h(some_hash) # => #<Cucumber::Messages::TestRunFinished:0x... ...>
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 55 def self.from_h(hash) return nil if hash.nil? new( message: hash[:message], success: hash[:success], timestamp: Timestamp.from_h(hash[:timestamp]), exception: Exception.from_h(hash[:exception]), test_run_started_id: hash[:testRunStartedId] ) end |