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.
-
#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) ⇒ 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) ⇒ TestRunFinished
Returns a new instance of TestRunFinished.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 31 def initialize( message: nil, success: false, timestamp: Timestamp.new, exception: nil ) @message = @success = success @timestamp = @exception = exception 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 |
#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... ...>
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cucumber/messages/test_run_finished.rb', line 51 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]) ) end |