parallel_report_portal 2.1.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/lib/parallel_report_portal/http.rb +33 -26
- data/lib/parallel_report_portal/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35cc50dee2f24a1533a8ef831c0cd1977fc36c6fd9c6cdb5ccdd4a73c8022cc2
|
4
|
+
data.tar.gz: fa3c3fbe565ac7e1aa5b728a6fe73f401d84c4b327eebe83a4f1af6697d6fda0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b26b53f1e989cf4e2179e6361be41b783ca692d739aa7bdabaab50b9599c4e5378fa05b1fb9920bde748bdff56ef99a0afb4f4431b23329ac69b83db81ea057
|
7
|
+
data.tar.gz: c0cc62184f810e2bd53119e7115e29be3c014d707f8bce610c825a466d356337a0c694d4dae6e14b87f137f136136ae1056aceec0f6a7e590b35a59dedc79961
|
data/.rspec
CHANGED
@@ -2,7 +2,7 @@ require 'logger'
|
|
2
2
|
require 'tempfile'
|
3
3
|
|
4
4
|
module ParallelReportPortal
|
5
|
-
# A collection of methods for communicating with the ReportPortal
|
5
|
+
# A collection of methods for communicating with the ReportPortal
|
6
6
|
# REST interface.
|
7
7
|
module HTTP
|
8
8
|
|
@@ -10,16 +10,16 @@ module ParallelReportPortal
|
|
10
10
|
@@logger = Logger.new(STDOUT)
|
11
11
|
@@logger.level = Logger::ERROR
|
12
12
|
|
13
|
-
# Construct the Report Portal project URL (as a string) based
|
13
|
+
# Construct the Report Portal project URL (as a string) based
|
14
14
|
# on the config settings.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# @return [String] URL the report portal base URL
|
17
17
|
def url
|
18
18
|
"#{ParallelReportPortal.configuration.endpoint}/#{ParallelReportPortal.configuration.project}"
|
19
19
|
end
|
20
20
|
|
21
21
|
# Helper method for constructing the +Bearer+ header
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# @return [String] header the bearer header value
|
24
24
|
def authorization_header
|
25
25
|
"Bearer #{ParallelReportPortal.configuration.uuid}"
|
@@ -28,7 +28,7 @@ module ParallelReportPortal
|
|
28
28
|
# Get a preconstructed Faraday HTTP connection
|
29
29
|
# which has the endpont and headers ready populated.
|
30
30
|
# This object is memoized.
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# @return [Faraday::Connection] connection the HTTP connection object
|
33
33
|
def http_connection
|
34
34
|
@http_connection ||= Faraday.new(
|
@@ -49,7 +49,7 @@ module ParallelReportPortal
|
|
49
49
|
# Get a preconstructed Faraday HTTP multipart connection
|
50
50
|
# which has the endpont and headers ready populated.
|
51
51
|
# This object is memoized.
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# @return [Faraday::Connection] connection the HTTP connection object
|
54
54
|
def http_multipart_connection
|
55
55
|
@http_multipart_connection ||= Faraday.new(
|
@@ -74,10 +74,10 @@ module ParallelReportPortal
|
|
74
74
|
def req_launch_started(time)
|
75
75
|
resp = http_connection.post('launch') do |req|
|
76
76
|
req.body = {
|
77
|
-
name: ParallelReportPortal.configuration.launch,
|
78
|
-
start_time: time,
|
79
|
-
tags: ParallelReportPortal.configuration.tags,
|
80
|
-
description: ParallelReportPortal.configuration.description,
|
77
|
+
name: ParallelReportPortal.configuration.launch,
|
78
|
+
start_time: time,
|
79
|
+
tags: ParallelReportPortal.configuration.tags,
|
80
|
+
description: ParallelReportPortal.configuration.description,
|
81
81
|
mode: (ParallelReportPortal.configuration.debug ? 'DEBUG' : 'DEFAULT' ),
|
82
82
|
attributes: ParallelReportPortal.configuration.attributes
|
83
83
|
}.to_json
|
@@ -88,7 +88,7 @@ module ParallelReportPortal
|
|
88
88
|
@@logger.error("Launch failed with response code #{resp.status} -- message #{resp.body}")
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
# Send a request to Report Portal to finish a launch.
|
93
93
|
# It will bubble up any Faraday connection exceptions.
|
94
94
|
def req_launch_finished(launch_id, time)
|
@@ -96,10 +96,10 @@ module ParallelReportPortal
|
|
96
96
|
req.body = { end_time: time }.to_json
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
# Send a request to ReportPortal to start a feature.
|
101
101
|
# It will bubble up any Faraday connection exceptions.
|
102
|
-
#
|
102
|
+
#
|
103
103
|
# @return [String] id the UUID of the feature
|
104
104
|
def req_feature_started(launch_id, parent_id, feature, time)
|
105
105
|
description = if feature.description
|
@@ -116,9 +116,9 @@ module ParallelReportPortal
|
|
116
116
|
description,
|
117
117
|
time )
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
120
|
# Sends a request to Report Portal to add an item into its hierarchy.
|
121
|
-
#
|
121
|
+
#
|
122
122
|
# @return [String] uuid the UUID of the newly created child
|
123
123
|
def req_hierarchy(launch_id, name, parent, type, tags, description, time )
|
124
124
|
resource = 'item'
|
@@ -134,23 +134,23 @@ module ParallelReportPortal
|
|
134
134
|
attributes: tags
|
135
135
|
}.to_json
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
if resp.success?
|
139
139
|
JSON.parse(resp.body)['id']
|
140
140
|
else
|
141
141
|
@@logger.warn("Starting a heirarchy failed with response code #{resp.status} -- message #{resp.body}")
|
142
142
|
end
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
# Send a request to Report Portal that a feature has completed.
|
146
146
|
def req_feature_finished(feature_id, time)
|
147
147
|
ParallelReportPortal.http_connection.put("item/#{feature_id}") do |req|
|
148
148
|
req.body = { end_time: time }.to_json
|
149
149
|
end
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
# Send a request to ReportPortal to start a test case.
|
153
|
-
#
|
153
|
+
#
|
154
154
|
# @return [String] uuid the UUID of the test case
|
155
155
|
def req_test_case_started(launch_id, feature_id, test_case, time)
|
156
156
|
resp = ParallelReportPortal.http_connection.post("item/#{feature_id}") do |req|
|
@@ -176,7 +176,7 @@ module ParallelReportPortal
|
|
176
176
|
@@logger.warn("Starting a test case failed with response code #{resp.status} -- message #{resp.body}")
|
177
177
|
end
|
178
178
|
end
|
179
|
-
|
179
|
+
|
180
180
|
# Request that the test case be finished
|
181
181
|
def req_test_case_finished(test_case_id, status, time)
|
182
182
|
resp = ParallelReportPortal.http_connection.put("item/#{test_case_id}") do |req|
|
@@ -186,8 +186,8 @@ module ParallelReportPortal
|
|
186
186
|
}.to_json
|
187
187
|
end
|
188
188
|
end
|
189
|
-
|
190
|
-
|
189
|
+
|
190
|
+
|
191
191
|
# Request that Report Portal records a log record
|
192
192
|
def req_log(test_case_id, detail, level, time)
|
193
193
|
resp = ParallelReportPortal.http_connection.post('log') do |req|
|
@@ -202,19 +202,26 @@ module ParallelReportPortal
|
|
202
202
|
|
203
203
|
|
204
204
|
# Request that Report Portal attach a file to the test case.
|
205
|
-
#
|
205
|
+
#
|
206
206
|
# @param status [String] the status level of the log, e.g. info, warn
|
207
207
|
# @param path [String] the fully qualified path of the file to attach
|
208
208
|
# @param label [String] a label to add to the attachment, defaults to the filename
|
209
209
|
# @param time [Integer] the time in milliseconds for the attachment
|
210
210
|
# @param mime_type [String] the mimetype of the attachment
|
211
|
-
def send_file(
|
211
|
+
def send_file(
|
212
|
+
status,
|
213
|
+
path,
|
214
|
+
label = nil,
|
215
|
+
time = ParallelReportPortal.clock,
|
216
|
+
mime_type = 'image/png',
|
217
|
+
scenario_id = nil
|
218
|
+
)
|
212
219
|
File.open(File.realpath(path), 'rb') do |file|
|
213
220
|
label ||= File.basename(file)
|
214
221
|
|
215
|
-
# where did @test_case_id come from? ok, I know where it came from but this
|
222
|
+
# where did @test_case_id come from? ok, I know where it came from but this
|
216
223
|
# really should be factored out of here and state handled better
|
217
|
-
json = { level: status, message: label, item_id: @test_case_id, time: time, file: { name: File.basename(file) } }
|
224
|
+
json = { level: status, message: label, item_id: scenario_id || @test_case_id, time: time, file: { name: File.basename(file) } }
|
218
225
|
|
219
226
|
json_file = Tempfile.new
|
220
227
|
json_file << [json].to_json
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_report_portal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Brookes-Thomas
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appraisal
|
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '0'
|
236
236
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
237
|
+
rubygems_version: 3.3.7
|
238
238
|
signing_key:
|
239
239
|
specification_version: 4
|
240
240
|
summary: Run Cucumber Tests in parallel and with Cucumber 3 and 4+
|