allure-ruby-commons 2.14.1 → 2.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/lib/allure-ruby-commons.rb +6 -2
- data/lib/allure_ruby_commons/allure_lifecycle.rb +21 -1
- data/lib/allure_ruby_commons/config.rb +3 -1
- data/lib/allure_ruby_commons/result_utils.rb +20 -4
- 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: 35b9aec57c1f8d285f55f1463266c70daec925400f3880ddf6cacd2b237eb120
|
4
|
+
data.tar.gz: 5fe9f0fcef4d39ed38cec526856712948f77c72529e13fe342e507ffcdf2ad2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0d038d11530965ea7cc37135496fe4e0071a8fb8f975d9bad3be724e5c04b9b88ae6027a2cd6a2ed227e499742e2ec35cb63e87062bbcec0696b6def3609ed8
|
7
|
+
data.tar.gz: 7a9dca1b51f2d0948aec73ef6749a289a8ef6be9831dcca3ba80292defedb42c58ad47e2cfce8b810bf2845ea0e02963bb5b9135bb29b422e9b854b9385b5dab
|
data/README.md
CHANGED
@@ -29,6 +29,14 @@ Following configuration options are supported:
|
|
29
29
|
# these are used for creating links to bugs or test cases where {} is replaced with keys of relevant items
|
30
30
|
config.link_tms_pattern = "http://www.jira.com/browse/{}"
|
31
31
|
config.link_issue_pattern = "http://www.jira.com/browse/{}"
|
32
|
+
|
33
|
+
# additional metadata
|
34
|
+
# environment.properties
|
35
|
+
config.environment_properties = {
|
36
|
+
custom_attribute: "foo"
|
37
|
+
}
|
38
|
+
# categories.json
|
39
|
+
config.categories = File.new("my_custom_categories.json")
|
32
40
|
end
|
33
41
|
```
|
34
42
|
|
@@ -38,9 +46,9 @@ Getting the configuration object:
|
|
38
46
|
Allure.configuration
|
39
47
|
```
|
40
48
|
|
41
|
-
### Allure environment
|
49
|
+
### Allure execution environment
|
42
50
|
|
43
|
-
It is possible to set up custom allure environment which will be used
|
51
|
+
It is possible to set up custom allure environment which will be used as custom parameter `environment` in every test case. This is useful if you run same tests on different environments and generate single report. This way different runs are not put as retry. Environment can be configured in following ways:
|
44
52
|
|
45
53
|
* via `ALLURE_ENVIRONMENT` environment variable
|
46
54
|
* via `configure` method
|
data/lib/allure-ruby-commons.rb
CHANGED
@@ -161,14 +161,18 @@ module Allure
|
|
161
161
|
lifecycle.add_attachment(name: name, source: source, type: type, test_case: test_case)
|
162
162
|
end
|
163
163
|
|
164
|
-
#
|
164
|
+
# Manually create environment.properties file
|
165
|
+
# if this method is called before test run started and
|
166
|
+
# option clean_results_directory is enabled, the file will be deleted
|
165
167
|
# @param [Hash<Symbol, String>] environment
|
166
168
|
# @return [void]
|
167
169
|
def add_environment(environment)
|
168
170
|
lifecycle.write_environment(environment)
|
169
171
|
end
|
170
172
|
|
171
|
-
#
|
173
|
+
# Manually create categories.json file
|
174
|
+
# if this method is called before test run started and
|
175
|
+
# option clean_results_directory is enabled, the file will be deleted
|
172
176
|
# @param [File, Array<Category>] categories
|
173
177
|
# @return [void]
|
174
178
|
def add_categories(categories)
|
@@ -21,7 +21,7 @@ module Allure
|
|
21
21
|
|
22
22
|
attr_reader :config
|
23
23
|
|
24
|
-
def_delegators :file_writer, :write_attachment
|
24
|
+
def_delegators :file_writer, :write_attachment
|
25
25
|
|
26
26
|
# Start test result container
|
27
27
|
# @param [Allure::TestResultContainer] test_result_container
|
@@ -221,6 +221,26 @@ module Allure
|
|
221
221
|
write_attachment(source, attachment)
|
222
222
|
end
|
223
223
|
|
224
|
+
# Add environment.properties file
|
225
|
+
#
|
226
|
+
# @param [Hash] env
|
227
|
+
# @return [void]
|
228
|
+
def write_environment(env = config.environment_properties)
|
229
|
+
return unless env
|
230
|
+
|
231
|
+
file_writer.write_environment(env)
|
232
|
+
end
|
233
|
+
|
234
|
+
# Add categories.json
|
235
|
+
#
|
236
|
+
# @param [File, Array<Category>] categories
|
237
|
+
# @return [void]
|
238
|
+
def write_categories(categories = config.categories)
|
239
|
+
return unless categories
|
240
|
+
|
241
|
+
file_writer.write_categories(categories)
|
242
|
+
end
|
243
|
+
|
224
244
|
# Add step to current fixture|step|test case
|
225
245
|
# @param [Allure::StepResult] step_result
|
226
246
|
# @return [Allure::StepResult]
|
@@ -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.14.
|
4
|
+
version: 2.14.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
|
-
rubygems_version: 3.2.
|
147
|
+
rubygems_version: 3.2.22
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Common library for allure results generation
|