cucumber-query 16.1.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/LICENSE +21 -0
- data/VERSION +1 -0
- data/lib/cucumber/query.rb +345 -0
- data/lib/cucumber/repository.rb +161 -0
- metadata +125 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 53f2051f5e16ea98bdcb7e987df75df6672d11627748c12523e496e9404958e3
|
|
4
|
+
data.tar.gz: 39616c91c5bc55f69791912a476aa2bf0ab81cf553f005152a1d5d57a18c5b34
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6a18310da1223cdad7eda324e37ea3470cadcf2f5a78d972765967d5dc72e7c1d8a5e6dd7d38b004ae84e3f913a977eab29cd90f33a9e145b26e60f71fd9b9d6
|
|
7
|
+
data.tar.gz: 4c9a12d900b97bc4b4d0aad867ca4551a9243b185bd522a60ed4d9226f9519eea67978a4580b955c2a189f8eb76f191ff0a762939c13ef6a4d9e67e05be21861
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Cucumber Ltd and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
16.1.0
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'cucumber/messages'
|
|
4
|
+
|
|
5
|
+
require_relative 'repository'
|
|
6
|
+
|
|
7
|
+
# Given one Cucumber Message, find another.
|
|
8
|
+
#
|
|
9
|
+
# Queries can be made while the test run is incomplete - and this will naturally return incomplete results
|
|
10
|
+
# see {Cucumber Messages - Message Overview}[https://github.com/cucumber/messages?tab=readme-ov-file#message-overview]
|
|
11
|
+
#
|
|
12
|
+
module Cucumber
|
|
13
|
+
# Provides lookup methods for related Cucumber messages stored in the `Repository` class.
|
|
14
|
+
class Query
|
|
15
|
+
attr_reader :repository
|
|
16
|
+
private :repository
|
|
17
|
+
|
|
18
|
+
include Cucumber::Messages::Helpers::TimeConversion
|
|
19
|
+
include Cucumber::Messages::Helpers::TestStepResultComparator
|
|
20
|
+
|
|
21
|
+
def initialize(repository)
|
|
22
|
+
@repository = repository
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @return [Integer]
|
|
26
|
+
def count_test_cases_started
|
|
27
|
+
find_all_test_case_started.length
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @return [Array<Pickle>]
|
|
31
|
+
def find_all_pickles
|
|
32
|
+
repository.pickle_by_id.values
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @return [Array<PickleStep>]
|
|
36
|
+
def find_all_pickle_steps
|
|
37
|
+
repository.pickle_step_by_id.values
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @return [Array<StepDefinition>]
|
|
41
|
+
def find_all_step_definitions
|
|
42
|
+
repository.step_definition_by_id.values
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @return [Array<TestCaseStarted>]
|
|
46
|
+
# This finds all test cases from the following conditions (UNION)
|
|
47
|
+
# -> Test cases that have started, but not yet finished
|
|
48
|
+
# -> Test cases that have started, finished, but that will NOT be retried
|
|
49
|
+
def find_all_test_case_started
|
|
50
|
+
repository.test_case_started_by_id.values.select do |test_case_started|
|
|
51
|
+
test_case_finished = find_test_case_finished_by(test_case_started)
|
|
52
|
+
test_case_finished.nil? || !test_case_finished.will_be_retried
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @return [Array<TestCaseFinished>]
|
|
57
|
+
# This finds all test cases that have finished AND will not be retried
|
|
58
|
+
def find_all_test_case_finished
|
|
59
|
+
repository.test_case_finished_by_test_case_started_id.values.reject(&:will_be_retried)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# @return [Array<TestCase>]
|
|
63
|
+
def find_all_test_cases
|
|
64
|
+
repository.test_case_by_id.values
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# @return [Array<TestRunHookStarted>]
|
|
68
|
+
def find_all_test_run_hook_started
|
|
69
|
+
repository.test_run_hook_started_by_id.values
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# @return [Array<TestRunHookFinished>]
|
|
73
|
+
def find_all_test_run_hook_finished
|
|
74
|
+
repository.test_run_hook_finished_by_test_run_hook_started_id.values
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @return [Array<TestStepStarted>]
|
|
78
|
+
def find_all_test_step_started
|
|
79
|
+
repository.test_steps_started_by_test_case_started_id.values.flatten
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# @return [Array<TestStepFinished>]
|
|
83
|
+
def find_all_test_step_finished
|
|
84
|
+
repository.test_steps_finished_by_test_case_started_id.values.flatten
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# @return [Array<TestStep>]
|
|
88
|
+
def find_all_test_steps
|
|
89
|
+
repository.test_step_by_id.values
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# @return [Array<UndefinedParameterType>]
|
|
93
|
+
def find_all_undefined_parameter_types
|
|
94
|
+
repository.undefined_parameter_types
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# @param message [TestStep, TestRunHookStarted, TestRunHookFinished]
|
|
98
|
+
# @return [Array<Hook>, nil]
|
|
99
|
+
def find_hook_by(message)
|
|
100
|
+
ensure_only_message_types!(
|
|
101
|
+
message,
|
|
102
|
+
[Cucumber::Messages::TestStep, Cucumber::Messages::TestRunHookStarted, Cucumber::Messages::TestRunHookFinished],
|
|
103
|
+
'#find_hook_by'
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
if message.is_a?(Cucumber::Messages::TestRunHookFinished)
|
|
107
|
+
test_run_hook_started_message = find_test_run_hook_started_by(message)
|
|
108
|
+
test_run_hook_started_message && find_hook_by(test_run_hook_started_message)
|
|
109
|
+
else
|
|
110
|
+
repository.hook_by_id[message.hook_id]
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# @return [Meta]
|
|
115
|
+
def find_meta
|
|
116
|
+
repository.meta
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# @param message [TestCaseStarted, TestCaseFinished]
|
|
120
|
+
# @return [TestStepResult, nil]
|
|
121
|
+
def find_most_severe_test_step_result_by(message)
|
|
122
|
+
ensure_only_message_types!(
|
|
123
|
+
message,
|
|
124
|
+
[Cucumber::Messages::TestCaseStarted, Cucumber::Messages::TestCaseFinished],
|
|
125
|
+
'#find_most_severe_test_step_result_by'
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
if message.is_a?(Cucumber::Messages::TestCaseStarted)
|
|
129
|
+
find_test_steps_finished_by(message)
|
|
130
|
+
.map(&:test_step_result)
|
|
131
|
+
.max_by { |test_step_result| test_step_result_rankings[test_step_result.status] }
|
|
132
|
+
else
|
|
133
|
+
test_case_started_message = find_test_case_started_by(message)
|
|
134
|
+
test_case_started_message && find_most_severe_test_step_result_by(test_case_started_message)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# @param message [TestCase, TestCaseStarted, TestCaseFinished, TestStepStarted, TestStepFinished]
|
|
139
|
+
# @return [Pickle]
|
|
140
|
+
def find_pickle_by(message)
|
|
141
|
+
ensure_only_message_types!(
|
|
142
|
+
message,
|
|
143
|
+
[
|
|
144
|
+
Cucumber::Messages::TestCase,
|
|
145
|
+
Cucumber::Messages::TestCaseStarted,
|
|
146
|
+
Cucumber::Messages::TestCaseFinished,
|
|
147
|
+
Cucumber::Messages::TestStepStarted,
|
|
148
|
+
Cucumber::Messages::TestStepFinished
|
|
149
|
+
],
|
|
150
|
+
'#find_pickle_by'
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
test_case_message = message.is_a?(Cucumber::Messages::TestCase) ? message : find_test_case_by(message)
|
|
154
|
+
repository.pickle_by_id[test_case_message.pickle_id]
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# @param message [TestStep]
|
|
158
|
+
# @return [PickleStep]
|
|
159
|
+
def find_pickle_step_by(message)
|
|
160
|
+
ensure_only_message_types!(
|
|
161
|
+
message,
|
|
162
|
+
[Cucumber::Messages::TestStep],
|
|
163
|
+
'#find_pickle_step_by'
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
repository.pickle_step_by_id[message.pickle_step_id]
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# @param message [PickleStep]
|
|
170
|
+
# @return [Step]
|
|
171
|
+
def find_step_by(message)
|
|
172
|
+
ensure_only_message_types!(
|
|
173
|
+
message,
|
|
174
|
+
[Cucumber::Messages::PickleStep],
|
|
175
|
+
'#find_step_by'
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
repository.step_by_id[message.ast_node_ids.first]
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# @param message [TestStep]
|
|
182
|
+
# @return [Array<StepDefinition>]
|
|
183
|
+
def find_step_definitions_by(message)
|
|
184
|
+
ensure_only_message_types!(
|
|
185
|
+
message,
|
|
186
|
+
[Cucumber::Messages::TestStep],
|
|
187
|
+
'#find_step_definitions_by'
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
ids = message.step_definition_ids.nil? ? [] : message.step_definition_ids
|
|
191
|
+
ids.filter_map { |id| repository.step_definition_by_id[id] }
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# @param message [Pickle, PickleStep]
|
|
195
|
+
# @return [Array<Suggestion>]
|
|
196
|
+
def find_suggestions_by(message)
|
|
197
|
+
ensure_only_message_types!(
|
|
198
|
+
message,
|
|
199
|
+
[Cucumber::Messages::Pickle, Cucumber::Messages::PickleStep],
|
|
200
|
+
'#find_suggestions_by'
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
if message.is_a?(Cucumber::Messages::PickleStep)
|
|
204
|
+
repository.suggestions_by_pickle_step_id[message.id]
|
|
205
|
+
else
|
|
206
|
+
message.steps.flat_map { |pickle_step| find_suggestions_by(pickle_step) }
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# @param message [TestCaseStarted, TestCaseFinished, TestStepStarted, TestStepFinished]
|
|
211
|
+
# @return [TestCase]
|
|
212
|
+
def find_test_case_by(message)
|
|
213
|
+
ensure_only_message_types!(
|
|
214
|
+
message,
|
|
215
|
+
[
|
|
216
|
+
Cucumber::Messages::TestCaseStarted,
|
|
217
|
+
Cucumber::Messages::TestCaseFinished,
|
|
218
|
+
Cucumber::Messages::TestStepStarted,
|
|
219
|
+
Cucumber::Messages::TestStepFinished
|
|
220
|
+
],
|
|
221
|
+
'#find_test_case_by'
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
test_case_started_message = message.is_a?(Cucumber::Messages::TestCaseStarted) ? message : find_test_case_started_by(message)
|
|
225
|
+
repository.test_case_by_id[test_case_started_message.test_case_id]
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# @param message [TestCaseFinished, TestStepStarted, TestStepFinished]
|
|
229
|
+
# @return [TestCaseStarted]
|
|
230
|
+
def find_test_case_started_by(message)
|
|
231
|
+
ensure_only_message_types!(
|
|
232
|
+
message,
|
|
233
|
+
[Cucumber::Messages::TestCaseFinished, Cucumber::Messages::TestStepStarted, Cucumber::Messages::TestStepFinished],
|
|
234
|
+
'#find_test_case_started_by'
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
repository.test_case_started_by_id[message.test_case_started_id]
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# @param message [TestCaseStarted]
|
|
241
|
+
# @return [TestCaseFinished]
|
|
242
|
+
def find_test_case_finished_by(message)
|
|
243
|
+
ensure_only_message_types!(
|
|
244
|
+
message,
|
|
245
|
+
[Cucumber::Messages::TestCaseStarted],
|
|
246
|
+
'#find_test_case_finished_by'
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
repository.test_case_finished_by_test_case_started_id[message.id]
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# @return [Hash<String, Integer>, nil]
|
|
253
|
+
def find_test_run_duration
|
|
254
|
+
if repository.test_run_started.nil? || repository.test_run_finished.nil?
|
|
255
|
+
nil
|
|
256
|
+
else
|
|
257
|
+
float_time = timestamp_to_time(repository.test_run_finished.timestamp) - timestamp_to_time(repository.test_run_started.timestamp)
|
|
258
|
+
seconds_to_duration(float_time)
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# @param message [TestRunHookFinished]
|
|
263
|
+
# @return [TestRunHookStarted]
|
|
264
|
+
def find_test_run_hook_started_by(message)
|
|
265
|
+
ensure_only_message_types!(
|
|
266
|
+
message,
|
|
267
|
+
[Cucumber::Messages::TestRunHookFinished],
|
|
268
|
+
'#find_test_run_hook_started_by'
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
repository.test_run_hook_started_by_id[message.test_run_hook_started_id]
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# @param message [TestRunHookStarted]
|
|
275
|
+
# @return [TestRunHookFinished]
|
|
276
|
+
def find_test_run_hook_finished_by(message)
|
|
277
|
+
ensure_only_message_types!(
|
|
278
|
+
message,
|
|
279
|
+
[Cucumber::Messages::TestRunHookStarted],
|
|
280
|
+
'#find_test_run_hook_finished_by'
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
repository.test_run_hook_finished_by_test_run_hook_started_id[message.id]
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# @return [TestRunStarted]
|
|
287
|
+
def find_test_run_started
|
|
288
|
+
repository.test_run_started
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# @return [TestRunFinished]
|
|
292
|
+
def find_test_run_finished
|
|
293
|
+
repository.test_run_finished
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# @param message [TestStepStarted, TestStepFinished]
|
|
297
|
+
# @return [TestStep]
|
|
298
|
+
def find_test_step_by(message)
|
|
299
|
+
ensure_only_message_types!(
|
|
300
|
+
message,
|
|
301
|
+
[Cucumber::Messages::TestStepStarted, Cucumber::Messages::TestStepFinished],
|
|
302
|
+
'#find_test_step_by'
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
repository.test_step_by_id[message.test_step_id]
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# @param message [TestCaseStarted, TestCaseFinished]
|
|
309
|
+
# @return [Array<TestStep>]
|
|
310
|
+
def find_test_steps_started_by(message)
|
|
311
|
+
ensure_only_message_types!(
|
|
312
|
+
message,
|
|
313
|
+
[Cucumber::Messages::TestCaseStarted, Cucumber::Messages::TestCaseFinished],
|
|
314
|
+
'#find_test_steps_started_by'
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
key = message.is_a?(Cucumber::Messages::TestCaseStarted) ? message.id : message.test_case_started_id
|
|
318
|
+
repository.test_steps_started_by_test_case_started_id.fetch(key, [])
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# @param message [TestCaseStarted, TestCaseFinished]
|
|
322
|
+
# @return [Array<TestStep>]
|
|
323
|
+
def find_test_steps_finished_by(message)
|
|
324
|
+
ensure_only_message_types!(
|
|
325
|
+
message,
|
|
326
|
+
[Cucumber::Messages::TestCaseStarted, Cucumber::Messages::TestCaseFinished],
|
|
327
|
+
'#find_test_steps_finished_by'
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
if message.is_a?(Cucumber::Messages::TestCaseStarted)
|
|
331
|
+
repository.test_steps_finished_by_test_case_started_id.fetch(message.id, [])
|
|
332
|
+
else
|
|
333
|
+
test_case_started_message = find_test_case_started_by(message)
|
|
334
|
+
test_case_started_message.nil? ? [] : find_test_steps_finished_by(test_case_started_message)
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
private
|
|
339
|
+
|
|
340
|
+
def ensure_only_message_types!(supplied_message, permissible_message_types, method_name)
|
|
341
|
+
raise ArgumentError, "Supplied argument is not a Cucumber Message. Argument: #{supplied_message.class}" unless supplied_message.is_a?(Cucumber::Messages::Message)
|
|
342
|
+
raise ArgumentError, "Supplied message type '#{supplied_message.class}' is not permitted to be used when calling #{method_name}" unless permissible_message_types.include?(supplied_message.class)
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cucumber
|
|
4
|
+
# In memory repository i.e. a thread based link to cucumber-query
|
|
5
|
+
class Repository
|
|
6
|
+
attr_accessor :meta, :test_run_started, :test_run_finished
|
|
7
|
+
attr_reader :attachments_by_test_case_started_id, :attachments_by_test_run_hook_started_id,
|
|
8
|
+
:hook_by_id,
|
|
9
|
+
:pickle_by_id, :pickle_step_by_id,
|
|
10
|
+
:suggestions_by_pickle_step_id,
|
|
11
|
+
:step_by_id, :step_definition_by_id,
|
|
12
|
+
:test_case_by_id, :test_case_started_by_id, :test_case_finished_by_test_case_started_id,
|
|
13
|
+
:test_run_hook_started_by_id, :test_run_hook_finished_by_test_run_hook_started_id,
|
|
14
|
+
:test_step_by_id, :test_steps_started_by_test_case_started_id, :test_steps_finished_by_test_case_started_id,
|
|
15
|
+
:undefined_parameter_types
|
|
16
|
+
|
|
17
|
+
def initialize
|
|
18
|
+
@attachments_by_test_case_started_id = _hash_with_array_default
|
|
19
|
+
@attachments_by_test_run_hook_started_id = _hash_with_array_default
|
|
20
|
+
@hook_by_id = {}
|
|
21
|
+
@pickle_by_id = {}
|
|
22
|
+
@pickle_step_by_id = {}
|
|
23
|
+
@step_by_id = {}
|
|
24
|
+
@step_definition_by_id = {}
|
|
25
|
+
@suggestions_by_pickle_step_id = _hash_with_array_default
|
|
26
|
+
@test_case_by_id = {}
|
|
27
|
+
@test_case_started_by_id = {}
|
|
28
|
+
@test_case_finished_by_test_case_started_id = {}
|
|
29
|
+
@test_run_hook_started_by_id = {}
|
|
30
|
+
@test_run_hook_finished_by_test_run_hook_started_id = {}
|
|
31
|
+
@test_step_by_id = {}
|
|
32
|
+
@test_steps_started_by_test_case_started_id = _hash_with_array_default
|
|
33
|
+
@test_steps_finished_by_test_case_started_id = _hash_with_array_default
|
|
34
|
+
@undefined_parameter_types = []
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def update(envelope)
|
|
38
|
+
message_category = envelope.type[:contained_message]
|
|
39
|
+
message_value = envelope.public_send(message_category)
|
|
40
|
+
send("update_#{message_category}", message_value)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def method_missing(method_name, *args, &)
|
|
46
|
+
if method_name.to_s.start_with?('update_')
|
|
47
|
+
Kernel.warn("Attempting to update the repository with #{method_name}. Please raise this as a missing message handler")
|
|
48
|
+
Kernel.warn('Create an issue here: https://github.com/cucumber/query/issues')
|
|
49
|
+
nil
|
|
50
|
+
else
|
|
51
|
+
super
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
56
|
+
method_name.to_s.start_with?('update_') || super
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def update_attachment(attachment)
|
|
60
|
+
attachments_by_test_case_started_id[attachment.test_case_started_id] << attachment if attachment.test_case_started_id
|
|
61
|
+
attachments_by_test_run_hook_started_id[attachment.test_run_hook_started_id] << attachment if attachment.test_run_hook_started_id
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def update_feature(feature)
|
|
65
|
+
feature.children.each do |feature_child|
|
|
66
|
+
update_steps(feature_child.background.steps) if feature_child.background
|
|
67
|
+
update_scenario(feature_child.scenario) if feature_child.scenario
|
|
68
|
+
feature_child.rule&.children&.each { |rule_child| _update_feature_rule(rule_child) }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def update_gherkin_document(gherkin_document)
|
|
73
|
+
update_feature(gherkin_document.feature) if gherkin_document.feature
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def update_hook(hook)
|
|
77
|
+
hook_by_id[hook.id] = hook
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def update_meta(meta)
|
|
81
|
+
self.meta = meta
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def update_pickle(pickle)
|
|
85
|
+
pickle_by_id[pickle.id] = pickle
|
|
86
|
+
pickle.steps.each { |pickle_step| pickle_step_by_id[pickle_step.id] = pickle_step }
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def update_scenario(scenario)
|
|
90
|
+
update_steps(scenario.steps)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def update_source(_source)
|
|
94
|
+
# This deliberately doesn't perform any handling. `Source` as a message is not stored or required
|
|
95
|
+
# - See `GherkinDocument` for a more "parsed" form of an AST representation
|
|
96
|
+
:no_op
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def update_steps(steps)
|
|
100
|
+
steps.each { |step| step_by_id[step.id] = step }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def update_step_definition(step_definition)
|
|
104
|
+
step_definition_by_id[step_definition.id] = step_definition
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def update_suggestion(suggestion)
|
|
108
|
+
suggestions_by_pickle_step_id[suggestion.pickle_step_id] << suggestion
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def update_test_case(test_case)
|
|
112
|
+
test_case_by_id[test_case.id] = test_case
|
|
113
|
+
test_case.test_steps.each { |test_step| test_step_by_id[test_step.id] = test_step }
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def update_test_case_started(test_case_started)
|
|
117
|
+
test_case_started_by_id[test_case_started.id] = test_case_started
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def update_test_case_finished(test_case_finished)
|
|
121
|
+
test_case_finished_by_test_case_started_id[test_case_finished.test_case_started_id] = test_case_finished
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def update_test_run_started(test_run_started)
|
|
125
|
+
self.test_run_started = test_run_started
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def update_test_run_finished(test_run_finished)
|
|
129
|
+
self.test_run_finished = test_run_finished
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def update_test_run_hook_started(test_run_hook_started)
|
|
133
|
+
test_run_hook_started_by_id[test_run_hook_started.id] = test_run_hook_started
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def update_test_run_hook_finished(test_run_hook_finished)
|
|
137
|
+
test_run_hook_finished_by_test_run_hook_started_id[test_run_hook_finished.test_run_hook_started_id] = test_run_hook_finished
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def update_test_step_started(test_step_started)
|
|
141
|
+
test_steps_started_by_test_case_started_id[test_step_started.test_case_started_id] << test_step_started
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def update_test_step_finished(test_step_finished)
|
|
145
|
+
test_steps_finished_by_test_case_started_id[test_step_finished.test_case_started_id] << test_step_finished
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def update_undefined_parameter_type(undefined_parameter_type)
|
|
149
|
+
undefined_parameter_types << undefined_parameter_type
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def _update_feature_rule(rule_child)
|
|
153
|
+
update_steps(rule_child.background.steps) if rule_child.background
|
|
154
|
+
update_scenario(rule_child.scenario) if rule_child.scenario
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def _hash_with_array_default
|
|
158
|
+
Hash.new { |hash, key| hash[key] = [] }
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cucumber-query
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 16.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Luke Hill
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: cucumber-messages
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '34.1'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '36'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '34.1'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '36'
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: rspec
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - "~>"
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '3.13'
|
|
39
|
+
type: :development
|
|
40
|
+
prerelease: false
|
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - "~>"
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '3.13'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: rubocop
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - "~>"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 1.88.0
|
|
53
|
+
type: :development
|
|
54
|
+
prerelease: false
|
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - "~>"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: 1.88.0
|
|
60
|
+
- !ruby/object:Gem::Dependency
|
|
61
|
+
name: rubocop-performance
|
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - "~>"
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: 1.26.1
|
|
67
|
+
type: :development
|
|
68
|
+
prerelease: false
|
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - "~>"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: 1.26.1
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: rubocop-rspec
|
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - "~>"
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: 3.10.2
|
|
81
|
+
type: :development
|
|
82
|
+
prerelease: false
|
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - "~>"
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: 3.10.2
|
|
88
|
+
description: Cucumber Query - query messages
|
|
89
|
+
email: cukebot@cucumber.io
|
|
90
|
+
executables: []
|
|
91
|
+
extensions: []
|
|
92
|
+
extra_rdoc_files: []
|
|
93
|
+
files:
|
|
94
|
+
- LICENSE
|
|
95
|
+
- VERSION
|
|
96
|
+
- lib/cucumber/query.rb
|
|
97
|
+
- lib/cucumber/repository.rb
|
|
98
|
+
homepage: https://github.com/cucumber/query
|
|
99
|
+
licenses:
|
|
100
|
+
- MIT
|
|
101
|
+
metadata:
|
|
102
|
+
bug_tracker_uri: https://github.com/cucumber/query/issues
|
|
103
|
+
changelog_uri: https://github.com/cucumber/query/blob/main/CHANGELOG.md
|
|
104
|
+
documentation_uri: https://github.com/cucumber/query/blob/main/README.md
|
|
105
|
+
mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
|
|
106
|
+
source_code_uri: https://github.com/cucumber/query/blob/main/ruby
|
|
107
|
+
rdoc_options:
|
|
108
|
+
- "--charset=UTF-8"
|
|
109
|
+
require_paths:
|
|
110
|
+
- lib
|
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '3.3'
|
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
|
+
requirements:
|
|
118
|
+
- - ">="
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
version: 3.2.8
|
|
121
|
+
requirements: []
|
|
122
|
+
rubygems_version: 4.0.16
|
|
123
|
+
specification_version: 4
|
|
124
|
+
summary: cucumber-query-16.1.0
|
|
125
|
+
test_files: []
|