allure-ruby-commons 2.13.9 → 2.13.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/lib/allure-ruby-commons.rb +168 -154
- data/lib/allure_ruby_commons/allure_lifecycle.rb +11 -7
- data/lib/allure_ruby_commons/config.rb +16 -21
- data/lib/allure_ruby_commons/file_writer.rb +10 -1
- data/lib/allure_ruby_commons/model/executable_item.rb +11 -4
- data/lib/allure_ruby_commons/model/test_result.rb +22 -2
- data/lib/allure_ruby_commons/result_utils.rb +8 -10
- data/lib/allure_ruby_commons/testplan.rb +35 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90a3f2f601b17e454b3ebc66a64f99416b1fa8178a3813326841c371fe4378a8
|
4
|
+
data.tar.gz: e48bf8d67683fcc28d3570aeab4b0b90e97735a3406b7cf1eb43974ad9c6d9ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86fcbc6e43d0fca81c94e1c9674146977b64b59a683f8db367796b339ab9bb5bcd4a96f170f52d9ebea51ce8a6b63128acf971a3d23a95c00a9bd085b5770a11
|
7
|
+
data.tar.gz: 9332987147e528c111d96cf5bdca30fbaf57393c4a64acfbd039fe400033fb17127145cfad5aac5cbb149865220048d4e8a13227a701b1fa291e7b505ac52395
|
data/README.md
CHANGED
@@ -20,9 +20,12 @@ Following configuration options are supported:
|
|
20
20
|
|
21
21
|
```ruby
|
22
22
|
Allure.configure do |config|
|
23
|
-
config.results_directory = "/
|
23
|
+
config.results_directory = "report/allure-results"
|
24
24
|
config.clean_results_directory = true
|
25
25
|
config.logging_level = Logger::INFO
|
26
|
+
config.logger = Logger.new($stdout, Logger::DEBUG)
|
27
|
+
config.environment = "staging"
|
28
|
+
|
26
29
|
# these are used for creating links to bugs or test cases where {} is replaced with keys of relevant items
|
27
30
|
config.link_tms_pattern = "http://www.jira.com/browse/{}"
|
28
31
|
config.link_issue_pattern = "http://www.jira.com/browse/{}"
|
@@ -35,6 +38,13 @@ Getting the configuration object:
|
|
35
38
|
Allure.configuration
|
36
39
|
```
|
37
40
|
|
41
|
+
### Allure environment
|
42
|
+
|
43
|
+
It is possible to set up custom allure environment which will be used to prefix test case names. 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
|
+
|
45
|
+
* via `ALLURE_ENVIRONMENT` environment variable
|
46
|
+
* via `configure` method
|
47
|
+
|
38
48
|
### Log level
|
39
49
|
|
40
50
|
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
@@ -8,186 +8,200 @@ require_rel "allure_ruby_commons/**/*rb"
|
|
8
8
|
|
9
9
|
# Namespace for classes that handle allure report generation and different framework adaptors
|
10
10
|
module Allure
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
# Set lifecycle object
|
12
|
+
# @param [AllureLifecycle] lifecycle
|
13
|
+
# @return [void]
|
14
|
+
def self.lifecycle=(lifecycle)
|
15
|
+
Thread.current[:lifecycle] = lifecycle
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
# @param [AllureLifecycle] lifecycle
|
20
|
-
# @return [void]
|
21
|
-
def lifecycle=(lifecycle)
|
22
|
-
Thread.current[:lifecycle] = lifecycle
|
23
|
-
end
|
18
|
+
extend self # rubocop:disable Style/ModuleFunction
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
20
|
+
# Get thread specific allure lifecycle object
|
21
|
+
# @return [AllureLifecycle]
|
22
|
+
def lifecycle
|
23
|
+
Thread.current[:lifecycle] ||= AllureLifecycle.new
|
24
|
+
end
|
30
25
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
yield(configuration)
|
37
|
-
end
|
26
|
+
# Get allure configuration
|
27
|
+
# @return [Config]
|
28
|
+
def configuration
|
29
|
+
Config.instance
|
30
|
+
end
|
38
31
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
32
|
+
# Set allure configuration
|
33
|
+
# @yieldparam [Config]
|
34
|
+
# @yieldreturn [void]
|
35
|
+
# @return [void]
|
36
|
+
def configure
|
37
|
+
yield(configuration)
|
38
|
+
end
|
45
39
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
# Add epic to current test case
|
41
|
+
# @param [String] value
|
42
|
+
# @return [void]
|
43
|
+
def epic(value)
|
44
|
+
replace_label(ResultUtils::EPIC_LABEL_NAME, value)
|
45
|
+
end
|
52
46
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
47
|
+
# Add feature to current test case
|
48
|
+
# @param [String] value
|
49
|
+
# @return [void]
|
50
|
+
def feature(value)
|
51
|
+
replace_label(ResultUtils::FEATURE_LABEL_NAME, value)
|
52
|
+
end
|
59
53
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
54
|
+
# Add story to current test case
|
55
|
+
# @param [String] value
|
56
|
+
# @return [void]
|
57
|
+
def story(value)
|
58
|
+
replace_label(ResultUtils::STORY_LABEL_NAME, value)
|
59
|
+
end
|
66
60
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
61
|
+
# Add suite to current test case
|
62
|
+
# @param [String] value
|
63
|
+
# @return [void]
|
64
|
+
def suite(value)
|
65
|
+
replace_label(ResultUtils::SUITE_LABEL_NAME, value)
|
66
|
+
end
|
73
67
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
test_case.labels.push(Label.new(name, value))
|
81
|
-
end
|
82
|
-
end
|
68
|
+
# Add tag to current test case
|
69
|
+
# @param [String] value
|
70
|
+
# @return [void]
|
71
|
+
def tag(value)
|
72
|
+
label(ResultUtils::TAG_LABEL_NAME, value)
|
73
|
+
end
|
83
74
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
75
|
+
# Add label to current test case
|
76
|
+
# @param [String] name
|
77
|
+
# @param [String] value
|
78
|
+
# @return [void]
|
79
|
+
def label(name, value)
|
80
|
+
lifecycle.update_test_case do |test_case|
|
81
|
+
test_case.labels.push(Label.new(name, value))
|
91
82
|
end
|
83
|
+
end
|
92
84
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
85
|
+
# Replace label in current test case
|
86
|
+
#
|
87
|
+
# @param [String] name
|
88
|
+
# @param [String] value
|
89
|
+
# @return [void]
|
90
|
+
def replace_label(name, value)
|
91
|
+
lifecycle.update_test_case do |test_case|
|
92
|
+
present = test_case.labels.detect { |l| l.name == name }
|
93
|
+
return label(name, value) unless present
|
101
94
|
|
102
|
-
|
103
|
-
# @param [String] name
|
104
|
-
# @param [String] value
|
105
|
-
# @return [void]
|
106
|
-
def parameter(name, value)
|
107
|
-
lifecycle.update_test_case do |test_case|
|
108
|
-
test_case.parameters.push(Parameter.new(name, value))
|
109
|
-
end
|
95
|
+
test_case.labels.map! { |l| l.name == name ? Label.new(name, value) : l }
|
110
96
|
end
|
97
|
+
end
|
111
98
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
99
|
+
# Add description to current test case
|
100
|
+
# @param [String] description
|
101
|
+
# @return [void]
|
102
|
+
def add_description(description)
|
103
|
+
lifecycle.update_test_case do |test_case|
|
104
|
+
test_case.description = description
|
118
105
|
end
|
106
|
+
end
|
119
107
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
108
|
+
# Add html description to current test case
|
109
|
+
# @param [String] description_html
|
110
|
+
# @return [void]
|
111
|
+
def description_html(description_html)
|
112
|
+
lifecycle.update_test_case do |test_case|
|
113
|
+
test_case.description_html = description_html
|
126
114
|
end
|
115
|
+
end
|
127
116
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
test_case.links.push(Link.new(type, name || url, url))
|
136
|
-
end
|
117
|
+
# Add parameter to current test case
|
118
|
+
# @param [String] name
|
119
|
+
# @param [String] value
|
120
|
+
# @return [void]
|
121
|
+
def parameter(name, value)
|
122
|
+
lifecycle.update_test_case do |test_case|
|
123
|
+
test_case.parameters.push(Parameter.new(name, value))
|
137
124
|
end
|
125
|
+
end
|
138
126
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
lifecycle.add_attachment(name: name, source: source, type: type, test_case: test_case)
|
147
|
-
end
|
127
|
+
# Add tms link to current test case
|
128
|
+
# @param [String] name
|
129
|
+
# @param [String] url
|
130
|
+
# @return [void]
|
131
|
+
def tms(name, url)
|
132
|
+
add_link(name: name, url: url, type: ResultUtils::TMS_LINK_TYPE)
|
133
|
+
end
|
148
134
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
135
|
+
# Add issue linkt to current test case
|
136
|
+
# @param [String] name
|
137
|
+
# @param [String] url
|
138
|
+
# @return [void]
|
139
|
+
def issue(name, url)
|
140
|
+
add_link(name: name, url: url, type: ResultUtils::ISSUE_LINK_TYPE)
|
141
|
+
end
|
155
142
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
143
|
+
# Add link to current test case
|
144
|
+
# @param [String ] url
|
145
|
+
# @param [String] name
|
146
|
+
# @param [String] type type of the link used to display link icon
|
147
|
+
# @return [void]
|
148
|
+
def add_link(url:, name: nil, type: "custom")
|
149
|
+
lifecycle.update_test_case do |test_case|
|
150
|
+
test_case.links.push(Link.new(type, name || url, url))
|
161
151
|
end
|
152
|
+
end
|
162
153
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
154
|
+
# Add attachment to current test case or step
|
155
|
+
# @param [String] name Attachment name
|
156
|
+
# @param [File, String] source File or string to save as attachment
|
157
|
+
# @param [String] type attachment type defined in {ContentType} or any other valid mime type
|
158
|
+
# @param [Boolean] test_case add attachment to current test case instead of test step
|
159
|
+
# @return [void]
|
160
|
+
def add_attachment(name:, source:, type:, test_case: false)
|
161
|
+
lifecycle.add_attachment(name: name, source: source, type: type, test_case: test_case)
|
162
|
+
end
|
171
163
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
164
|
+
# Add allure report environment info
|
165
|
+
# @param [Hash<Symbol, String>] environment
|
166
|
+
# @return [void]
|
167
|
+
def add_environment(environment)
|
168
|
+
lifecycle.write_environment(environment)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Add categories info
|
172
|
+
# @param [File, Array<Category>] categories
|
173
|
+
# @return [void]
|
174
|
+
def add_categories(categories)
|
175
|
+
lifecycle.write_categories(categories)
|
176
|
+
end
|
177
|
+
|
178
|
+
# Add step with provided name and optional status to current test step, fixture or test case
|
179
|
+
# @param [String] name
|
180
|
+
# @param [Symbol] status {Status}, {Status::PASSED} by default
|
181
|
+
# @return [void]
|
182
|
+
def step(name:, status: nil)
|
183
|
+
lifecycle.add_test_step(StepResult.new(name: name, status: status || Status::PASSED, stage: Stage::FINISHED))
|
184
|
+
lifecycle.stop_test_step
|
185
|
+
end
|
186
|
+
|
187
|
+
# Run passed block as step with given name and return result of yield
|
188
|
+
# @param [String] name
|
189
|
+
# @yield [] step block
|
190
|
+
# @return [Object]
|
191
|
+
def run_step(name)
|
192
|
+
lifecycle.start_test_step(StepResult.new(name: name, stage: Stage::RUNNING))
|
193
|
+
result = yield
|
194
|
+
lifecycle.update_test_step { |step| step.status = Status::PASSED }
|
195
|
+
|
196
|
+
result
|
197
|
+
rescue StandardError => e
|
198
|
+
lifecycle.update_test_step do |step|
|
199
|
+
step.status = ResultUtils.status(e)
|
200
|
+
step.status_details = ResultUtils.status_details(e)
|
201
|
+
end
|
202
|
+
raise(e)
|
203
|
+
ensure
|
204
|
+
lifecycle.stop_test_step
|
191
205
|
end
|
192
206
|
end
|
193
207
|
# rubocop:enable Naming/FileName
|
@@ -8,13 +8,19 @@ module Allure
|
|
8
8
|
class AllureLifecycle # rubocop:disable Metrics/ClassLength
|
9
9
|
extend Forwardable
|
10
10
|
|
11
|
-
|
11
|
+
# Allure lifecycle instance
|
12
|
+
#
|
13
|
+
# @param [Allure::Config] configuration
|
14
|
+
def initialize(config = Config.instance)
|
12
15
|
@test_context = []
|
13
16
|
@step_context = []
|
14
|
-
@
|
15
|
-
@
|
17
|
+
@config = config
|
18
|
+
@logger = config.logger
|
19
|
+
@file_writer = FileWriter.new(config.results_directory)
|
16
20
|
end
|
17
21
|
|
22
|
+
attr_reader :config
|
23
|
+
|
18
24
|
def_delegators :file_writer, :write_attachment, :write_environment, :write_categories
|
19
25
|
|
20
26
|
# Start test result container
|
@@ -227,14 +233,12 @@ module Allure
|
|
227
233
|
# Clean results directory
|
228
234
|
# @return [void]
|
229
235
|
def clean_results_dir
|
230
|
-
|
231
|
-
FileUtils.rm_f(Dir.glob("#{c.results_directory}/**/*")) if c.clean_results_directory
|
232
|
-
end
|
236
|
+
FileUtils.rm_f(Dir.glob("#{config.results_directory}/**/*")) if config.clean_results_directory
|
233
237
|
end
|
234
238
|
|
235
239
|
private
|
236
240
|
|
237
|
-
|
241
|
+
attr_reader :logger, :file_writer
|
238
242
|
|
239
243
|
def current_executable
|
240
244
|
current_test_step || @current_fixture || @current_test_case
|
@@ -10,39 +10,34 @@ module Allure
|
|
10
10
|
|
11
11
|
# @return [Array<String>] valid log levels
|
12
12
|
LOGLEVELS = %w[DEBUG INFO WARN ERROR FATAL UNKNOWN].freeze
|
13
|
-
# @return [String] test plan path env var name
|
14
|
-
TESTPLAN_PATH = "ALLURE_TESTPLAN_PATH"
|
15
13
|
|
16
|
-
|
14
|
+
attr_writer :environment, :logger
|
15
|
+
|
16
|
+
attr_accessor :results_directory,
|
17
|
+
:logging_level,
|
18
|
+
:link_tms_pattern,
|
19
|
+
:link_issue_pattern,
|
20
|
+
:clean_results_directory
|
17
21
|
|
18
22
|
def initialize
|
19
23
|
@results_directory = "reports/allure-results"
|
20
24
|
@logging_level = LOGLEVELS.index(ENV.fetch("ALLURE_LOG_LEVEL", "INFO")) || Logger::INFO
|
21
25
|
end
|
22
26
|
|
23
|
-
# Allure
|
27
|
+
# Allure environment
|
24
28
|
#
|
25
|
-
# @return [
|
26
|
-
def
|
27
|
-
@
|
28
|
-
end
|
29
|
+
# @return [String]
|
30
|
+
def environment
|
31
|
+
return(@environment) if defined?(@environment)
|
29
32
|
|
30
|
-
|
31
|
-
#
|
32
|
-
# @return [Array]
|
33
|
-
def test_names
|
34
|
-
@test_names ||= tests&.map { |test| test[:selector] }
|
33
|
+
@environment ||= ENV["ALLURE_ENVIRONMENT"]
|
35
34
|
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
# Tests to execute from allure testplan.json
|
36
|
+
# Logger instance
|
40
37
|
#
|
41
|
-
# @return [
|
42
|
-
def
|
43
|
-
@
|
44
|
-
rescue Oj::ParseError
|
45
|
-
nil
|
38
|
+
# @return [Logger]
|
39
|
+
def logger
|
40
|
+
@logger ||= Logger.new($stdout, level: logging_level)
|
46
41
|
end
|
47
42
|
end
|
48
43
|
end
|
@@ -14,6 +14,13 @@ module Allure
|
|
14
14
|
# @return [String] categories definition json
|
15
15
|
CATEGORIES_FILE = "categories.json"
|
16
16
|
|
17
|
+
# File writer instance
|
18
|
+
#
|
19
|
+
# @param [String] results_directory
|
20
|
+
def initialize(results_directory)
|
21
|
+
@results_directory = results_directory
|
22
|
+
end
|
23
|
+
|
17
24
|
# Write test result
|
18
25
|
# @param [Allure::TestResult] test_result
|
19
26
|
# @return [void]
|
@@ -58,8 +65,10 @@ module Allure
|
|
58
65
|
|
59
66
|
private
|
60
67
|
|
68
|
+
attr_reader :results_directory
|
69
|
+
|
61
70
|
def output_dir
|
62
|
-
@output_dir ||= FileUtils.mkpath(
|
71
|
+
@output_dir ||= FileUtils.mkpath(results_directory).first
|
63
72
|
end
|
64
73
|
|
65
74
|
def write(name, source)
|
@@ -27,9 +27,16 @@ module Allure
|
|
27
27
|
@parameters = options[:parameters] || []
|
28
28
|
end
|
29
29
|
|
30
|
-
attr_accessor
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
attr_accessor :name,
|
31
|
+
:status,
|
32
|
+
:status_details,
|
33
|
+
:stage,
|
34
|
+
:description,
|
35
|
+
:description_html,
|
36
|
+
:steps,
|
37
|
+
:attachments,
|
38
|
+
:parameters,
|
39
|
+
:start,
|
40
|
+
:stop
|
34
41
|
end
|
35
42
|
end
|
@@ -5,6 +5,7 @@ module Allure
|
|
5
5
|
class TestResult < ExecutableItem
|
6
6
|
# @param [String] uuid
|
7
7
|
# @param [String] history_id
|
8
|
+
# @param [String] environment
|
8
9
|
# @param [Hash] options
|
9
10
|
# @option options [String] :name
|
10
11
|
# @option options [String] :full_name
|
@@ -18,8 +19,10 @@ module Allure
|
|
18
19
|
# @option options [Array<Allure::Link>] :links ([])
|
19
20
|
# @option options [Array<Allure::Attachment>] :attachments ([])
|
20
21
|
# @option options [Array<Allure::Parameter>] :parameters ([])
|
21
|
-
def initialize(uuid: UUID.generate, history_id: UUID.generate, **options)
|
22
|
+
def initialize(uuid: UUID.generate, history_id: UUID.generate, environment: nil, **options)
|
22
23
|
super
|
24
|
+
|
25
|
+
@name = test_name(options[:name], environment)
|
23
26
|
@uuid = uuid
|
24
27
|
@history_id = history_id
|
25
28
|
@full_name = options[:full_name] || "Unnamed"
|
@@ -27,6 +30,23 @@ module Allure
|
|
27
30
|
@links = options[:links] || []
|
28
31
|
end
|
29
32
|
|
30
|
-
attr_accessor :uuid,
|
33
|
+
attr_accessor :uuid,
|
34
|
+
:history_id,
|
35
|
+
:full_name,
|
36
|
+
:labels,
|
37
|
+
:links
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# Test name prefixed with allure environment
|
42
|
+
#
|
43
|
+
# @param [String] name
|
44
|
+
# @param [String] environment
|
45
|
+
# @return [String]
|
46
|
+
def test_name(name, environment)
|
47
|
+
return name unless environment
|
48
|
+
|
49
|
+
"#{environment}: #{name}"
|
50
|
+
end
|
31
51
|
end
|
32
52
|
end
|
@@ -131,16 +131,18 @@ module Allure
|
|
131
131
|
|
132
132
|
# TMS link
|
133
133
|
# @param [String] value
|
134
|
+
# @param [String] link_pattern
|
134
135
|
# @return [Allure::Link]
|
135
|
-
def tms_link(value)
|
136
|
-
Link.new(TMS_LINK_TYPE, value,
|
136
|
+
def tms_link(value, link_pattern)
|
137
|
+
Link.new(TMS_LINK_TYPE, value, url(value, link_pattern))
|
137
138
|
end
|
138
139
|
|
139
140
|
# Issue link
|
140
141
|
# @param [String] value
|
142
|
+
# @param [String] link_pattern
|
141
143
|
# @return [Allure::Link]
|
142
|
-
def issue_link(value)
|
143
|
-
Link.new(ISSUE_LINK_TYPE, value,
|
144
|
+
def issue_link(value, link_pattern)
|
145
|
+
Link.new(ISSUE_LINK_TYPE, value, url(value, link_pattern))
|
144
146
|
end
|
145
147
|
|
146
148
|
# Get status based on exception type
|
@@ -169,12 +171,8 @@ module Allure
|
|
169
171
|
|
170
172
|
private
|
171
173
|
|
172
|
-
def
|
173
|
-
|
174
|
-
end
|
175
|
-
|
176
|
-
def issue_url(value)
|
177
|
-
Allure.configuration.link_issue_pattern.sub("{}", value)
|
174
|
+
def url(value, link_pattern)
|
175
|
+
link_pattern.sub("{}", value)
|
178
176
|
end
|
179
177
|
end
|
180
178
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Allure
|
4
|
+
class TestPlan
|
5
|
+
# @return [String] test plan path env var name
|
6
|
+
TESTPLAN_PATH = "ALLURE_TESTPLAN_PATH"
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# Allure id's of executable tests
|
10
|
+
#
|
11
|
+
# @return [Array]
|
12
|
+
def test_ids
|
13
|
+
@test_ids ||= tests&.map { |test| test[:id] }
|
14
|
+
end
|
15
|
+
|
16
|
+
# Test names of executable tests
|
17
|
+
#
|
18
|
+
# @return [Array]
|
19
|
+
def test_names
|
20
|
+
@test_names ||= tests&.map { |test| test[:selector] }
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# Tests to execute from allure testplan.json
|
26
|
+
#
|
27
|
+
# @return [Array<Hash>]
|
28
|
+
def tests
|
29
|
+
@tests ||= Oj.load_file(ENV[TESTPLAN_PATH], symbol_keys: true)&.fetch(:tests) if ENV[TESTPLAN_PATH]
|
30
|
+
rescue Oj::ParseError
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
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.13.
|
4
|
+
version: 2.13.10
|
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-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/allure_ruby_commons/model/test_result_container.rb
|
120
120
|
- lib/allure_ruby_commons/result_utils.rb
|
121
121
|
- lib/allure_ruby_commons/step_annotation.rb
|
122
|
+
- lib/allure_ruby_commons/testplan.rb
|
122
123
|
homepage: https://github.com/allure-framework/allure-ruby
|
123
124
|
licenses:
|
124
125
|
- Apache-2.0
|