parallel_report_portal 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eac77f10cdc4ca803b014029883de0cc28439fe645547190ff1022878f430c5
|
4
|
+
data.tar.gz: 1e50abb80970dfcab716abe749b554b6622209ac55a51c207b4bbc7e3201d078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e3b3b267691986d4e98051be3fc2027cfff873a3cb69de2ce1d5e18df435b769bf8bc94ace5f03b436d285f28b121b0986056cfc3f909aaa94c7931b96f6210
|
7
|
+
data.tar.gz: '068c14c09b3b8c47da4b6bf2a5513316f66ecc8893bca4ff112787bc6f2db1582198d042f6cbc35357adcc23136bd4215ecddc84c50988bf22efbac94471c469'
|
@@ -1,23 +1,23 @@
|
|
1
1
|
module ParallelReportPortal
|
2
2
|
# The Configuration class holds the connection properties to communicate with
|
3
3
|
# Report Portal and to identify the user and project for reporting.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# It attempts to load a configuration file called +report_portal.yml+ first in a
|
6
6
|
# local directory called +config+ and if that's not found in the current directory.
|
7
7
|
# (Report Portal actually tells you to create a files called +REPORT_PORTAL.YML+ in
|
8
|
-
# uppercase -- for this reason the initializer is case insensitive with regards to
|
8
|
+
# uppercase -- for this reason the initializer is case insensitive with regards to
|
9
9
|
# the file name)
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# It will then try an apply the following environment variables, if present (these
|
12
12
|
# can be specified in either lowercase for backwards compatibility with the official
|
13
13
|
# gem or in uppercase for reasons of sanity)
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# == Environment variables
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# RP_UUID:: The UUID of the user associated with this launch
|
18
18
|
# RP_ENDPOINT:: the URL of the Report Portal API endpoint
|
19
19
|
# RP_PROJECT:: the Report Portal project name -- this must already exist within Report Port and this user must be a member of the project
|
20
|
-
# RP_LAUNCH:: The name of this launch
|
20
|
+
# RP_LAUNCH:: The name of this launch
|
21
21
|
# RP_DESCRIPTION:: A textual string describing this launch
|
22
22
|
# RP_TAGS:: A set of tags to pass to Report Portal for this launch. If these are set via an environment variable, provide a comma-separated string of tags
|
23
23
|
# RP_ATTRIBUTES:: A set of attribute tags to pass to Report Portal for this launch. If these are set via an environment variable, provide a comma-separated string of attributes
|
@@ -52,7 +52,6 @@ module ParallelReportPortal
|
|
52
52
|
# @return [Integer] the number of seconds for the read connection to timeout
|
53
53
|
attr_accessor :read_timeout
|
54
54
|
|
55
|
-
|
56
55
|
# Create an instance of Configuration.
|
57
56
|
#
|
58
57
|
# The initializer will first attempt to load a configuration files called
|
@@ -101,6 +100,7 @@ module ParallelReportPortal
|
|
101
100
|
end
|
102
101
|
end
|
103
102
|
|
103
|
+
|
104
104
|
# Simple method to obtain an attribute from this class or set default value
|
105
105
|
# param [symbol] a symbol version of the attribute
|
106
106
|
def fetch(key, default_value)
|
@@ -4,39 +4,39 @@ require 'tree'
|
|
4
4
|
module ParallelReportPortal
|
5
5
|
module Cucumber
|
6
6
|
# Report object. This handles the management of the state hierarchy and
|
7
|
-
# the issuing of the requests to the HTTP module.
|
7
|
+
# the issuing of the requests to the HTTP module.
|
8
8
|
class Report
|
9
|
-
|
9
|
+
|
10
10
|
attr_reader :launch_id
|
11
|
-
|
11
|
+
|
12
12
|
Feature = Struct.new(:feature, :id)
|
13
|
-
|
14
|
-
LOG_LEVELS = {
|
15
|
-
error: 'ERROR',
|
16
|
-
warn: 'WARN',
|
17
|
-
info: 'INFO',
|
18
|
-
debug: 'DEBUG',
|
19
|
-
trace: 'TRACE',
|
20
|
-
fatal: 'FATAL',
|
21
|
-
unknown: 'UNKNOWN'
|
13
|
+
|
14
|
+
LOG_LEVELS = {
|
15
|
+
error: 'ERROR',
|
16
|
+
warn: 'WARN',
|
17
|
+
info: 'INFO',
|
18
|
+
debug: 'DEBUG',
|
19
|
+
trace: 'TRACE',
|
20
|
+
fatal: 'FATAL',
|
21
|
+
unknown: 'UNKNOWN'
|
22
22
|
}
|
23
23
|
|
24
|
-
|
24
|
+
|
25
25
|
# Create a new instance of the report
|
26
26
|
def initialize(ast_lookup = nil)
|
27
27
|
@feature = nil
|
28
|
-
@tree = Tree::TreeNode.new( 'root' )
|
28
|
+
@tree = Tree::TreeNode.new( 'root' )
|
29
29
|
@ast_lookup = ast_lookup
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# Issued to start a launch. It is possilbe that this method could be called
|
33
33
|
# from multiple processes for the same launch if this is being run with
|
34
34
|
# parallel tests enabled. A temporary launch file will be created (using
|
35
35
|
# exclusive locking). The first time this method is called it will write the
|
36
36
|
# launch id to the launch file, subsequent calls by other processes will read
|
37
37
|
# this launch id and use that.
|
38
|
-
#
|
39
|
-
# @param start_time [Integer] the millis from the epoch
|
38
|
+
#
|
39
|
+
# @param start_time [Integer] the millis from the epoch
|
40
40
|
# @return [String] the UUID of this launch
|
41
41
|
def launch_started(start_time)
|
42
42
|
ParallelReportPortal.file_open_exlock_and_block(ParallelReportPortal.launch_id_file, 'a+' ) do |file|
|
@@ -50,39 +50,42 @@ module ParallelReportPortal
|
|
50
50
|
@launch_id
|
51
51
|
end
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
# Called to finish a launch. Any open children items will be closed in the process.
|
55
|
-
#
|
55
|
+
#
|
56
56
|
# @param clock [Integer] the millis from the epoch
|
57
57
|
def launch_finished(clock)
|
58
58
|
@tree.postordered_each do |node|
|
59
|
-
ParallelReportPortal.req_feature_finished(node.content, clock) unless node.is_root?
|
59
|
+
response = ParallelReportPortal.req_feature_finished(node.content, clock) unless node.is_root?
|
60
|
+
parse_report_link_from_response(response)
|
60
61
|
end
|
61
|
-
ParallelReportPortal.req_launch_finished(launch_id, clock)
|
62
|
+
response = ParallelReportPortal.req_launch_finished(launch_id, clock)
|
63
|
+
parse_report_link_from_response(response)
|
64
|
+
ParallelReportPortal.launch_finished_block.call if ParallelReportPortal.launch_finished_block
|
62
65
|
end
|
63
|
-
|
66
|
+
|
64
67
|
# Called to indicate that a feature has started.
|
65
|
-
#
|
66
|
-
# @param
|
68
|
+
#
|
69
|
+
# @param
|
67
70
|
def feature_started(feature, clock)
|
68
71
|
parent_id = hierarchy(feature, clock)
|
69
72
|
feature = feature.feature if using_cucumber_messages?
|
70
73
|
ParallelReportPortal.req_feature_started(launch_id, parent_id, feature, clock)
|
71
74
|
end
|
72
|
-
|
75
|
+
|
73
76
|
def feature_finished(clock)
|
74
77
|
if @feature
|
75
78
|
resp = ParallelReportPortal.req_feature_finished(@feature.id, clock)
|
76
79
|
end
|
77
80
|
end
|
78
|
-
|
81
|
+
|
79
82
|
def test_case_started(event, clock)
|
80
83
|
test_case = lookup_test_case(event.test_case)
|
81
84
|
feature = lookup_feature(event.test_case)
|
82
85
|
feature = current_feature(feature, clock)
|
83
86
|
@test_case_id = ParallelReportPortal.req_test_case_started(launch_id, feature.id, test_case, clock)
|
84
87
|
end
|
85
|
-
|
88
|
+
|
86
89
|
def test_case_finished(event, clock)
|
87
90
|
result = event.result
|
88
91
|
status = result.to_sym
|
@@ -93,7 +96,7 @@ module ParallelReportPortal
|
|
93
96
|
end
|
94
97
|
resp = ParallelReportPortal.req_test_case_finished(@test_case_id, status, clock)
|
95
98
|
end
|
96
|
-
|
99
|
+
|
97
100
|
def test_step_started(event, clock)
|
98
101
|
test_step = event.test_step
|
99
102
|
if !hook?(test_step)
|
@@ -104,11 +107,11 @@ module ParallelReportPortal
|
|
104
107
|
elsif (using_cucumber_messages? ? test_step : step_source).multiline_arg.data_table?
|
105
108
|
detail << (using_cucumber_messages? ? test_step : step_source).multiline_arg.raw.reduce("\n") {|acc, row| acc << "| #{row.join(' | ')} |\n"}
|
106
109
|
end
|
107
|
-
|
110
|
+
|
108
111
|
ParallelReportPortal.req_log(@test_case_id, detail, status_to_level(:trace), clock)
|
109
112
|
end
|
110
113
|
end
|
111
|
-
|
114
|
+
|
112
115
|
def test_step_finished(event, clock)
|
113
116
|
test_step = event.test_step
|
114
117
|
result = event.result
|
@@ -129,13 +132,13 @@ module ParallelReportPortal
|
|
129
132
|
ParallelReportPortal.req_log(@test_case_id, detail, status_to_level(status), clock) if detail
|
130
133
|
|
131
134
|
end
|
132
|
-
|
135
|
+
|
133
136
|
private
|
134
137
|
|
135
138
|
def using_cucumber_messages?
|
136
139
|
@ast_lookup != nil
|
137
140
|
end
|
138
|
-
|
141
|
+
|
139
142
|
def hierarchy(feature, clock)
|
140
143
|
node = nil
|
141
144
|
path_components = if using_cucumber_messages?
|
@@ -144,7 +147,7 @@ module ParallelReportPortal
|
|
144
147
|
feature.location.file.split(File::SEPARATOR)
|
145
148
|
end
|
146
149
|
ParallelReportPortal.file_open_exlock_and_block(ParallelReportPortal.hierarchy_file, 'a+b' ) do |file|
|
147
|
-
@tree = Marshal.load(File.read(file)) if file.size > 0
|
150
|
+
@tree = Marshal.load(File.read(file)) if file.size > 0
|
148
151
|
node = @tree.root
|
149
152
|
path_components[0..-2].each do |component|
|
150
153
|
next_node = node[component]
|
@@ -161,7 +164,7 @@ module ParallelReportPortal
|
|
161
164
|
file.write(Marshal.dump(@tree))
|
162
165
|
file.flush
|
163
166
|
end
|
164
|
-
|
167
|
+
|
165
168
|
node.content
|
166
169
|
end
|
167
170
|
|
@@ -193,7 +196,7 @@ module ParallelReportPortal
|
|
193
196
|
step.source.last
|
194
197
|
end
|
195
198
|
end
|
196
|
-
|
199
|
+
|
197
200
|
def current_feature(feature, clock)
|
198
201
|
if @feature&.feature == feature
|
199
202
|
@feature
|
@@ -202,7 +205,7 @@ module ParallelReportPortal
|
|
202
205
|
@feature = Feature.new(feature, feature_started(feature, clock))
|
203
206
|
end
|
204
207
|
end
|
205
|
-
|
208
|
+
|
206
209
|
def hook?(test_step)
|
207
210
|
if using_cucumber_messages?
|
208
211
|
test_step.hook?
|
@@ -210,7 +213,7 @@ module ParallelReportPortal
|
|
210
213
|
! test_step.source.last.respond_to?(:keyword)
|
211
214
|
end
|
212
215
|
end
|
213
|
-
|
216
|
+
|
214
217
|
def status_to_level(status)
|
215
218
|
case status
|
216
219
|
when :passed
|
@@ -223,8 +226,13 @@ module ParallelReportPortal
|
|
223
226
|
LOG_LEVELS.fetch(status, LOG_LEVELS[:info])
|
224
227
|
end
|
225
228
|
end
|
226
|
-
|
227
|
-
|
229
|
+
|
230
|
+
def parse_report_link_from_response(response)
|
231
|
+
if response
|
232
|
+
json = JSON.parse(response.body)
|
233
|
+
ParallelReportPortal.report_url = json['link'] if json['link']
|
234
|
+
end
|
235
|
+
end
|
228
236
|
end
|
229
237
|
end
|
230
238
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'parallel_report_portal/after_launch'
|
1
2
|
require "parallel_report_portal/clock"
|
2
3
|
require "parallel_report_portal/configuration"
|
3
4
|
require "parallel_report_portal/file_utils"
|
@@ -8,19 +9,20 @@ require 'parallel_tests'
|
|
8
9
|
module ParallelReportPortal
|
9
10
|
class Error < StandardError; end
|
10
11
|
|
12
|
+
extend ParallelReportPortal::AfterLaunch
|
11
13
|
extend ParallelReportPortal::HTTP
|
12
14
|
extend ParallelReportPortal::FileUtils
|
13
15
|
extend ParallelReportPortal::Clock
|
14
16
|
|
15
17
|
# Returns the configuration object, initializing it if necessary.
|
16
|
-
#
|
18
|
+
#
|
17
19
|
# @return [Configuration] the configuration object
|
18
20
|
def self.configuration
|
19
21
|
@configuration ||= Configuration.new
|
20
22
|
end
|
21
23
|
|
22
24
|
# Configures the Report Portal environment.
|
23
|
-
#
|
25
|
+
#
|
24
26
|
# @yieldparam [Configuration] config the configuration object yielded to the block
|
25
27
|
def self.configure(&block)
|
26
28
|
yield configuration
|
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.4.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:
|
12
|
+
date: 2023-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appraisal
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- gemfiles/cucumber_6.0.gemfile
|
206
206
|
- lib/parallel_report_portal.rb
|
207
207
|
- lib/parallel_report_portal/.DS_Store
|
208
|
+
- lib/parallel_report_portal/after_launch.rb
|
208
209
|
- lib/parallel_report_portal/clock.rb
|
209
210
|
- lib/parallel_report_portal/configuration.rb
|
210
211
|
- lib/parallel_report_portal/cucumber/formatter.rb
|