cucumber-messages 24.0.1 → 25.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/cucumber/messages/attachment.rb +126 -0
  4. data/lib/cucumber/messages/attachment_content_encoding.rb +11 -0
  5. data/lib/cucumber/messages/background.rb +64 -0
  6. data/lib/cucumber/messages/ci.rb +62 -0
  7. data/lib/cucumber/messages/comment.rb +50 -0
  8. data/lib/cucumber/messages/data_table.rb +41 -0
  9. data/lib/cucumber/messages/doc_string.rb +51 -0
  10. data/lib/cucumber/messages/duration.rb +50 -0
  11. data/lib/cucumber/messages/envelope.rb +124 -0
  12. data/lib/cucumber/messages/examples.rb +74 -0
  13. data/lib/cucumber/messages/exception.rb +57 -0
  14. data/lib/cucumber/messages/feature.rb +87 -0
  15. data/lib/cucumber/messages/feature_child.rb +49 -0
  16. data/lib/cucumber/messages/gherkin_document.rb +62 -0
  17. data/lib/cucumber/messages/git.rb +54 -0
  18. data/lib/cucumber/messages/group.rb +46 -0
  19. data/lib/cucumber/messages/helpers/id_generator/incrementing.rb +20 -0
  20. data/lib/cucumber/messages/helpers/id_generator/uuid.rb +17 -0
  21. data/lib/cucumber/messages/helpers/id_generator.rb +4 -0
  22. data/lib/cucumber/messages/helpers/ndjson_to_message_enumerator.rb +30 -0
  23. data/lib/cucumber/messages/helpers/time_conversion.rb +31 -0
  24. data/lib/cucumber/messages/hook.rb +51 -0
  25. data/lib/cucumber/messages/java_method.rb +46 -0
  26. data/lib/cucumber/messages/java_stack_trace_element.rb +46 -0
  27. data/lib/cucumber/messages/location.rb +44 -0
  28. data/lib/cucumber/messages/message.rb +92 -4
  29. data/lib/cucumber/messages/meta.rb +81 -0
  30. data/lib/cucumber/messages/parameter_type.rb +64 -0
  31. data/lib/cucumber/messages/parse_error.rb +41 -0
  32. data/lib/cucumber/messages/pickle.rb +107 -0
  33. data/lib/cucumber/messages/pickle_doc_string.rb +41 -0
  34. data/lib/cucumber/messages/pickle_step.rb +71 -0
  35. data/lib/cucumber/messages/pickle_step_argument.rb +43 -0
  36. data/lib/cucumber/messages/pickle_step_type.rb +13 -0
  37. data/lib/cucumber/messages/pickle_table.rb +36 -0
  38. data/lib/cucumber/messages/pickle_table_cell.rb +36 -0
  39. data/lib/cucumber/messages/pickle_table_row.rb +36 -0
  40. data/lib/cucumber/messages/pickle_tag.rb +47 -0
  41. data/lib/cucumber/messages/product.rb +49 -0
  42. data/lib/cucumber/messages/rule.rb +72 -0
  43. data/lib/cucumber/messages/rule_child.rb +44 -0
  44. data/lib/cucumber/messages/scenario.rb +74 -0
  45. data/lib/cucumber/messages/source.rb +63 -0
  46. data/lib/cucumber/messages/source_media_type.rb +11 -0
  47. data/lib/cucumber/messages/source_reference.rb +55 -0
  48. data/lib/cucumber/messages/step.rb +80 -0
  49. data/lib/cucumber/messages/step_definition.rb +46 -0
  50. data/lib/cucumber/messages/step_definition_pattern.rb +41 -0
  51. data/lib/cucumber/messages/step_definition_pattern_type.rb +11 -0
  52. data/lib/cucumber/messages/step_keyword_type.rb +14 -0
  53. data/lib/cucumber/messages/step_match_argument.rb +54 -0
  54. data/lib/cucumber/messages/step_match_arguments_list.rb +36 -0
  55. data/lib/cucumber/messages/table_cell.rb +49 -0
  56. data/lib/cucumber/messages/table_row.rb +54 -0
  57. data/lib/cucumber/messages/tag.rb +58 -0
  58. data/lib/cucumber/messages/test_case.rb +54 -0
  59. data/lib/cucumber/messages/test_case_finished.rb +46 -0
  60. data/lib/cucumber/messages/test_case_started.rb +69 -0
  61. data/lib/cucumber/messages/test_run_finished.rb +63 -0
  62. data/lib/cucumber/messages/test_run_started.rb +36 -0
  63. data/lib/cucumber/messages/test_step.rb +74 -0
  64. data/lib/cucumber/messages/test_step_finished.rb +51 -0
  65. data/lib/cucumber/messages/test_step_result.rb +57 -0
  66. data/lib/cucumber/messages/test_step_result_status.rb +16 -0
  67. data/lib/cucumber/messages/test_step_started.rb +46 -0
  68. data/lib/cucumber/messages/timestamp.rb +52 -0
  69. data/lib/cucumber/messages/undefined_parameter_type.rb +41 -0
  70. data/lib/cucumber/messages.rb +9 -5
  71. metadata +110 -30
  72. data/lib/cucumber/messages/id_generator.rb +0 -24
  73. data/lib/cucumber/messages/message/deserialization.rb +0 -37
  74. data/lib/cucumber/messages/message/serialization.rb +0 -70
  75. data/lib/cucumber/messages/message/utils.rb +0 -45
  76. data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +0 -21
  77. data/lib/cucumber/messages/time_conversion.rb +0 -33
  78. data/lib/cucumber/messages.deserializers.rb +0 -1208
  79. data/lib/cucumber/messages.dtos.rb +0 -1782
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the StepMatchArgumentsList message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class StepMatchArgumentsList < Message
11
+ attr_reader :step_match_arguments
12
+
13
+ def initialize(
14
+ step_match_arguments: []
15
+ )
16
+ @step_match_arguments = step_match_arguments
17
+ super()
18
+ end
19
+
20
+ ##
21
+ # Returns a new StepMatchArgumentsList from the given hash.
22
+ # If the hash keys are camelCased, they are properly assigned to the
23
+ # corresponding snake_cased attributes.
24
+ #
25
+ # Cucumber::Messages::StepMatchArgumentsList.from_h(some_hash) # => #<Cucumber::Messages::StepMatchArgumentsList:0x... ...>
26
+ ##
27
+ def self.from_h(hash)
28
+ return nil if hash.nil?
29
+
30
+ new(
31
+ step_match_arguments: hash[:stepMatchArguments]&.map { |item| StepMatchArgument.from_h(item) }
32
+ )
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TableCell message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # A cell in a `TableRow`
11
+ ##
12
+ class TableCell < Message
13
+ ##
14
+ # The location of the cell
15
+ ##
16
+ attr_reader :location
17
+
18
+ ##
19
+ # The value of the cell
20
+ ##
21
+ attr_reader :value
22
+
23
+ def initialize(
24
+ location: Location.new,
25
+ value: ''
26
+ )
27
+ @location = location
28
+ @value = value
29
+ super()
30
+ end
31
+
32
+ ##
33
+ # Returns a new TableCell from the given hash.
34
+ # If the hash keys are camelCased, they are properly assigned to the
35
+ # corresponding snake_cased attributes.
36
+ #
37
+ # Cucumber::Messages::TableCell.from_h(some_hash) # => #<Cucumber::Messages::TableCell:0x... ...>
38
+ ##
39
+ def self.from_h(hash)
40
+ return nil if hash.nil?
41
+
42
+ new(
43
+ location: Location.from_h(hash[:location]),
44
+ value: hash[:value]
45
+ )
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TableRow message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # A row in a table
11
+ ##
12
+ class TableRow < Message
13
+ ##
14
+ # The location of the first cell in the row
15
+ ##
16
+ attr_reader :location
17
+
18
+ ##
19
+ # Cells in the row
20
+ ##
21
+ attr_reader :cells
22
+
23
+ attr_reader :id
24
+
25
+ def initialize(
26
+ location: Location.new,
27
+ cells: [],
28
+ id: ''
29
+ )
30
+ @location = location
31
+ @cells = cells
32
+ @id = id
33
+ super()
34
+ end
35
+
36
+ ##
37
+ # Returns a new TableRow from the given hash.
38
+ # If the hash keys are camelCased, they are properly assigned to the
39
+ # corresponding snake_cased attributes.
40
+ #
41
+ # Cucumber::Messages::TableRow.from_h(some_hash) # => #<Cucumber::Messages::TableRow:0x... ...>
42
+ ##
43
+ def self.from_h(hash)
44
+ return nil if hash.nil?
45
+
46
+ new(
47
+ location: Location.from_h(hash[:location]),
48
+ cells: hash[:cells]&.map { |item| TableCell.from_h(item) },
49
+ id: hash[:id]
50
+ )
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Tag message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # *
11
+ # A tag
12
+ ##
13
+ class Tag < Message
14
+ ##
15
+ # Location of the tag
16
+ ##
17
+ attr_reader :location
18
+
19
+ ##
20
+ # The name of the tag (including the leading `@`)
21
+ ##
22
+ attr_reader :name
23
+
24
+ ##
25
+ # Unique ID to be able to reference the Tag from PickleTag
26
+ ##
27
+ attr_reader :id
28
+
29
+ def initialize(
30
+ location: Location.new,
31
+ name: '',
32
+ id: ''
33
+ )
34
+ @location = location
35
+ @name = name
36
+ @id = id
37
+ super()
38
+ end
39
+
40
+ ##
41
+ # Returns a new Tag from the given hash.
42
+ # If the hash keys are camelCased, they are properly assigned to the
43
+ # corresponding snake_cased attributes.
44
+ #
45
+ # Cucumber::Messages::Tag.from_h(some_hash) # => #<Cucumber::Messages::Tag:0x... ...>
46
+ ##
47
+ def self.from_h(hash)
48
+ return nil if hash.nil?
49
+
50
+ new(
51
+ location: Location.from_h(hash[:location]),
52
+ name: hash[:name],
53
+ id: hash[:id]
54
+ )
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestCase message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # //// TestCases
11
+ #
12
+ # *
13
+ # A `TestCase` contains a sequence of `TestStep`s.
14
+ ##
15
+ class TestCase < Message
16
+ attr_reader :id
17
+
18
+ ##
19
+ # The ID of the `Pickle` this `TestCase` is derived from.
20
+ ##
21
+ attr_reader :pickle_id
22
+
23
+ attr_reader :test_steps
24
+
25
+ def initialize(
26
+ id: '',
27
+ pickle_id: '',
28
+ test_steps: []
29
+ )
30
+ @id = id
31
+ @pickle_id = pickle_id
32
+ @test_steps = test_steps
33
+ super()
34
+ end
35
+
36
+ ##
37
+ # Returns a new TestCase from the given hash.
38
+ # If the hash keys are camelCased, they are properly assigned to the
39
+ # corresponding snake_cased attributes.
40
+ #
41
+ # Cucumber::Messages::TestCase.from_h(some_hash) # => #<Cucumber::Messages::TestCase:0x... ...>
42
+ ##
43
+ def self.from_h(hash)
44
+ return nil if hash.nil?
45
+
46
+ new(
47
+ id: hash[:id],
48
+ pickle_id: hash[:pickleId],
49
+ test_steps: hash[:testSteps]&.map { |item| TestStep.from_h(item) }
50
+ )
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestCaseFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class TestCaseFinished < Message
11
+ attr_reader :test_case_started_id
12
+
13
+ attr_reader :timestamp
14
+
15
+ attr_reader :will_be_retried
16
+
17
+ def initialize(
18
+ test_case_started_id: '',
19
+ timestamp: Timestamp.new,
20
+ will_be_retried: false
21
+ )
22
+ @test_case_started_id = test_case_started_id
23
+ @timestamp = timestamp
24
+ @will_be_retried = will_be_retried
25
+ super()
26
+ end
27
+
28
+ ##
29
+ # Returns a new TestCaseFinished from the given hash.
30
+ # If the hash keys are camelCased, they are properly assigned to the
31
+ # corresponding snake_cased attributes.
32
+ #
33
+ # Cucumber::Messages::TestCaseFinished.from_h(some_hash) # => #<Cucumber::Messages::TestCaseFinished:0x... ...>
34
+ ##
35
+ def self.from_h(hash)
36
+ return nil if hash.nil?
37
+
38
+ new(
39
+ test_case_started_id: hash[:testCaseStartedId],
40
+ timestamp: Timestamp.from_h(hash[:timestamp]),
41
+ will_be_retried: hash[:willBeRetried]
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestCaseStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class TestCaseStarted < Message
11
+ ##
12
+ # *
13
+ # The first attempt should have value 0, and for each retry the value
14
+ # should increase by 1.
15
+ ##
16
+ attr_reader :attempt
17
+
18
+ ##
19
+ # *
20
+ # Because a `TestCase` can be run multiple times (in case of a retry),
21
+ # we use this field to group messages relating to the same attempt.
22
+ ##
23
+ attr_reader :id
24
+
25
+ attr_reader :test_case_id
26
+
27
+ ##
28
+ # 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.
29
+ ##
30
+ attr_reader :worker_id
31
+
32
+ attr_reader :timestamp
33
+
34
+ def initialize(
35
+ attempt: 0,
36
+ id: '',
37
+ test_case_id: '',
38
+ worker_id: nil,
39
+ timestamp: Timestamp.new
40
+ )
41
+ @attempt = attempt
42
+ @id = id
43
+ @test_case_id = test_case_id
44
+ @worker_id = worker_id
45
+ @timestamp = timestamp
46
+ super()
47
+ end
48
+
49
+ ##
50
+ # Returns a new TestCaseStarted from the given hash.
51
+ # If the hash keys are camelCased, they are properly assigned to the
52
+ # corresponding snake_cased attributes.
53
+ #
54
+ # Cucumber::Messages::TestCaseStarted.from_h(some_hash) # => #<Cucumber::Messages::TestCaseStarted:0x... ...>
55
+ ##
56
+ def self.from_h(hash)
57
+ return nil if hash.nil?
58
+
59
+ new(
60
+ attempt: hash[:attempt],
61
+ id: hash[:id],
62
+ test_case_id: hash[:testCaseId],
63
+ worker_id: hash[:workerId],
64
+ timestamp: Timestamp.from_h(hash[:timestamp])
65
+ )
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestRunFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class TestRunFinished < Message
11
+ ##
12
+ # An informative message about the test run. Typically additional information about failure, but not necessarily.
13
+ ##
14
+ attr_reader :message
15
+
16
+ ##
17
+ # A test run is successful if all steps are either passed or skipped, all before/after hooks passed and no other exceptions where thrown.
18
+ ##
19
+ attr_reader :success
20
+
21
+ ##
22
+ # Timestamp when the TestRun is finished
23
+ ##
24
+ attr_reader :timestamp
25
+
26
+ ##
27
+ # Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps.
28
+ ##
29
+ attr_reader :exception
30
+
31
+ def initialize(
32
+ message: nil,
33
+ success: false,
34
+ timestamp: Timestamp.new,
35
+ exception: nil
36
+ )
37
+ @message = message
38
+ @success = success
39
+ @timestamp = timestamp
40
+ @exception = exception
41
+ super()
42
+ end
43
+
44
+ ##
45
+ # Returns a new TestRunFinished from the given hash.
46
+ # If the hash keys are camelCased, they are properly assigned to the
47
+ # corresponding snake_cased attributes.
48
+ #
49
+ # Cucumber::Messages::TestRunFinished.from_h(some_hash) # => #<Cucumber::Messages::TestRunFinished:0x... ...>
50
+ ##
51
+ def self.from_h(hash)
52
+ return nil if hash.nil?
53
+
54
+ new(
55
+ message: hash[:message],
56
+ success: hash[:success],
57
+ timestamp: Timestamp.from_h(hash[:timestamp]),
58
+ exception: Exception.from_h(hash[:exception])
59
+ )
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestRunStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class TestRunStarted < Message
11
+ attr_reader :timestamp
12
+
13
+ def initialize(
14
+ timestamp: Timestamp.new
15
+ )
16
+ @timestamp = timestamp
17
+ super()
18
+ end
19
+
20
+ ##
21
+ # Returns a new TestRunStarted from the given hash.
22
+ # If the hash keys are camelCased, they are properly assigned to the
23
+ # corresponding snake_cased attributes.
24
+ #
25
+ # Cucumber::Messages::TestRunStarted.from_h(some_hash) # => #<Cucumber::Messages::TestRunStarted:0x... ...>
26
+ ##
27
+ def self.from_h(hash)
28
+ return nil if hash.nil?
29
+
30
+ new(
31
+ timestamp: Timestamp.from_h(hash[:timestamp])
32
+ )
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # *
11
+ # A `TestStep` is derived from either a `PickleStep`
12
+ # combined with a `StepDefinition`, or from a `Hook`.
13
+ ##
14
+ class TestStep < Message
15
+ ##
16
+ # Pointer to the `Hook` (if derived from a Hook)
17
+ ##
18
+ attr_reader :hook_id
19
+
20
+ attr_reader :id
21
+
22
+ ##
23
+ # Pointer to the `PickleStep` (if derived from a `PickleStep`)
24
+ ##
25
+ attr_reader :pickle_step_id
26
+
27
+ ##
28
+ # Pointer to all the matching `StepDefinition`s (if derived from a `PickleStep`)
29
+ ##
30
+ attr_reader :step_definition_ids
31
+
32
+ ##
33
+ # A list of list of StepMatchArgument (if derived from a `PickleStep`).
34
+ # Each element represents a matching step definition. A size of 0 means `UNDEFINED`,
35
+ # and a size of 2+ means `AMBIGUOUS`
36
+ ##
37
+ attr_reader :step_match_arguments_lists
38
+
39
+ def initialize(
40
+ hook_id: nil,
41
+ id: '',
42
+ pickle_step_id: nil,
43
+ step_definition_ids: nil,
44
+ step_match_arguments_lists: nil
45
+ )
46
+ @hook_id = hook_id
47
+ @id = id
48
+ @pickle_step_id = pickle_step_id
49
+ @step_definition_ids = step_definition_ids
50
+ @step_match_arguments_lists = step_match_arguments_lists
51
+ super()
52
+ end
53
+
54
+ ##
55
+ # Returns a new TestStep from the given hash.
56
+ # If the hash keys are camelCased, they are properly assigned to the
57
+ # corresponding snake_cased attributes.
58
+ #
59
+ # Cucumber::Messages::TestStep.from_h(some_hash) # => #<Cucumber::Messages::TestStep:0x... ...>
60
+ ##
61
+ def self.from_h(hash)
62
+ return nil if hash.nil?
63
+
64
+ new(
65
+ hook_id: hash[:hookId],
66
+ id: hash[:id],
67
+ pickle_step_id: hash[:pickleStepId],
68
+ step_definition_ids: hash[:stepDefinitionIds],
69
+ step_match_arguments_lists: hash[:stepMatchArgumentsLists]&.map { |item| StepMatchArgumentsList.from_h(item) }
70
+ )
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestStepFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class TestStepFinished < Message
11
+ attr_reader :test_case_started_id
12
+
13
+ attr_reader :test_step_id
14
+
15
+ attr_reader :test_step_result
16
+
17
+ attr_reader :timestamp
18
+
19
+ def initialize(
20
+ test_case_started_id: '',
21
+ test_step_id: '',
22
+ test_step_result: TestStepResult.new,
23
+ timestamp: Timestamp.new
24
+ )
25
+ @test_case_started_id = test_case_started_id
26
+ @test_step_id = test_step_id
27
+ @test_step_result = test_step_result
28
+ @timestamp = timestamp
29
+ super()
30
+ end
31
+
32
+ ##
33
+ # Returns a new TestStepFinished from the given hash.
34
+ # If the hash keys are camelCased, they are properly assigned to the
35
+ # corresponding snake_cased attributes.
36
+ #
37
+ # Cucumber::Messages::TestStepFinished.from_h(some_hash) # => #<Cucumber::Messages::TestStepFinished:0x... ...>
38
+ ##
39
+ def self.from_h(hash)
40
+ return nil if hash.nil?
41
+
42
+ new(
43
+ test_case_started_id: hash[:testCaseStartedId],
44
+ test_step_id: hash[:testStepId],
45
+ test_step_result: TestStepResult.from_h(hash[:testStepResult]),
46
+ timestamp: Timestamp.from_h(hash[:timestamp])
47
+ )
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the TestStepResult message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class TestStepResult < Message
11
+ attr_reader :duration
12
+
13
+ ##
14
+ # An arbitrary bit of information that explains this result. This can be a stack trace of anything else.
15
+ ##
16
+ attr_reader :message
17
+
18
+ attr_reader :status
19
+
20
+ ##
21
+ # Exception thrown while executing this step, if any.
22
+ ##
23
+ attr_reader :exception
24
+
25
+ def initialize(
26
+ duration: Duration.new,
27
+ message: nil,
28
+ status: TestStepResultStatus::UNKNOWN,
29
+ exception: nil
30
+ )
31
+ @duration = duration
32
+ @message = message
33
+ @status = status
34
+ @exception = exception
35
+ super()
36
+ end
37
+
38
+ ##
39
+ # Returns a new TestStepResult from the given hash.
40
+ # If the hash keys are camelCased, they are properly assigned to the
41
+ # corresponding snake_cased attributes.
42
+ #
43
+ # Cucumber::Messages::TestStepResult.from_h(some_hash) # => #<Cucumber::Messages::TestStepResult:0x... ...>
44
+ ##
45
+ def self.from_h(hash)
46
+ return nil if hash.nil?
47
+
48
+ new(
49
+ duration: Duration.from_h(hash[:duration]),
50
+ message: hash[:message],
51
+ status: hash[:status],
52
+ exception: Exception.from_h(hash[:exception])
53
+ )
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ class TestStepResultStatus
7
+ UNKNOWN = 'UNKNOWN'
8
+ PASSED = 'PASSED'
9
+ SKIPPED = 'SKIPPED'
10
+ PENDING = 'PENDING'
11
+ UNDEFINED = 'UNDEFINED'
12
+ AMBIGUOUS = 'AMBIGUOUS'
13
+ FAILED = 'FAILED'
14
+ end
15
+ end
16
+ end