cucumber-messages 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +3 -0
- data/VERSION +1 -0
- data/lib/cucumber/messages/id_generator.rb +24 -0
- data/lib/cucumber/messages/message/deserialization.rb +37 -0
- data/lib/cucumber/messages/message/serialization.rb +70 -0
- data/lib/cucumber/messages/message/utils.rb +45 -0
- data/lib/cucumber/messages/message.rb +11 -0
- data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +21 -0
- data/lib/cucumber/messages/time_conversion.rb +33 -0
- data/lib/cucumber/messages.deserializers.rb +1208 -0
- data/lib/cucumber/messages.dtos.rb +1782 -0
- data/lib/cucumber/messages.rb +10 -0
- metadata +136 -0
@@ -0,0 +1,1782 @@
|
|
1
|
+
require 'cucumber/messages/message'
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
#
|
5
|
+
|
6
|
+
module Cucumber
|
7
|
+
module Messages
|
8
|
+
|
9
|
+
##
|
10
|
+
# Represents the Attachment message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
11
|
+
#
|
12
|
+
# //// Attachments (parse errors, execution errors, screenshots, links...)
|
13
|
+
#
|
14
|
+
# *
|
15
|
+
# An attachment represents any kind of data associated with a line in a
|
16
|
+
# [Source](#io.cucumber.messages.Source) file. It can be used for:
|
17
|
+
#
|
18
|
+
# * Syntax errors during parse time
|
19
|
+
# * Screenshots captured and attached during execution
|
20
|
+
# * Logs captured and attached during execution
|
21
|
+
#
|
22
|
+
# It is not to be used for runtime errors raised/thrown during execution. This
|
23
|
+
# is captured in `TestResult`.
|
24
|
+
##
|
25
|
+
class Attachment < ::Cucumber::Messages::Message
|
26
|
+
##
|
27
|
+
# *
|
28
|
+
# The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment
|
29
|
+
# is simply the string. If it's `BASE64`, the string should be Base64 decoded to
|
30
|
+
# obtain the attachment.
|
31
|
+
##
|
32
|
+
attr_reader :body
|
33
|
+
|
34
|
+
##
|
35
|
+
# *
|
36
|
+
# Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64).
|
37
|
+
#
|
38
|
+
# Content encoding is *not* determined by the media type, but rather by the type
|
39
|
+
# of the object being attached:
|
40
|
+
#
|
41
|
+
# - string: IDENTITY
|
42
|
+
# - byte array: BASE64
|
43
|
+
# - stream: BASE64
|
44
|
+
##
|
45
|
+
attr_reader :content_encoding
|
46
|
+
|
47
|
+
##
|
48
|
+
# *
|
49
|
+
# Suggested file name of the attachment. (Provided by the user as an argument to `attach`)
|
50
|
+
##
|
51
|
+
attr_reader :file_name
|
52
|
+
|
53
|
+
##
|
54
|
+
# *
|
55
|
+
# The media type of the data. This can be any valid
|
56
|
+
# [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)
|
57
|
+
# as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain`
|
58
|
+
# and `text/x.cucumber.stacktrace+plain`
|
59
|
+
##
|
60
|
+
attr_reader :media_type
|
61
|
+
|
62
|
+
attr_reader :source
|
63
|
+
|
64
|
+
attr_reader :test_case_started_id
|
65
|
+
|
66
|
+
attr_reader :test_step_id
|
67
|
+
|
68
|
+
##
|
69
|
+
# *
|
70
|
+
# A URL where the attachment can be retrieved. This field should not be set by Cucumber.
|
71
|
+
# It should be set by a program that reads a message stream and does the following for
|
72
|
+
# each Attachment message:
|
73
|
+
#
|
74
|
+
# - Writes the body (after base64 decoding if necessary) to a new file.
|
75
|
+
# - Sets `body` and `contentEncoding` to `null`
|
76
|
+
# - Writes out the new attachment message
|
77
|
+
#
|
78
|
+
# This will result in a smaller message stream, which can improve performance and
|
79
|
+
# reduce bandwidth of message consumers. It also makes it easier to process and download attachments
|
80
|
+
# separately from reports.
|
81
|
+
##
|
82
|
+
attr_reader :url
|
83
|
+
|
84
|
+
def initialize(
|
85
|
+
body: '',
|
86
|
+
content_encoding: AttachmentContentEncoding::IDENTITY,
|
87
|
+
file_name: nil,
|
88
|
+
media_type: '',
|
89
|
+
source: nil,
|
90
|
+
test_case_started_id: nil,
|
91
|
+
test_step_id: nil,
|
92
|
+
url: nil
|
93
|
+
)
|
94
|
+
@body = body
|
95
|
+
@content_encoding = content_encoding
|
96
|
+
@file_name = file_name
|
97
|
+
@media_type = media_type
|
98
|
+
@source = source
|
99
|
+
@test_case_started_id = test_case_started_id
|
100
|
+
@test_step_id = test_step_id
|
101
|
+
@url = url
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# Represents the Duration message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
107
|
+
#
|
108
|
+
# The structure is pretty close of the Timestamp one. For clarity, a second type
|
109
|
+
# of message is used.
|
110
|
+
##
|
111
|
+
class Duration < ::Cucumber::Messages::Message
|
112
|
+
attr_reader :seconds
|
113
|
+
|
114
|
+
##
|
115
|
+
# Non-negative fractions of a second at nanosecond resolution. Negative
|
116
|
+
# second values with fractions must still have non-negative nanos values
|
117
|
+
# that count forward in time. Must be from 0 to 999,999,999
|
118
|
+
# inclusive.
|
119
|
+
##
|
120
|
+
attr_reader :nanos
|
121
|
+
|
122
|
+
def initialize(
|
123
|
+
seconds: 0,
|
124
|
+
nanos: 0
|
125
|
+
)
|
126
|
+
@seconds = seconds
|
127
|
+
@nanos = nanos
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Represents the Envelope message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
133
|
+
#
|
134
|
+
# When removing a field, replace it with reserved, rather than deleting the line.
|
135
|
+
# When adding a field, add it to the end and increment the number by one.
|
136
|
+
# See https://developers.google.com/protocol-buffers/docs/proto#updating for details
|
137
|
+
#
|
138
|
+
# *
|
139
|
+
# All the messages that are passed between different components/processes are Envelope
|
140
|
+
# messages.
|
141
|
+
##
|
142
|
+
class Envelope < ::Cucumber::Messages::Message
|
143
|
+
attr_reader :attachment
|
144
|
+
|
145
|
+
attr_reader :gherkin_document
|
146
|
+
|
147
|
+
attr_reader :hook
|
148
|
+
|
149
|
+
attr_reader :meta
|
150
|
+
|
151
|
+
attr_reader :parameter_type
|
152
|
+
|
153
|
+
attr_reader :parse_error
|
154
|
+
|
155
|
+
attr_reader :pickle
|
156
|
+
|
157
|
+
attr_reader :source
|
158
|
+
|
159
|
+
attr_reader :step_definition
|
160
|
+
|
161
|
+
attr_reader :test_case
|
162
|
+
|
163
|
+
attr_reader :test_case_finished
|
164
|
+
|
165
|
+
attr_reader :test_case_started
|
166
|
+
|
167
|
+
attr_reader :test_run_finished
|
168
|
+
|
169
|
+
attr_reader :test_run_started
|
170
|
+
|
171
|
+
attr_reader :test_step_finished
|
172
|
+
|
173
|
+
attr_reader :test_step_started
|
174
|
+
|
175
|
+
attr_reader :undefined_parameter_type
|
176
|
+
|
177
|
+
def initialize(
|
178
|
+
attachment: nil,
|
179
|
+
gherkin_document: nil,
|
180
|
+
hook: nil,
|
181
|
+
meta: nil,
|
182
|
+
parameter_type: nil,
|
183
|
+
parse_error: nil,
|
184
|
+
pickle: nil,
|
185
|
+
source: nil,
|
186
|
+
step_definition: nil,
|
187
|
+
test_case: nil,
|
188
|
+
test_case_finished: nil,
|
189
|
+
test_case_started: nil,
|
190
|
+
test_run_finished: nil,
|
191
|
+
test_run_started: nil,
|
192
|
+
test_step_finished: nil,
|
193
|
+
test_step_started: nil,
|
194
|
+
undefined_parameter_type: nil
|
195
|
+
)
|
196
|
+
@attachment = attachment
|
197
|
+
@gherkin_document = gherkin_document
|
198
|
+
@hook = hook
|
199
|
+
@meta = meta
|
200
|
+
@parameter_type = parameter_type
|
201
|
+
@parse_error = parse_error
|
202
|
+
@pickle = pickle
|
203
|
+
@source = source
|
204
|
+
@step_definition = step_definition
|
205
|
+
@test_case = test_case
|
206
|
+
@test_case_finished = test_case_finished
|
207
|
+
@test_case_started = test_case_started
|
208
|
+
@test_run_finished = test_run_finished
|
209
|
+
@test_run_started = test_run_started
|
210
|
+
@test_step_finished = test_step_finished
|
211
|
+
@test_step_started = test_step_started
|
212
|
+
@undefined_parameter_type = undefined_parameter_type
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Represents the Exception message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
218
|
+
#
|
219
|
+
# A simplified representation of an exception
|
220
|
+
##
|
221
|
+
class Exception < ::Cucumber::Messages::Message
|
222
|
+
##
|
223
|
+
# The type of the exception that caused this result. E.g. "Error" or "org.opentest4j.AssertionFailedError"
|
224
|
+
##
|
225
|
+
attr_reader :type
|
226
|
+
|
227
|
+
##
|
228
|
+
# The message of exception that caused this result. E.g. expected: "a" but was: "b"
|
229
|
+
##
|
230
|
+
attr_reader :message
|
231
|
+
|
232
|
+
##
|
233
|
+
# The stringified stack trace of the exception that caused this result
|
234
|
+
##
|
235
|
+
attr_reader :stack_trace
|
236
|
+
|
237
|
+
def initialize(
|
238
|
+
type: '',
|
239
|
+
message: nil,
|
240
|
+
stack_trace: nil
|
241
|
+
)
|
242
|
+
@type = type
|
243
|
+
@message = message
|
244
|
+
@stack_trace = stack_trace
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# Represents the GherkinDocument message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
250
|
+
#
|
251
|
+
# *
|
252
|
+
# The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document.
|
253
|
+
# Cucumber implementations should *not* depend on `GherkinDocument` or any of its
|
254
|
+
# children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead.
|
255
|
+
#
|
256
|
+
# The only consumers of `GherkinDocument` should only be formatters that produce
|
257
|
+
# "rich" output, resembling the original Gherkin document.
|
258
|
+
##
|
259
|
+
class GherkinDocument < ::Cucumber::Messages::Message
|
260
|
+
##
|
261
|
+
# *
|
262
|
+
# The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)
|
263
|
+
# of the source, typically a file path relative to the root directory
|
264
|
+
##
|
265
|
+
attr_reader :uri
|
266
|
+
|
267
|
+
attr_reader :feature
|
268
|
+
|
269
|
+
##
|
270
|
+
# All the comments in the Gherkin document
|
271
|
+
##
|
272
|
+
attr_reader :comments
|
273
|
+
|
274
|
+
def initialize(
|
275
|
+
uri: nil,
|
276
|
+
feature: nil,
|
277
|
+
comments: []
|
278
|
+
)
|
279
|
+
@uri = uri
|
280
|
+
@feature = feature
|
281
|
+
@comments = comments
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
##
|
286
|
+
# Represents the Background message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
287
|
+
##
|
288
|
+
class Background < ::Cucumber::Messages::Message
|
289
|
+
##
|
290
|
+
# The location of the `Background` keyword
|
291
|
+
##
|
292
|
+
attr_reader :location
|
293
|
+
|
294
|
+
attr_reader :keyword
|
295
|
+
|
296
|
+
attr_reader :name
|
297
|
+
|
298
|
+
attr_reader :description
|
299
|
+
|
300
|
+
attr_reader :steps
|
301
|
+
|
302
|
+
attr_reader :id
|
303
|
+
|
304
|
+
def initialize(
|
305
|
+
location: Location.new,
|
306
|
+
keyword: '',
|
307
|
+
name: '',
|
308
|
+
description: '',
|
309
|
+
steps: [],
|
310
|
+
id: ''
|
311
|
+
)
|
312
|
+
@location = location
|
313
|
+
@keyword = keyword
|
314
|
+
@name = name
|
315
|
+
@description = description
|
316
|
+
@steps = steps
|
317
|
+
@id = id
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
##
|
322
|
+
# Represents the Comment message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
323
|
+
#
|
324
|
+
# *
|
325
|
+
# A comment in a Gherkin document
|
326
|
+
##
|
327
|
+
class Comment < ::Cucumber::Messages::Message
|
328
|
+
##
|
329
|
+
# The location of the comment
|
330
|
+
##
|
331
|
+
attr_reader :location
|
332
|
+
|
333
|
+
##
|
334
|
+
# The text of the comment
|
335
|
+
##
|
336
|
+
attr_reader :text
|
337
|
+
|
338
|
+
def initialize(
|
339
|
+
location: Location.new,
|
340
|
+
text: ''
|
341
|
+
)
|
342
|
+
@location = location
|
343
|
+
@text = text
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
##
|
348
|
+
# Represents the DataTable message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
349
|
+
##
|
350
|
+
class DataTable < ::Cucumber::Messages::Message
|
351
|
+
attr_reader :location
|
352
|
+
|
353
|
+
attr_reader :rows
|
354
|
+
|
355
|
+
def initialize(
|
356
|
+
location: Location.new,
|
357
|
+
rows: []
|
358
|
+
)
|
359
|
+
@location = location
|
360
|
+
@rows = rows
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
##
|
365
|
+
# Represents the DocString message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
366
|
+
##
|
367
|
+
class DocString < ::Cucumber::Messages::Message
|
368
|
+
attr_reader :location
|
369
|
+
|
370
|
+
attr_reader :media_type
|
371
|
+
|
372
|
+
attr_reader :content
|
373
|
+
|
374
|
+
attr_reader :delimiter
|
375
|
+
|
376
|
+
def initialize(
|
377
|
+
location: Location.new,
|
378
|
+
media_type: nil,
|
379
|
+
content: '',
|
380
|
+
delimiter: ''
|
381
|
+
)
|
382
|
+
@location = location
|
383
|
+
@media_type = media_type
|
384
|
+
@content = content
|
385
|
+
@delimiter = delimiter
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
##
|
390
|
+
# Represents the Examples message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
391
|
+
##
|
392
|
+
class Examples < ::Cucumber::Messages::Message
|
393
|
+
##
|
394
|
+
# The location of the `Examples` keyword
|
395
|
+
##
|
396
|
+
attr_reader :location
|
397
|
+
|
398
|
+
attr_reader :tags
|
399
|
+
|
400
|
+
attr_reader :keyword
|
401
|
+
|
402
|
+
attr_reader :name
|
403
|
+
|
404
|
+
attr_reader :description
|
405
|
+
|
406
|
+
attr_reader :table_header
|
407
|
+
|
408
|
+
attr_reader :table_body
|
409
|
+
|
410
|
+
attr_reader :id
|
411
|
+
|
412
|
+
def initialize(
|
413
|
+
location: Location.new,
|
414
|
+
tags: [],
|
415
|
+
keyword: '',
|
416
|
+
name: '',
|
417
|
+
description: '',
|
418
|
+
table_header: nil,
|
419
|
+
table_body: [],
|
420
|
+
id: ''
|
421
|
+
)
|
422
|
+
@location = location
|
423
|
+
@tags = tags
|
424
|
+
@keyword = keyword
|
425
|
+
@name = name
|
426
|
+
@description = description
|
427
|
+
@table_header = table_header
|
428
|
+
@table_body = table_body
|
429
|
+
@id = id
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
##
|
434
|
+
# Represents the Feature message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
435
|
+
##
|
436
|
+
class Feature < ::Cucumber::Messages::Message
|
437
|
+
##
|
438
|
+
# The location of the `Feature` keyword
|
439
|
+
##
|
440
|
+
attr_reader :location
|
441
|
+
|
442
|
+
##
|
443
|
+
# All the tags placed above the `Feature` keyword
|
444
|
+
##
|
445
|
+
attr_reader :tags
|
446
|
+
|
447
|
+
##
|
448
|
+
# The [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code of the Gherkin document
|
449
|
+
##
|
450
|
+
attr_reader :language
|
451
|
+
|
452
|
+
##
|
453
|
+
# The text of the `Feature` keyword (in the language specified by `language`)
|
454
|
+
##
|
455
|
+
attr_reader :keyword
|
456
|
+
|
457
|
+
##
|
458
|
+
# The name of the feature (the text following the `keyword`)
|
459
|
+
##
|
460
|
+
attr_reader :name
|
461
|
+
|
462
|
+
##
|
463
|
+
# The line(s) underneath the line with the `keyword` that are used as description
|
464
|
+
##
|
465
|
+
attr_reader :description
|
466
|
+
|
467
|
+
##
|
468
|
+
# Zero or more children
|
469
|
+
##
|
470
|
+
attr_reader :children
|
471
|
+
|
472
|
+
def initialize(
|
473
|
+
location: Location.new,
|
474
|
+
tags: [],
|
475
|
+
language: '',
|
476
|
+
keyword: '',
|
477
|
+
name: '',
|
478
|
+
description: '',
|
479
|
+
children: []
|
480
|
+
)
|
481
|
+
@location = location
|
482
|
+
@tags = tags
|
483
|
+
@language = language
|
484
|
+
@keyword = keyword
|
485
|
+
@name = name
|
486
|
+
@description = description
|
487
|
+
@children = children
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
##
|
492
|
+
# Represents the FeatureChild message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
493
|
+
#
|
494
|
+
# *
|
495
|
+
# A child node of a `Feature` node
|
496
|
+
##
|
497
|
+
class FeatureChild < ::Cucumber::Messages::Message
|
498
|
+
attr_reader :rule
|
499
|
+
|
500
|
+
attr_reader :background
|
501
|
+
|
502
|
+
attr_reader :scenario
|
503
|
+
|
504
|
+
def initialize(
|
505
|
+
rule: nil,
|
506
|
+
background: nil,
|
507
|
+
scenario: nil
|
508
|
+
)
|
509
|
+
@rule = rule
|
510
|
+
@background = background
|
511
|
+
@scenario = scenario
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
##
|
516
|
+
# Represents the Rule message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
517
|
+
##
|
518
|
+
class Rule < ::Cucumber::Messages::Message
|
519
|
+
##
|
520
|
+
# The location of the `Rule` keyword
|
521
|
+
##
|
522
|
+
attr_reader :location
|
523
|
+
|
524
|
+
##
|
525
|
+
# All the tags placed above the `Rule` keyword
|
526
|
+
##
|
527
|
+
attr_reader :tags
|
528
|
+
|
529
|
+
attr_reader :keyword
|
530
|
+
|
531
|
+
attr_reader :name
|
532
|
+
|
533
|
+
attr_reader :description
|
534
|
+
|
535
|
+
attr_reader :children
|
536
|
+
|
537
|
+
attr_reader :id
|
538
|
+
|
539
|
+
def initialize(
|
540
|
+
location: Location.new,
|
541
|
+
tags: [],
|
542
|
+
keyword: '',
|
543
|
+
name: '',
|
544
|
+
description: '',
|
545
|
+
children: [],
|
546
|
+
id: ''
|
547
|
+
)
|
548
|
+
@location = location
|
549
|
+
@tags = tags
|
550
|
+
@keyword = keyword
|
551
|
+
@name = name
|
552
|
+
@description = description
|
553
|
+
@children = children
|
554
|
+
@id = id
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
##
|
559
|
+
# Represents the RuleChild message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
560
|
+
#
|
561
|
+
# *
|
562
|
+
# A child node of a `Rule` node
|
563
|
+
##
|
564
|
+
class RuleChild < ::Cucumber::Messages::Message
|
565
|
+
attr_reader :background
|
566
|
+
|
567
|
+
attr_reader :scenario
|
568
|
+
|
569
|
+
def initialize(
|
570
|
+
background: nil,
|
571
|
+
scenario: nil
|
572
|
+
)
|
573
|
+
@background = background
|
574
|
+
@scenario = scenario
|
575
|
+
end
|
576
|
+
end
|
577
|
+
|
578
|
+
##
|
579
|
+
# Represents the Scenario message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
580
|
+
##
|
581
|
+
class Scenario < ::Cucumber::Messages::Message
|
582
|
+
##
|
583
|
+
# The location of the `Scenario` keyword
|
584
|
+
##
|
585
|
+
attr_reader :location
|
586
|
+
|
587
|
+
attr_reader :tags
|
588
|
+
|
589
|
+
attr_reader :keyword
|
590
|
+
|
591
|
+
attr_reader :name
|
592
|
+
|
593
|
+
attr_reader :description
|
594
|
+
|
595
|
+
attr_reader :steps
|
596
|
+
|
597
|
+
attr_reader :examples
|
598
|
+
|
599
|
+
attr_reader :id
|
600
|
+
|
601
|
+
def initialize(
|
602
|
+
location: Location.new,
|
603
|
+
tags: [],
|
604
|
+
keyword: '',
|
605
|
+
name: '',
|
606
|
+
description: '',
|
607
|
+
steps: [],
|
608
|
+
examples: [],
|
609
|
+
id: ''
|
610
|
+
)
|
611
|
+
@location = location
|
612
|
+
@tags = tags
|
613
|
+
@keyword = keyword
|
614
|
+
@name = name
|
615
|
+
@description = description
|
616
|
+
@steps = steps
|
617
|
+
@examples = examples
|
618
|
+
@id = id
|
619
|
+
end
|
620
|
+
end
|
621
|
+
|
622
|
+
##
|
623
|
+
# Represents the Step message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
624
|
+
#
|
625
|
+
# A step
|
626
|
+
##
|
627
|
+
class Step < ::Cucumber::Messages::Message
|
628
|
+
##
|
629
|
+
# The location of the steps' `keyword`
|
630
|
+
##
|
631
|
+
attr_reader :location
|
632
|
+
|
633
|
+
##
|
634
|
+
# The actual keyword as it appeared in the source.
|
635
|
+
##
|
636
|
+
attr_reader :keyword
|
637
|
+
|
638
|
+
##
|
639
|
+
# The test phase signalled by the keyword: Context definition (Given), Action performance (When), Outcome assertion (Then). Other keywords signal Continuation (And and But) from a prior keyword. Please note that all translations which a dialect maps to multiple keywords (`*` is in this category for all dialects), map to 'Unknown'.
|
640
|
+
##
|
641
|
+
attr_reader :keyword_type
|
642
|
+
|
643
|
+
attr_reader :text
|
644
|
+
|
645
|
+
attr_reader :doc_string
|
646
|
+
|
647
|
+
attr_reader :data_table
|
648
|
+
|
649
|
+
##
|
650
|
+
# Unique ID to be able to reference the Step from PickleStep
|
651
|
+
##
|
652
|
+
attr_reader :id
|
653
|
+
|
654
|
+
def initialize(
|
655
|
+
location: Location.new,
|
656
|
+
keyword: '',
|
657
|
+
keyword_type: nil,
|
658
|
+
text: '',
|
659
|
+
doc_string: nil,
|
660
|
+
data_table: nil,
|
661
|
+
id: ''
|
662
|
+
)
|
663
|
+
@location = location
|
664
|
+
@keyword = keyword
|
665
|
+
@keyword_type = keyword_type
|
666
|
+
@text = text
|
667
|
+
@doc_string = doc_string
|
668
|
+
@data_table = data_table
|
669
|
+
@id = id
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
##
|
674
|
+
# Represents the TableCell message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
675
|
+
#
|
676
|
+
# A cell in a `TableRow`
|
677
|
+
##
|
678
|
+
class TableCell < ::Cucumber::Messages::Message
|
679
|
+
##
|
680
|
+
# The location of the cell
|
681
|
+
##
|
682
|
+
attr_reader :location
|
683
|
+
|
684
|
+
##
|
685
|
+
# The value of the cell
|
686
|
+
##
|
687
|
+
attr_reader :value
|
688
|
+
|
689
|
+
def initialize(
|
690
|
+
location: Location.new,
|
691
|
+
value: ''
|
692
|
+
)
|
693
|
+
@location = location
|
694
|
+
@value = value
|
695
|
+
end
|
696
|
+
end
|
697
|
+
|
698
|
+
##
|
699
|
+
# Represents the TableRow message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
700
|
+
#
|
701
|
+
# A row in a table
|
702
|
+
##
|
703
|
+
class TableRow < ::Cucumber::Messages::Message
|
704
|
+
##
|
705
|
+
# The location of the first cell in the row
|
706
|
+
##
|
707
|
+
attr_reader :location
|
708
|
+
|
709
|
+
##
|
710
|
+
# Cells in the row
|
711
|
+
##
|
712
|
+
attr_reader :cells
|
713
|
+
|
714
|
+
attr_reader :id
|
715
|
+
|
716
|
+
def initialize(
|
717
|
+
location: Location.new,
|
718
|
+
cells: [],
|
719
|
+
id: ''
|
720
|
+
)
|
721
|
+
@location = location
|
722
|
+
@cells = cells
|
723
|
+
@id = id
|
724
|
+
end
|
725
|
+
end
|
726
|
+
|
727
|
+
##
|
728
|
+
# Represents the Tag message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
729
|
+
#
|
730
|
+
# *
|
731
|
+
# A tag
|
732
|
+
##
|
733
|
+
class Tag < ::Cucumber::Messages::Message
|
734
|
+
##
|
735
|
+
# Location of the tag
|
736
|
+
##
|
737
|
+
attr_reader :location
|
738
|
+
|
739
|
+
##
|
740
|
+
# The name of the tag (including the leading `@`)
|
741
|
+
##
|
742
|
+
attr_reader :name
|
743
|
+
|
744
|
+
##
|
745
|
+
# Unique ID to be able to reference the Tag from PickleTag
|
746
|
+
##
|
747
|
+
attr_reader :id
|
748
|
+
|
749
|
+
def initialize(
|
750
|
+
location: Location.new,
|
751
|
+
name: '',
|
752
|
+
id: ''
|
753
|
+
)
|
754
|
+
@location = location
|
755
|
+
@name = name
|
756
|
+
@id = id
|
757
|
+
end
|
758
|
+
end
|
759
|
+
|
760
|
+
##
|
761
|
+
# Represents the Hook message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
762
|
+
##
|
763
|
+
class Hook < ::Cucumber::Messages::Message
|
764
|
+
attr_reader :id
|
765
|
+
|
766
|
+
attr_reader :name
|
767
|
+
|
768
|
+
attr_reader :source_reference
|
769
|
+
|
770
|
+
attr_reader :tag_expression
|
771
|
+
|
772
|
+
def initialize(
|
773
|
+
id: '',
|
774
|
+
name: nil,
|
775
|
+
source_reference: SourceReference.new,
|
776
|
+
tag_expression: nil
|
777
|
+
)
|
778
|
+
@id = id
|
779
|
+
@name = name
|
780
|
+
@source_reference = source_reference
|
781
|
+
@tag_expression = tag_expression
|
782
|
+
end
|
783
|
+
end
|
784
|
+
|
785
|
+
##
|
786
|
+
# Represents the Location message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
787
|
+
#
|
788
|
+
# *
|
789
|
+
# Points to a line and a column in a text file
|
790
|
+
##
|
791
|
+
class Location < ::Cucumber::Messages::Message
|
792
|
+
attr_reader :line
|
793
|
+
|
794
|
+
attr_reader :column
|
795
|
+
|
796
|
+
def initialize(
|
797
|
+
line: 0,
|
798
|
+
column: nil
|
799
|
+
)
|
800
|
+
@line = line
|
801
|
+
@column = column
|
802
|
+
end
|
803
|
+
end
|
804
|
+
|
805
|
+
##
|
806
|
+
# Represents the Meta message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
807
|
+
#
|
808
|
+
# *
|
809
|
+
# This message contains meta information about the environment. Consumers can use
|
810
|
+
# this for various purposes.
|
811
|
+
##
|
812
|
+
class Meta < ::Cucumber::Messages::Message
|
813
|
+
##
|
814
|
+
# *
|
815
|
+
# The [SEMVER](https://semver.org/) version number of the protocol
|
816
|
+
##
|
817
|
+
attr_reader :protocol_version
|
818
|
+
|
819
|
+
##
|
820
|
+
# SpecFlow, Cucumber-JVM, Cucumber.js, Cucumber-Ruby, Behat etc.
|
821
|
+
##
|
822
|
+
attr_reader :implementation
|
823
|
+
|
824
|
+
##
|
825
|
+
# Java, Ruby, Node.js etc
|
826
|
+
##
|
827
|
+
attr_reader :runtime
|
828
|
+
|
829
|
+
##
|
830
|
+
# Windows, Linux, MacOS etc
|
831
|
+
##
|
832
|
+
attr_reader :os
|
833
|
+
|
834
|
+
##
|
835
|
+
# 386, arm, amd64 etc
|
836
|
+
##
|
837
|
+
attr_reader :cpu
|
838
|
+
|
839
|
+
attr_reader :ci
|
840
|
+
|
841
|
+
def initialize(
|
842
|
+
protocol_version: '',
|
843
|
+
implementation: Product.new,
|
844
|
+
runtime: Product.new,
|
845
|
+
os: Product.new,
|
846
|
+
cpu: Product.new,
|
847
|
+
ci: nil
|
848
|
+
)
|
849
|
+
@protocol_version = protocol_version
|
850
|
+
@implementation = implementation
|
851
|
+
@runtime = runtime
|
852
|
+
@os = os
|
853
|
+
@cpu = cpu
|
854
|
+
@ci = ci
|
855
|
+
end
|
856
|
+
end
|
857
|
+
|
858
|
+
##
|
859
|
+
# Represents the Ci message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
860
|
+
#
|
861
|
+
# CI environment
|
862
|
+
##
|
863
|
+
class Ci < ::Cucumber::Messages::Message
|
864
|
+
##
|
865
|
+
# Name of the CI product, e.g. "Jenkins", "CircleCI" etc.
|
866
|
+
##
|
867
|
+
attr_reader :name
|
868
|
+
|
869
|
+
##
|
870
|
+
# Link to the build
|
871
|
+
##
|
872
|
+
attr_reader :url
|
873
|
+
|
874
|
+
##
|
875
|
+
# The build number. Some CI servers use non-numeric build numbers, which is why this is a string
|
876
|
+
##
|
877
|
+
attr_reader :build_number
|
878
|
+
|
879
|
+
attr_reader :git
|
880
|
+
|
881
|
+
def initialize(
|
882
|
+
name: '',
|
883
|
+
url: nil,
|
884
|
+
build_number: nil,
|
885
|
+
git: nil
|
886
|
+
)
|
887
|
+
@name = name
|
888
|
+
@url = url
|
889
|
+
@build_number = build_number
|
890
|
+
@git = git
|
891
|
+
end
|
892
|
+
end
|
893
|
+
|
894
|
+
##
|
895
|
+
# Represents the Git message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
896
|
+
#
|
897
|
+
# Information about Git, provided by the Build/CI server as environment
|
898
|
+
# variables.
|
899
|
+
##
|
900
|
+
class Git < ::Cucumber::Messages::Message
|
901
|
+
attr_reader :remote
|
902
|
+
|
903
|
+
attr_reader :revision
|
904
|
+
|
905
|
+
attr_reader :branch
|
906
|
+
|
907
|
+
attr_reader :tag
|
908
|
+
|
909
|
+
def initialize(
|
910
|
+
remote: '',
|
911
|
+
revision: '',
|
912
|
+
branch: nil,
|
913
|
+
tag: nil
|
914
|
+
)
|
915
|
+
@remote = remote
|
916
|
+
@revision = revision
|
917
|
+
@branch = branch
|
918
|
+
@tag = tag
|
919
|
+
end
|
920
|
+
end
|
921
|
+
|
922
|
+
##
|
923
|
+
# Represents the Product message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
924
|
+
#
|
925
|
+
# Used to describe various properties of Meta
|
926
|
+
##
|
927
|
+
class Product < ::Cucumber::Messages::Message
|
928
|
+
##
|
929
|
+
# The product name
|
930
|
+
##
|
931
|
+
attr_reader :name
|
932
|
+
|
933
|
+
##
|
934
|
+
# The product version
|
935
|
+
##
|
936
|
+
attr_reader :version
|
937
|
+
|
938
|
+
def initialize(
|
939
|
+
name: '',
|
940
|
+
version: nil
|
941
|
+
)
|
942
|
+
@name = name
|
943
|
+
@version = version
|
944
|
+
end
|
945
|
+
end
|
946
|
+
|
947
|
+
##
|
948
|
+
# Represents the ParameterType message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
949
|
+
##
|
950
|
+
class ParameterType < ::Cucumber::Messages::Message
|
951
|
+
##
|
952
|
+
# The name is unique, so we don't need an id.
|
953
|
+
##
|
954
|
+
attr_reader :name
|
955
|
+
|
956
|
+
attr_reader :regular_expressions
|
957
|
+
|
958
|
+
attr_reader :prefer_for_regular_expression_match
|
959
|
+
|
960
|
+
attr_reader :use_for_snippets
|
961
|
+
|
962
|
+
attr_reader :id
|
963
|
+
|
964
|
+
attr_reader :source_reference
|
965
|
+
|
966
|
+
def initialize(
|
967
|
+
name: '',
|
968
|
+
regular_expressions: [],
|
969
|
+
prefer_for_regular_expression_match: false,
|
970
|
+
use_for_snippets: false,
|
971
|
+
id: '',
|
972
|
+
source_reference: nil
|
973
|
+
)
|
974
|
+
@name = name
|
975
|
+
@regular_expressions = regular_expressions
|
976
|
+
@prefer_for_regular_expression_match = prefer_for_regular_expression_match
|
977
|
+
@use_for_snippets = use_for_snippets
|
978
|
+
@id = id
|
979
|
+
@source_reference = source_reference
|
980
|
+
end
|
981
|
+
end
|
982
|
+
|
983
|
+
##
|
984
|
+
# Represents the ParseError message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
985
|
+
##
|
986
|
+
class ParseError < ::Cucumber::Messages::Message
|
987
|
+
attr_reader :source
|
988
|
+
|
989
|
+
attr_reader :message
|
990
|
+
|
991
|
+
def initialize(
|
992
|
+
source: SourceReference.new,
|
993
|
+
message: ''
|
994
|
+
)
|
995
|
+
@source = source
|
996
|
+
@message = message
|
997
|
+
end
|
998
|
+
end
|
999
|
+
|
1000
|
+
##
|
1001
|
+
# Represents the Pickle message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1002
|
+
#
|
1003
|
+
# //// Pickles
|
1004
|
+
#
|
1005
|
+
# *
|
1006
|
+
# A `Pickle` represents a template for a `TestCase`. It is typically derived
|
1007
|
+
# from another format, such as [GherkinDocument](#io.cucumber.messages.GherkinDocument).
|
1008
|
+
# In the future a `Pickle` may be derived from other formats such as Markdown or
|
1009
|
+
# Excel files.
|
1010
|
+
#
|
1011
|
+
# By making `Pickle` the main data structure Cucumber uses for execution, the
|
1012
|
+
# implementation of Cucumber itself becomes simpler, as it doesn't have to deal
|
1013
|
+
# with the complex structure of a [GherkinDocument](#io.cucumber.messages.GherkinDocument).
|
1014
|
+
#
|
1015
|
+
# Each `PickleStep` of a `Pickle` is matched with a `StepDefinition` to create a `TestCase`
|
1016
|
+
##
|
1017
|
+
class Pickle < ::Cucumber::Messages::Message
|
1018
|
+
##
|
1019
|
+
# *
|
1020
|
+
# A unique id for the pickle
|
1021
|
+
##
|
1022
|
+
attr_reader :id
|
1023
|
+
|
1024
|
+
##
|
1025
|
+
# The uri of the source file
|
1026
|
+
##
|
1027
|
+
attr_reader :uri
|
1028
|
+
|
1029
|
+
##
|
1030
|
+
# The name of the pickle
|
1031
|
+
##
|
1032
|
+
attr_reader :name
|
1033
|
+
|
1034
|
+
##
|
1035
|
+
# The language of the pickle
|
1036
|
+
##
|
1037
|
+
attr_reader :language
|
1038
|
+
|
1039
|
+
##
|
1040
|
+
# One or more steps
|
1041
|
+
##
|
1042
|
+
attr_reader :steps
|
1043
|
+
|
1044
|
+
##
|
1045
|
+
# *
|
1046
|
+
# One or more tags. If this pickle is constructed from a Gherkin document,
|
1047
|
+
# It includes inherited tags from the `Feature` as well.
|
1048
|
+
##
|
1049
|
+
attr_reader :tags
|
1050
|
+
|
1051
|
+
##
|
1052
|
+
# *
|
1053
|
+
# Points to the AST node locations of the pickle. The last one represents the unique
|
1054
|
+
# id of the pickle. A pickle constructed from `Examples` will have the first
|
1055
|
+
# id originating from the `Scenario` AST node, and the second from the `TableRow` AST node.
|
1056
|
+
##
|
1057
|
+
attr_reader :ast_node_ids
|
1058
|
+
|
1059
|
+
def initialize(
|
1060
|
+
id: '',
|
1061
|
+
uri: '',
|
1062
|
+
name: '',
|
1063
|
+
language: '',
|
1064
|
+
steps: [],
|
1065
|
+
tags: [],
|
1066
|
+
ast_node_ids: []
|
1067
|
+
)
|
1068
|
+
@id = id
|
1069
|
+
@uri = uri
|
1070
|
+
@name = name
|
1071
|
+
@language = language
|
1072
|
+
@steps = steps
|
1073
|
+
@tags = tags
|
1074
|
+
@ast_node_ids = ast_node_ids
|
1075
|
+
end
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
##
|
1079
|
+
# Represents the PickleDocString message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1080
|
+
##
|
1081
|
+
class PickleDocString < ::Cucumber::Messages::Message
|
1082
|
+
attr_reader :media_type
|
1083
|
+
|
1084
|
+
attr_reader :content
|
1085
|
+
|
1086
|
+
def initialize(
|
1087
|
+
media_type: nil,
|
1088
|
+
content: ''
|
1089
|
+
)
|
1090
|
+
@media_type = media_type
|
1091
|
+
@content = content
|
1092
|
+
end
|
1093
|
+
end
|
1094
|
+
|
1095
|
+
##
|
1096
|
+
# Represents the PickleStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1097
|
+
#
|
1098
|
+
# *
|
1099
|
+
# An executable step
|
1100
|
+
##
|
1101
|
+
class PickleStep < ::Cucumber::Messages::Message
|
1102
|
+
attr_reader :argument
|
1103
|
+
|
1104
|
+
##
|
1105
|
+
# References the IDs of the source of the step. For Gherkin, this can be
|
1106
|
+
# the ID of a Step, and possibly also the ID of a TableRow
|
1107
|
+
##
|
1108
|
+
attr_reader :ast_node_ids
|
1109
|
+
|
1110
|
+
##
|
1111
|
+
# A unique ID for the PickleStep
|
1112
|
+
##
|
1113
|
+
attr_reader :id
|
1114
|
+
|
1115
|
+
##
|
1116
|
+
# The context in which the step was specified: context (Given), action (When) or outcome (Then).
|
1117
|
+
#
|
1118
|
+
# Note that the keywords `But` and `And` inherit their meaning from prior steps and the `*` 'keyword' doesn't have specific meaning (hence Unknown)
|
1119
|
+
##
|
1120
|
+
attr_reader :type
|
1121
|
+
|
1122
|
+
attr_reader :text
|
1123
|
+
|
1124
|
+
def initialize(
|
1125
|
+
argument: nil,
|
1126
|
+
ast_node_ids: [],
|
1127
|
+
id: '',
|
1128
|
+
type: nil,
|
1129
|
+
text: ''
|
1130
|
+
)
|
1131
|
+
@argument = argument
|
1132
|
+
@ast_node_ids = ast_node_ids
|
1133
|
+
@id = id
|
1134
|
+
@type = type
|
1135
|
+
@text = text
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
##
|
1140
|
+
# Represents the PickleStepArgument message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1141
|
+
#
|
1142
|
+
# An optional argument
|
1143
|
+
##
|
1144
|
+
class PickleStepArgument < ::Cucumber::Messages::Message
|
1145
|
+
attr_reader :doc_string
|
1146
|
+
|
1147
|
+
attr_reader :data_table
|
1148
|
+
|
1149
|
+
def initialize(
|
1150
|
+
doc_string: nil,
|
1151
|
+
data_table: nil
|
1152
|
+
)
|
1153
|
+
@doc_string = doc_string
|
1154
|
+
@data_table = data_table
|
1155
|
+
end
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
##
|
1159
|
+
# Represents the PickleTable message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1160
|
+
##
|
1161
|
+
class PickleTable < ::Cucumber::Messages::Message
|
1162
|
+
attr_reader :rows
|
1163
|
+
|
1164
|
+
def initialize(
|
1165
|
+
rows: []
|
1166
|
+
)
|
1167
|
+
@rows = rows
|
1168
|
+
end
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
##
|
1172
|
+
# Represents the PickleTableCell message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1173
|
+
##
|
1174
|
+
class PickleTableCell < ::Cucumber::Messages::Message
|
1175
|
+
attr_reader :value
|
1176
|
+
|
1177
|
+
def initialize(
|
1178
|
+
value: ''
|
1179
|
+
)
|
1180
|
+
@value = value
|
1181
|
+
end
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
##
|
1185
|
+
# Represents the PickleTableRow message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1186
|
+
##
|
1187
|
+
class PickleTableRow < ::Cucumber::Messages::Message
|
1188
|
+
attr_reader :cells
|
1189
|
+
|
1190
|
+
def initialize(
|
1191
|
+
cells: []
|
1192
|
+
)
|
1193
|
+
@cells = cells
|
1194
|
+
end
|
1195
|
+
end
|
1196
|
+
|
1197
|
+
##
|
1198
|
+
# Represents the PickleTag message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1199
|
+
#
|
1200
|
+
# *
|
1201
|
+
# A tag
|
1202
|
+
##
|
1203
|
+
class PickleTag < ::Cucumber::Messages::Message
|
1204
|
+
attr_reader :name
|
1205
|
+
|
1206
|
+
##
|
1207
|
+
# Points to the AST node this was created from
|
1208
|
+
##
|
1209
|
+
attr_reader :ast_node_id
|
1210
|
+
|
1211
|
+
def initialize(
|
1212
|
+
name: '',
|
1213
|
+
ast_node_id: ''
|
1214
|
+
)
|
1215
|
+
@name = name
|
1216
|
+
@ast_node_id = ast_node_id
|
1217
|
+
end
|
1218
|
+
end
|
1219
|
+
|
1220
|
+
##
|
1221
|
+
# Represents the Source message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1222
|
+
#
|
1223
|
+
# //// Source
|
1224
|
+
#
|
1225
|
+
# *
|
1226
|
+
# A source file, typically a Gherkin document or Java/Ruby/JavaScript source code
|
1227
|
+
##
|
1228
|
+
class Source < ::Cucumber::Messages::Message
|
1229
|
+
##
|
1230
|
+
# *
|
1231
|
+
# The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)
|
1232
|
+
# of the source, typically a file path relative to the root directory
|
1233
|
+
##
|
1234
|
+
attr_reader :uri
|
1235
|
+
|
1236
|
+
##
|
1237
|
+
# The contents of the file
|
1238
|
+
##
|
1239
|
+
attr_reader :data
|
1240
|
+
|
1241
|
+
##
|
1242
|
+
# The media type of the file. Can be used to specify custom types, such as
|
1243
|
+
# text/x.cucumber.gherkin+plain
|
1244
|
+
##
|
1245
|
+
attr_reader :media_type
|
1246
|
+
|
1247
|
+
def initialize(
|
1248
|
+
uri: '',
|
1249
|
+
data: '',
|
1250
|
+
media_type: SourceMediaType::TEXT_X_CUCUMBER_GHERKIN_PLAIN
|
1251
|
+
)
|
1252
|
+
@uri = uri
|
1253
|
+
@data = data
|
1254
|
+
@media_type = media_type
|
1255
|
+
end
|
1256
|
+
end
|
1257
|
+
|
1258
|
+
##
|
1259
|
+
# Represents the SourceReference message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1260
|
+
#
|
1261
|
+
# *
|
1262
|
+
# Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a
|
1263
|
+
# [Location](#io.cucumber.messages.Location) within that file.
|
1264
|
+
##
|
1265
|
+
class SourceReference < ::Cucumber::Messages::Message
|
1266
|
+
attr_reader :uri
|
1267
|
+
|
1268
|
+
attr_reader :java_method
|
1269
|
+
|
1270
|
+
attr_reader :java_stack_trace_element
|
1271
|
+
|
1272
|
+
attr_reader :location
|
1273
|
+
|
1274
|
+
def initialize(
|
1275
|
+
uri: nil,
|
1276
|
+
java_method: nil,
|
1277
|
+
java_stack_trace_element: nil,
|
1278
|
+
location: nil
|
1279
|
+
)
|
1280
|
+
@uri = uri
|
1281
|
+
@java_method = java_method
|
1282
|
+
@java_stack_trace_element = java_stack_trace_element
|
1283
|
+
@location = location
|
1284
|
+
end
|
1285
|
+
end
|
1286
|
+
|
1287
|
+
##
|
1288
|
+
# Represents the JavaMethod message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1289
|
+
##
|
1290
|
+
class JavaMethod < ::Cucumber::Messages::Message
|
1291
|
+
attr_reader :class_name
|
1292
|
+
|
1293
|
+
attr_reader :method_name
|
1294
|
+
|
1295
|
+
attr_reader :method_parameter_types
|
1296
|
+
|
1297
|
+
def initialize(
|
1298
|
+
class_name: '',
|
1299
|
+
method_name: '',
|
1300
|
+
method_parameter_types: []
|
1301
|
+
)
|
1302
|
+
@class_name = class_name
|
1303
|
+
@method_name = method_name
|
1304
|
+
@method_parameter_types = method_parameter_types
|
1305
|
+
end
|
1306
|
+
end
|
1307
|
+
|
1308
|
+
##
|
1309
|
+
# Represents the JavaStackTraceElement message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1310
|
+
##
|
1311
|
+
class JavaStackTraceElement < ::Cucumber::Messages::Message
|
1312
|
+
attr_reader :class_name
|
1313
|
+
|
1314
|
+
attr_reader :file_name
|
1315
|
+
|
1316
|
+
attr_reader :method_name
|
1317
|
+
|
1318
|
+
def initialize(
|
1319
|
+
class_name: '',
|
1320
|
+
file_name: '',
|
1321
|
+
method_name: ''
|
1322
|
+
)
|
1323
|
+
@class_name = class_name
|
1324
|
+
@file_name = file_name
|
1325
|
+
@method_name = method_name
|
1326
|
+
end
|
1327
|
+
end
|
1328
|
+
|
1329
|
+
##
|
1330
|
+
# Represents the StepDefinition message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1331
|
+
##
|
1332
|
+
class StepDefinition < ::Cucumber::Messages::Message
|
1333
|
+
attr_reader :id
|
1334
|
+
|
1335
|
+
attr_reader :pattern
|
1336
|
+
|
1337
|
+
attr_reader :source_reference
|
1338
|
+
|
1339
|
+
def initialize(
|
1340
|
+
id: '',
|
1341
|
+
pattern: StepDefinitionPattern.new,
|
1342
|
+
source_reference: SourceReference.new
|
1343
|
+
)
|
1344
|
+
@id = id
|
1345
|
+
@pattern = pattern
|
1346
|
+
@source_reference = source_reference
|
1347
|
+
end
|
1348
|
+
end
|
1349
|
+
|
1350
|
+
##
|
1351
|
+
# Represents the StepDefinitionPattern message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1352
|
+
##
|
1353
|
+
class StepDefinitionPattern < ::Cucumber::Messages::Message
|
1354
|
+
attr_reader :source
|
1355
|
+
|
1356
|
+
attr_reader :type
|
1357
|
+
|
1358
|
+
def initialize(
|
1359
|
+
source: '',
|
1360
|
+
type: StepDefinitionPatternType::CUCUMBER_EXPRESSION
|
1361
|
+
)
|
1362
|
+
@source = source
|
1363
|
+
@type = type
|
1364
|
+
end
|
1365
|
+
end
|
1366
|
+
|
1367
|
+
##
|
1368
|
+
# Represents the TestCase message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1369
|
+
#
|
1370
|
+
# //// TestCases
|
1371
|
+
#
|
1372
|
+
# *
|
1373
|
+
# A `TestCase` contains a sequence of `TestStep`s.
|
1374
|
+
##
|
1375
|
+
class TestCase < ::Cucumber::Messages::Message
|
1376
|
+
attr_reader :id
|
1377
|
+
|
1378
|
+
##
|
1379
|
+
# The ID of the `Pickle` this `TestCase` is derived from.
|
1380
|
+
##
|
1381
|
+
attr_reader :pickle_id
|
1382
|
+
|
1383
|
+
attr_reader :test_steps
|
1384
|
+
|
1385
|
+
def initialize(
|
1386
|
+
id: '',
|
1387
|
+
pickle_id: '',
|
1388
|
+
test_steps: []
|
1389
|
+
)
|
1390
|
+
@id = id
|
1391
|
+
@pickle_id = pickle_id
|
1392
|
+
@test_steps = test_steps
|
1393
|
+
end
|
1394
|
+
end
|
1395
|
+
|
1396
|
+
##
|
1397
|
+
# Represents the Group message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1398
|
+
##
|
1399
|
+
class Group < ::Cucumber::Messages::Message
|
1400
|
+
attr_reader :children
|
1401
|
+
|
1402
|
+
attr_reader :start
|
1403
|
+
|
1404
|
+
attr_reader :value
|
1405
|
+
|
1406
|
+
def initialize(
|
1407
|
+
children: [],
|
1408
|
+
start: nil,
|
1409
|
+
value: nil
|
1410
|
+
)
|
1411
|
+
@children = children
|
1412
|
+
@start = start
|
1413
|
+
@value = value
|
1414
|
+
end
|
1415
|
+
end
|
1416
|
+
|
1417
|
+
##
|
1418
|
+
# Represents the StepMatchArgument message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1419
|
+
#
|
1420
|
+
# *
|
1421
|
+
# Represents a single argument extracted from a step match and passed to a step definition.
|
1422
|
+
# This is used for the following purposes:
|
1423
|
+
# - Construct an argument to pass to a step definition (possibly through a parameter type transform)
|
1424
|
+
# - Highlight the matched parameter in rich formatters such as the HTML formatter
|
1425
|
+
#
|
1426
|
+
# This message closely matches the `Argument` class in the `cucumber-expressions` library.
|
1427
|
+
##
|
1428
|
+
class StepMatchArgument < ::Cucumber::Messages::Message
|
1429
|
+
##
|
1430
|
+
# *
|
1431
|
+
# Represents the outermost capture group of an argument. This message closely matches the
|
1432
|
+
# `Group` class in the `cucumber-expressions` library.
|
1433
|
+
##
|
1434
|
+
attr_reader :group
|
1435
|
+
|
1436
|
+
attr_reader :parameter_type_name
|
1437
|
+
|
1438
|
+
def initialize(
|
1439
|
+
group: Group.new,
|
1440
|
+
parameter_type_name: nil
|
1441
|
+
)
|
1442
|
+
@group = group
|
1443
|
+
@parameter_type_name = parameter_type_name
|
1444
|
+
end
|
1445
|
+
end
|
1446
|
+
|
1447
|
+
##
|
1448
|
+
# Represents the StepMatchArgumentsList message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1449
|
+
##
|
1450
|
+
class StepMatchArgumentsList < ::Cucumber::Messages::Message
|
1451
|
+
attr_reader :step_match_arguments
|
1452
|
+
|
1453
|
+
def initialize(
|
1454
|
+
step_match_arguments: []
|
1455
|
+
)
|
1456
|
+
@step_match_arguments = step_match_arguments
|
1457
|
+
end
|
1458
|
+
end
|
1459
|
+
|
1460
|
+
##
|
1461
|
+
# Represents the TestStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1462
|
+
#
|
1463
|
+
# *
|
1464
|
+
# A `TestStep` is derived from either a `PickleStep`
|
1465
|
+
# combined with a `StepDefinition`, or from a `Hook`.
|
1466
|
+
##
|
1467
|
+
class TestStep < ::Cucumber::Messages::Message
|
1468
|
+
##
|
1469
|
+
# Pointer to the `Hook` (if derived from a Hook)
|
1470
|
+
##
|
1471
|
+
attr_reader :hook_id
|
1472
|
+
|
1473
|
+
attr_reader :id
|
1474
|
+
|
1475
|
+
##
|
1476
|
+
# Pointer to the `PickleStep` (if derived from a `PickleStep`)
|
1477
|
+
##
|
1478
|
+
attr_reader :pickle_step_id
|
1479
|
+
|
1480
|
+
##
|
1481
|
+
# Pointer to all the matching `StepDefinition`s (if derived from a `PickleStep`)
|
1482
|
+
##
|
1483
|
+
attr_reader :step_definition_ids
|
1484
|
+
|
1485
|
+
##
|
1486
|
+
# A list of list of StepMatchArgument (if derived from a `PickleStep`).
|
1487
|
+
# Each element represents a matching step definition. A size of 0 means `UNDEFINED`,
|
1488
|
+
# and a size of 2+ means `AMBIGUOUS`
|
1489
|
+
##
|
1490
|
+
attr_reader :step_match_arguments_lists
|
1491
|
+
|
1492
|
+
def initialize(
|
1493
|
+
hook_id: nil,
|
1494
|
+
id: '',
|
1495
|
+
pickle_step_id: nil,
|
1496
|
+
step_definition_ids: nil,
|
1497
|
+
step_match_arguments_lists: nil
|
1498
|
+
)
|
1499
|
+
@hook_id = hook_id
|
1500
|
+
@id = id
|
1501
|
+
@pickle_step_id = pickle_step_id
|
1502
|
+
@step_definition_ids = step_definition_ids
|
1503
|
+
@step_match_arguments_lists = step_match_arguments_lists
|
1504
|
+
end
|
1505
|
+
end
|
1506
|
+
|
1507
|
+
##
|
1508
|
+
# Represents the TestCaseFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1509
|
+
##
|
1510
|
+
class TestCaseFinished < ::Cucumber::Messages::Message
|
1511
|
+
attr_reader :test_case_started_id
|
1512
|
+
|
1513
|
+
attr_reader :timestamp
|
1514
|
+
|
1515
|
+
attr_reader :will_be_retried
|
1516
|
+
|
1517
|
+
def initialize(
|
1518
|
+
test_case_started_id: '',
|
1519
|
+
timestamp: Timestamp.new,
|
1520
|
+
will_be_retried: false
|
1521
|
+
)
|
1522
|
+
@test_case_started_id = test_case_started_id
|
1523
|
+
@timestamp = timestamp
|
1524
|
+
@will_be_retried = will_be_retried
|
1525
|
+
end
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
##
|
1529
|
+
# Represents the TestCaseStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1530
|
+
##
|
1531
|
+
class TestCaseStarted < ::Cucumber::Messages::Message
|
1532
|
+
##
|
1533
|
+
# *
|
1534
|
+
# The first attempt should have value 0, and for each retry the value
|
1535
|
+
# should increase by 1.
|
1536
|
+
##
|
1537
|
+
attr_reader :attempt
|
1538
|
+
|
1539
|
+
##
|
1540
|
+
# *
|
1541
|
+
# Because a `TestCase` can be run multiple times (in case of a retry),
|
1542
|
+
# we use this field to group messages relating to the same attempt.
|
1543
|
+
##
|
1544
|
+
attr_reader :id
|
1545
|
+
|
1546
|
+
attr_reader :test_case_id
|
1547
|
+
|
1548
|
+
##
|
1549
|
+
# 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.
|
1550
|
+
##
|
1551
|
+
attr_reader :worker_id
|
1552
|
+
|
1553
|
+
attr_reader :timestamp
|
1554
|
+
|
1555
|
+
def initialize(
|
1556
|
+
attempt: 0,
|
1557
|
+
id: '',
|
1558
|
+
test_case_id: '',
|
1559
|
+
worker_id: nil,
|
1560
|
+
timestamp: Timestamp.new
|
1561
|
+
)
|
1562
|
+
@attempt = attempt
|
1563
|
+
@id = id
|
1564
|
+
@test_case_id = test_case_id
|
1565
|
+
@worker_id = worker_id
|
1566
|
+
@timestamp = timestamp
|
1567
|
+
end
|
1568
|
+
end
|
1569
|
+
|
1570
|
+
##
|
1571
|
+
# Represents the TestRunFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1572
|
+
##
|
1573
|
+
class TestRunFinished < ::Cucumber::Messages::Message
|
1574
|
+
##
|
1575
|
+
# An informative message about the test run. Typically additional information about failure, but not necessarily.
|
1576
|
+
##
|
1577
|
+
attr_reader :message
|
1578
|
+
|
1579
|
+
##
|
1580
|
+
# A test run is successful if all steps are either passed or skipped, all before/after hooks passed and no other exceptions where thrown.
|
1581
|
+
##
|
1582
|
+
attr_reader :success
|
1583
|
+
|
1584
|
+
##
|
1585
|
+
# Timestamp when the TestRun is finished
|
1586
|
+
##
|
1587
|
+
attr_reader :timestamp
|
1588
|
+
|
1589
|
+
##
|
1590
|
+
# Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps.
|
1591
|
+
##
|
1592
|
+
attr_reader :exception
|
1593
|
+
|
1594
|
+
def initialize(
|
1595
|
+
message: nil,
|
1596
|
+
success: false,
|
1597
|
+
timestamp: Timestamp.new,
|
1598
|
+
exception: nil
|
1599
|
+
)
|
1600
|
+
@message = message
|
1601
|
+
@success = success
|
1602
|
+
@timestamp = timestamp
|
1603
|
+
@exception = exception
|
1604
|
+
end
|
1605
|
+
end
|
1606
|
+
|
1607
|
+
##
|
1608
|
+
# Represents the TestRunStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1609
|
+
##
|
1610
|
+
class TestRunStarted < ::Cucumber::Messages::Message
|
1611
|
+
attr_reader :timestamp
|
1612
|
+
|
1613
|
+
def initialize(
|
1614
|
+
timestamp: Timestamp.new
|
1615
|
+
)
|
1616
|
+
@timestamp = timestamp
|
1617
|
+
end
|
1618
|
+
end
|
1619
|
+
|
1620
|
+
##
|
1621
|
+
# Represents the TestStepFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1622
|
+
##
|
1623
|
+
class TestStepFinished < ::Cucumber::Messages::Message
|
1624
|
+
attr_reader :test_case_started_id
|
1625
|
+
|
1626
|
+
attr_reader :test_step_id
|
1627
|
+
|
1628
|
+
attr_reader :test_step_result
|
1629
|
+
|
1630
|
+
attr_reader :timestamp
|
1631
|
+
|
1632
|
+
def initialize(
|
1633
|
+
test_case_started_id: '',
|
1634
|
+
test_step_id: '',
|
1635
|
+
test_step_result: TestStepResult.new,
|
1636
|
+
timestamp: Timestamp.new
|
1637
|
+
)
|
1638
|
+
@test_case_started_id = test_case_started_id
|
1639
|
+
@test_step_id = test_step_id
|
1640
|
+
@test_step_result = test_step_result
|
1641
|
+
@timestamp = timestamp
|
1642
|
+
end
|
1643
|
+
end
|
1644
|
+
|
1645
|
+
##
|
1646
|
+
# Represents the TestStepResult message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1647
|
+
##
|
1648
|
+
class TestStepResult < ::Cucumber::Messages::Message
|
1649
|
+
attr_reader :duration
|
1650
|
+
|
1651
|
+
##
|
1652
|
+
# An arbitrary bit of information that explains this result. This can be a stack trace of anything else.
|
1653
|
+
##
|
1654
|
+
attr_reader :message
|
1655
|
+
|
1656
|
+
attr_reader :status
|
1657
|
+
|
1658
|
+
##
|
1659
|
+
# Exception thrown while executing this step, if any.
|
1660
|
+
##
|
1661
|
+
attr_reader :exception
|
1662
|
+
|
1663
|
+
def initialize(
|
1664
|
+
duration: Duration.new,
|
1665
|
+
message: nil,
|
1666
|
+
status: TestStepResultStatus::UNKNOWN,
|
1667
|
+
exception: nil
|
1668
|
+
)
|
1669
|
+
@duration = duration
|
1670
|
+
@message = message
|
1671
|
+
@status = status
|
1672
|
+
@exception = exception
|
1673
|
+
end
|
1674
|
+
end
|
1675
|
+
|
1676
|
+
##
|
1677
|
+
# Represents the TestStepStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1678
|
+
##
|
1679
|
+
class TestStepStarted < ::Cucumber::Messages::Message
|
1680
|
+
attr_reader :test_case_started_id
|
1681
|
+
|
1682
|
+
attr_reader :test_step_id
|
1683
|
+
|
1684
|
+
attr_reader :timestamp
|
1685
|
+
|
1686
|
+
def initialize(
|
1687
|
+
test_case_started_id: '',
|
1688
|
+
test_step_id: '',
|
1689
|
+
timestamp: Timestamp.new
|
1690
|
+
)
|
1691
|
+
@test_case_started_id = test_case_started_id
|
1692
|
+
@test_step_id = test_step_id
|
1693
|
+
@timestamp = timestamp
|
1694
|
+
end
|
1695
|
+
end
|
1696
|
+
|
1697
|
+
##
|
1698
|
+
# Represents the Timestamp message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1699
|
+
##
|
1700
|
+
class Timestamp < ::Cucumber::Messages::Message
|
1701
|
+
##
|
1702
|
+
# Represents seconds of UTC time since Unix epoch
|
1703
|
+
# 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
1704
|
+
# 9999-12-31T23:59:59Z inclusive.
|
1705
|
+
##
|
1706
|
+
attr_reader :seconds
|
1707
|
+
|
1708
|
+
##
|
1709
|
+
# Non-negative fractions of a second at nanosecond resolution. Negative
|
1710
|
+
# second values with fractions must still have non-negative nanos values
|
1711
|
+
# that count forward in time. Must be from 0 to 999,999,999
|
1712
|
+
# inclusive.
|
1713
|
+
##
|
1714
|
+
attr_reader :nanos
|
1715
|
+
|
1716
|
+
def initialize(
|
1717
|
+
seconds: 0,
|
1718
|
+
nanos: 0
|
1719
|
+
)
|
1720
|
+
@seconds = seconds
|
1721
|
+
@nanos = nanos
|
1722
|
+
end
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
##
|
1726
|
+
# Represents the UndefinedParameterType message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
1727
|
+
##
|
1728
|
+
class UndefinedParameterType < ::Cucumber::Messages::Message
|
1729
|
+
attr_reader :expression
|
1730
|
+
|
1731
|
+
attr_reader :name
|
1732
|
+
|
1733
|
+
def initialize(
|
1734
|
+
expression: '',
|
1735
|
+
name: ''
|
1736
|
+
)
|
1737
|
+
@expression = expression
|
1738
|
+
@name = name
|
1739
|
+
end
|
1740
|
+
end
|
1741
|
+
end
|
1742
|
+
end
|
1743
|
+
|
1744
|
+
class Cucumber::Messages::AttachmentContentEncoding
|
1745
|
+
IDENTITY = 'IDENTITY'
|
1746
|
+
BASE64 = 'BASE64'
|
1747
|
+
end
|
1748
|
+
|
1749
|
+
class Cucumber::Messages::PickleStepType
|
1750
|
+
UNKNOWN = 'Unknown'
|
1751
|
+
CONTEXT = 'Context'
|
1752
|
+
ACTION = 'Action'
|
1753
|
+
OUTCOME = 'Outcome'
|
1754
|
+
end
|
1755
|
+
|
1756
|
+
class Cucumber::Messages::SourceMediaType
|
1757
|
+
TEXT_X_CUCUMBER_GHERKIN_PLAIN = 'text/x.cucumber.gherkin+plain'
|
1758
|
+
TEXT_X_CUCUMBER_GHERKIN_MARKDOWN = 'text/x.cucumber.gherkin+markdown'
|
1759
|
+
end
|
1760
|
+
|
1761
|
+
class Cucumber::Messages::StepDefinitionPatternType
|
1762
|
+
CUCUMBER_EXPRESSION = 'CUCUMBER_EXPRESSION'
|
1763
|
+
REGULAR_EXPRESSION = 'REGULAR_EXPRESSION'
|
1764
|
+
end
|
1765
|
+
|
1766
|
+
class Cucumber::Messages::StepKeywordType
|
1767
|
+
UNKNOWN = 'Unknown'
|
1768
|
+
CONTEXT = 'Context'
|
1769
|
+
ACTION = 'Action'
|
1770
|
+
OUTCOME = 'Outcome'
|
1771
|
+
CONJUNCTION = 'Conjunction'
|
1772
|
+
end
|
1773
|
+
|
1774
|
+
class Cucumber::Messages::TestStepResultStatus
|
1775
|
+
UNKNOWN = 'UNKNOWN'
|
1776
|
+
PASSED = 'PASSED'
|
1777
|
+
SKIPPED = 'SKIPPED'
|
1778
|
+
PENDING = 'PENDING'
|
1779
|
+
UNDEFINED = 'UNDEFINED'
|
1780
|
+
AMBIGUOUS = 'AMBIGUOUS'
|
1781
|
+
FAILED = 'FAILED'
|
1782
|
+
end
|