allure-ruby-commons 2.14.4 → 2.16.1
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 +4 -4
- data/README.md +16 -0
- data/lib/allure-ruby-commons.rb +38 -1
- data/lib/allure_ruby_commons/allure_lifecycle.rb +3 -2
- data/lib/allure_ruby_commons/file_writer.rb +1 -1
- data/lib/allure_ruby_commons/model/executable_item.rb +2 -0
- data/lib/allure_ruby_commons/model/test_result.rb +2 -16
- data/lib/allure_ruby_commons/result_utils.rb +20 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cf416a1b141ec4f00e39b29bcaed9b698b8d9a395a91766b85219223757528b
|
4
|
+
data.tar.gz: c6eb8f3e99d8751540623c3d55d05415d17df998ba1066aab5d59ed0a2737227
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8edf4da0ff21aba5875d1ec318990b1806d6dc0153b71b84b6f1523874c4a68938cea9cb89931c94d61d77d4b72853075bc5649c46e4c580a25f56da478558db
|
7
|
+
data.tar.gz: 6ebb50bdd7de43c2d0e46e2c4d6886be2bbc10b0d8745da55554b88598bfdfa9aa50f981b1118f9a2a70db0cc8b7682e26c884e7b43efa6651b44143203d11fd
|
data/README.md
CHANGED
@@ -53,6 +53,22 @@ It is possible to set up custom allure environment which will be used as custom
|
|
53
53
|
* via `ALLURE_ENVIRONMENT` environment variable
|
54
54
|
* via `configure` method
|
55
55
|
|
56
|
+
### Environment properties
|
57
|
+
|
58
|
+
To add additional environment information to the report it is possible to set configuration property `environment_properties`.
|
59
|
+
|
60
|
+
Option can be set to hash or block returning a hash:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
# hash
|
64
|
+
config.environment_properties = {
|
65
|
+
custom_attribute: "foo"
|
66
|
+
}
|
67
|
+
|
68
|
+
# lambda
|
69
|
+
config.environment_properties = -> { { custom_attributes: "foo"} }
|
70
|
+
```
|
71
|
+
|
56
72
|
### Log level
|
57
73
|
|
58
74
|
Log level can be also configured via environment variable `ALLURE_LOG_LEVEL` which accepts one of the following values: `DEBUG INFO WARN ERROR FATAL UNKNOWN`.
|
data/lib/allure-ruby-commons.rb
CHANGED
@@ -164,7 +164,7 @@ module Allure
|
|
164
164
|
# Manually create environment.properties file
|
165
165
|
# if this method is called before test run started and
|
166
166
|
# option clean_results_directory is enabled, the file will be deleted
|
167
|
-
# @param [Hash<Symbol, String
|
167
|
+
# @param [Hash<Symbol, String>, Proc] environment
|
168
168
|
# @return [void]
|
169
169
|
def add_environment(environment)
|
170
170
|
lifecycle.write_environment(environment)
|
@@ -179,6 +179,33 @@ module Allure
|
|
179
179
|
lifecycle.write_categories(categories)
|
180
180
|
end
|
181
181
|
|
182
|
+
# Set test case status detail to flaky
|
183
|
+
#
|
184
|
+
# @return [void]
|
185
|
+
def set_flaky
|
186
|
+
lifecycle.update_test_case do |test_case|
|
187
|
+
test_case.status_details.flaky = true
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Set test case status detail to muted
|
192
|
+
#
|
193
|
+
# @return [void]
|
194
|
+
def set_muted
|
195
|
+
lifecycle.update_test_case do |test_case|
|
196
|
+
test_case.status_details.muted = true
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Set test case status detail to known
|
201
|
+
#
|
202
|
+
# @return [void]
|
203
|
+
def set_known
|
204
|
+
lifecycle.update_test_case do |test_case|
|
205
|
+
test_case.status_details.known = true
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
182
209
|
# Add step with provided name and optional status to current test step, fixture or test case
|
183
210
|
# @param [String] name
|
184
211
|
# @param [Symbol] status {Status}, {Status::PASSED} by default
|
@@ -207,5 +234,15 @@ module Allure
|
|
207
234
|
ensure
|
208
235
|
lifecycle.stop_test_step
|
209
236
|
end
|
237
|
+
|
238
|
+
# Add parameter to current test step
|
239
|
+
# @param [String] name
|
240
|
+
# @param [String] value
|
241
|
+
# @return [void]
|
242
|
+
def step_parameter(name, value)
|
243
|
+
lifecycle.update_test_step do |step|
|
244
|
+
step.parameters.push(Parameter.new(name, value))
|
245
|
+
end
|
246
|
+
end
|
210
247
|
end
|
211
248
|
# rubocop:enable Naming/FileName
|
@@ -223,12 +223,13 @@ module Allure
|
|
223
223
|
|
224
224
|
# Add environment.properties file
|
225
225
|
#
|
226
|
-
# @param [Hash] env
|
226
|
+
# @param [Hash, Proc] env
|
227
227
|
# @return [void]
|
228
228
|
def write_environment(env = config.environment_properties)
|
229
229
|
return unless env
|
230
230
|
|
231
|
-
|
231
|
+
env_properties = env.respond_to?(:call) ? env.call : env
|
232
|
+
file_writer.write_environment(env_properties)
|
232
233
|
end
|
233
234
|
|
234
235
|
# Add categories.json
|
@@ -24,6 +24,7 @@ module Allure
|
|
24
24
|
@stage = options[:stage] || Stage::SCHEDULED
|
25
25
|
@steps = options[:steps] || []
|
26
26
|
@attachments = options[:attachments] || []
|
27
|
+
@parameters = options[:parameters] || []
|
27
28
|
end
|
28
29
|
|
29
30
|
attr_accessor :name,
|
@@ -34,6 +35,7 @@ module Allure
|
|
34
35
|
:description_html,
|
35
36
|
:steps,
|
36
37
|
:attachments,
|
38
|
+
:parameters,
|
37
39
|
:start,
|
38
40
|
:stop
|
39
41
|
end
|
@@ -28,27 +28,13 @@ module Allure
|
|
28
28
|
@full_name = options[:full_name] || "Unnamed"
|
29
29
|
@labels = options[:labels] || []
|
30
30
|
@links = options[:links] || []
|
31
|
-
@parameters
|
31
|
+
@parameters << Parameter.new("environment", environment) if environment
|
32
32
|
end
|
33
33
|
|
34
34
|
attr_accessor :uuid,
|
35
35
|
:history_id,
|
36
36
|
:full_name,
|
37
37
|
:labels,
|
38
|
-
:links
|
39
|
-
:parameters
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
# Test name prefixed with allure environment
|
44
|
-
#
|
45
|
-
# @param [Array] parameters
|
46
|
-
# @param [String] environment
|
47
|
-
# @return [Array]
|
48
|
-
def updated_parameters(parameters, environment)
|
49
|
-
return parameters unless environment
|
50
|
-
|
51
|
-
parameters << Parameter.new("environment", environment)
|
52
|
-
end
|
38
|
+
:links
|
53
39
|
end
|
54
40
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "socket"
|
4
|
+
require "uri"
|
4
5
|
|
5
6
|
module Allure
|
6
7
|
# Variouse helper methods
|
@@ -133,16 +134,18 @@ module Allure
|
|
133
134
|
# @param [String] value
|
134
135
|
# @param [String] link_pattern
|
135
136
|
# @return [Allure::Link]
|
136
|
-
def tms_link(value, link_pattern)
|
137
|
-
|
137
|
+
def tms_link(name, value, link_pattern)
|
138
|
+
link_name = url?(value) ? name : value
|
139
|
+
Link.new(TMS_LINK_TYPE, link_name, url(value, link_pattern))
|
138
140
|
end
|
139
141
|
|
140
142
|
# Issue link
|
141
143
|
# @param [String] value
|
142
144
|
# @param [String] link_pattern
|
143
145
|
# @return [Allure::Link]
|
144
|
-
def issue_link(value, link_pattern)
|
145
|
-
|
146
|
+
def issue_link(name, value, link_pattern)
|
147
|
+
link_name = url?(value) ? name : value
|
148
|
+
Link.new(ISSUE_LINK_TYPE, link_name, url(value, link_pattern))
|
146
149
|
end
|
147
150
|
|
148
151
|
# Get status based on exception type
|
@@ -171,6 +174,19 @@ module Allure
|
|
171
174
|
|
172
175
|
private
|
173
176
|
|
177
|
+
# Check if value is full url
|
178
|
+
#
|
179
|
+
# @param [String] value
|
180
|
+
# @return [Boolean]
|
181
|
+
def url?(value)
|
182
|
+
URI.parse(value.to_s).scheme
|
183
|
+
end
|
184
|
+
|
185
|
+
# Construct url from pattern
|
186
|
+
#
|
187
|
+
# @param [String] value
|
188
|
+
# @param [String] link_pattern
|
189
|
+
# @return [String]
|
174
190
|
def url(value, link_pattern)
|
175
191
|
link_pattern.sub("{}", value)
|
176
192
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-ruby-commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -129,6 +129,7 @@ metadata:
|
|
129
129
|
documentation_uri: https://github.com/allure-framework/allure-ruby/blob/master/allure-ruby-commons/README.md
|
130
130
|
source_code_uri: https://github.com/allure-framework/allure-ruby/tree/master/allure-ruby-commons
|
131
131
|
wiki_uri: https://github.com/allure-framework/allure-ruby/wiki
|
132
|
+
rubygems_mfa_required: 'false'
|
132
133
|
post_install_message:
|
133
134
|
rdoc_options: []
|
134
135
|
require_paths:
|
@@ -144,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
145
|
- !ruby/object:Gem::Version
|
145
146
|
version: '0'
|
146
147
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.3.3
|
148
149
|
signing_key:
|
149
150
|
specification_version: 4
|
150
151
|
summary: Common library for allure results generation
|