allure-ruby-commons 2.21.1 → 2.22.0
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/lib/allure_ruby_commons/_json_helper.rb +2 -0
- data/lib/allure_ruby_commons/model/01_jsonable.rb +11 -4
- data/lib/allure_ruby_commons/model/category.rb +2 -0
- data/lib/allure_ruby_commons/model/test_result.rb +19 -2
- data/lib/allure_ruby_commons/model/test_result_container.rb +10 -1
- data/lib/allure_ruby_commons/testplan.rb +19 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '099ba3dddaa422aadd6805174b9ea6355be15b89b0587baf39d379dfda0763ad'
|
4
|
+
data.tar.gz: 066eb591f740c700e09f712b86b83c28bac6fd903321d8643426872a0ba61bbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f36b3ecdc794f0ddb952e125a9cd55600763478038dd7634ff40e7131f75f246a726bf189871f6581a4a051b5c095b605ffcc464389dcb8538eed5bcdf3cf5
|
7
|
+
data.tar.gz: 94efb6010db9cbca76f4136567a6c4330108ec6b2d140f36d007dcb5c64ae53fd5ed4dd05cb7184119af04d894f4eea1f5da78238bf7377c823e947d614edd56
|
@@ -28,6 +28,7 @@ module Allure
|
|
28
28
|
define_method(:load_json) do |json|
|
29
29
|
Oj.load_file(json, symbol_keys: true)
|
30
30
|
rescue Oj::ParseError
|
31
|
+
Allure.configuration.logger.error("Failed to parse json: #{json}")
|
31
32
|
nil
|
32
33
|
end
|
33
34
|
rescue LoadError
|
@@ -40,6 +41,7 @@ module Allure
|
|
40
41
|
define_method(:load_json) do |json|
|
41
42
|
JSON.parse(File.read(json), symbolize_names: true)
|
42
43
|
rescue JSON::ParserError
|
44
|
+
Allure.configuration.logger.error("Failed to parse json: #{json}")
|
43
45
|
nil
|
44
46
|
end
|
45
47
|
end
|
@@ -6,9 +6,9 @@ module Allure
|
|
6
6
|
# Return object hash represantation
|
7
7
|
# @return [Hash]
|
8
8
|
def to_hash
|
9
|
-
|
10
|
-
key = camelcase(
|
11
|
-
value =
|
9
|
+
json_attributes.each_with_object({}) do |attribute, map|
|
10
|
+
key = camelcase(attribute)
|
11
|
+
value = send(attribute) # fetch via reader for dynamically generated attributes
|
12
12
|
map[key] = value unless value.nil?
|
13
13
|
end
|
14
14
|
end
|
@@ -33,7 +33,7 @@ module Allure
|
|
33
33
|
# Object state
|
34
34
|
# @return [Array]
|
35
35
|
def state
|
36
|
-
|
36
|
+
json_attributes.map { |attribute| send(attribute) }
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
@@ -45,5 +45,12 @@ module Allure
|
|
45
45
|
str = str.gsub(/(?:_+)([a-z])/) { Regexp.last_match(1).upcase }
|
46
46
|
str.gsub(/(\A|\s)([A-Z])/) { Regexp.last_match(1) + Regexp.last_match(2).downcase }
|
47
47
|
end
|
48
|
+
|
49
|
+
# Json attribute names
|
50
|
+
#
|
51
|
+
# @return [Array<String>]
|
52
|
+
def json_attributes
|
53
|
+
@json_attributes ||= instance_variables.map { |attribute| attribute.to_s.delete_prefix("@") }
|
54
|
+
end
|
48
55
|
end
|
49
56
|
end
|
@@ -24,7 +24,7 @@ module Allure
|
|
24
24
|
|
25
25
|
@name = options[:name]
|
26
26
|
@uuid = uuid
|
27
|
-
@history_id =
|
27
|
+
@history_id = history_id
|
28
28
|
@full_name = options[:full_name] || "Unnamed"
|
29
29
|
@labels = options[:labels] || []
|
30
30
|
@links = options[:links] || []
|
@@ -32,9 +32,26 @@ module Allure
|
|
32
32
|
end
|
33
33
|
|
34
34
|
attr_accessor :uuid,
|
35
|
-
:history_id,
|
36
35
|
:full_name,
|
37
36
|
:labels,
|
38
37
|
:links
|
38
|
+
|
39
|
+
attr_writer :history_id
|
40
|
+
|
41
|
+
# History id
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
def history_id
|
45
|
+
Digest::MD5.hexdigest("#{@history_id}#{parameters_string}")
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
# All parameters string
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
def parameters_string
|
54
|
+
parameters.map { |p| "#{p.name}=#{p.value}" }.join(";")
|
55
|
+
end
|
39
56
|
end
|
40
57
|
end
|
@@ -14,6 +14,15 @@ module Allure
|
|
14
14
|
@links = []
|
15
15
|
end
|
16
16
|
|
17
|
-
attr_accessor :uuid,
|
17
|
+
attr_accessor :uuid,
|
18
|
+
:name,
|
19
|
+
:description,
|
20
|
+
:description_html,
|
21
|
+
:start,
|
22
|
+
:stop,
|
23
|
+
:children,
|
24
|
+
:befores,
|
25
|
+
:afters,
|
26
|
+
:links
|
18
27
|
end
|
19
28
|
end
|
@@ -28,7 +28,25 @@ module Allure
|
|
28
28
|
#
|
29
29
|
# @return [Array<Hash>]
|
30
30
|
def tests
|
31
|
-
@tests ||= load_json(
|
31
|
+
@tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path
|
32
|
+
end
|
33
|
+
|
34
|
+
# Fetch test plan path
|
35
|
+
#
|
36
|
+
# @return [<String, nil>]
|
37
|
+
def test_plan_path
|
38
|
+
return @test_plan_path if defined?(@test_plan_path)
|
39
|
+
|
40
|
+
@test_plan_path = ENV[TESTPLAN_PATH].then do |path|
|
41
|
+
next unless path
|
42
|
+
next path if File.file?(path)
|
43
|
+
|
44
|
+
json = File.join(path, "testplan.json")
|
45
|
+
next json if File.exist?(json)
|
46
|
+
|
47
|
+
Allure.configuration.logger.warn("'ALLURE_TESTPLAN_PATH' env var is set, but no testplan.json found!")
|
48
|
+
nil
|
49
|
+
end
|
32
50
|
end
|
33
51
|
end
|
34
52
|
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.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -133,14 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
133
|
requirements:
|
134
134
|
- - ">="
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version:
|
136
|
+
version: 3.0.0
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
requirements:
|
139
139
|
- - ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.4.10
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Common library for allure results generation
|