allure-rspec 2.28.0 → 2.30.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 +9 -0
- data/lib/allure_rspec/formatter.rb +18 -2
- data/lib/allure_rspec/metadata_parser.rb +6 -0
- data/lib/allure_rspec/suite_labels.rb +14 -3
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df0af1190d0aad2d3560fc424d332c6885a94cb951a76186134e17f881bec54c
|
|
4
|
+
data.tar.gz: 4d47410b77295618c92416d154744c4f4c0e75449bdb386fb6e05111bce38c60
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f380699ea5810bd6b8248c5ffed1db0cfd4bc1263fc4ba31ca10451a1d7a5da7e6191093796de1c241cfb1bbf6631da97b34e3dc567542825023248b802db28
|
|
7
|
+
data.tar.gz: 6546a3ff10044dfb8841f132d677071eb538ea14f0b7306be12d5c11d6dca6a85a972ae6179ac20d6a3803198f75204d011421e09453aef12f5c354575b54c21
|
data/README.md
CHANGED
|
@@ -30,6 +30,12 @@ AllureRspec.configure do |config|
|
|
|
30
30
|
config.logger = Logger.new($stdout, Logger::DEBUG)
|
|
31
31
|
config.environment = "staging"
|
|
32
32
|
|
|
33
|
+
# labels added to every test result
|
|
34
|
+
config.global_labels = [
|
|
35
|
+
{ name: "owner", value: "qa" },
|
|
36
|
+
{ name: "tag", value: "global" }
|
|
37
|
+
]
|
|
38
|
+
|
|
33
39
|
# these are used for creating links to bugs or test cases where {} is replaced with keys of relevant items
|
|
34
40
|
config.link_tms_pattern = "http://www.jira.com/browse/{}"
|
|
35
41
|
config.link_issue_pattern = "http://www.jira.com/browse/{}"
|
|
@@ -44,6 +50,9 @@ AllureRspec.configure do |config|
|
|
|
44
50
|
end
|
|
45
51
|
```
|
|
46
52
|
|
|
53
|
+
`global_labels` defaults to `[]`. Each entry is a hash with symbol keys `:name` and `:value`.
|
|
54
|
+
Labels are prepended to every completed test's labels without replacing test-specific labels, including those with the same name.
|
|
55
|
+
|
|
47
56
|
## Usage
|
|
48
57
|
|
|
49
58
|
Via commandline arguments, simply add:
|
|
@@ -15,6 +15,8 @@ module AllureRspec
|
|
|
15
15
|
pending: Allure::Status::SKIPPED,
|
|
16
16
|
passed: Allure::Status::PASSED
|
|
17
17
|
}.freeze
|
|
18
|
+
ANSI_ESCAPE_PATTERN = /\e\[(\d+)(?:;\d+)*m/
|
|
19
|
+
SUITE_HOOK_FAILURE_PATTERN = /\AAn error occurred in an? `(?:before|after)\(:suite\)` hook\.\z/
|
|
18
20
|
|
|
19
21
|
RSpec::Core::Formatters.register(
|
|
20
22
|
self,
|
|
@@ -23,7 +25,8 @@ module AllureRspec
|
|
|
23
25
|
:example_group_started,
|
|
24
26
|
:example_group_finished,
|
|
25
27
|
:example_started,
|
|
26
|
-
:example_finished
|
|
28
|
+
:example_finished,
|
|
29
|
+
:message
|
|
27
30
|
)
|
|
28
31
|
|
|
29
32
|
RSpec.configure do |config|
|
|
@@ -58,6 +61,7 @@ module AllureRspec
|
|
|
58
61
|
# @return [void]
|
|
59
62
|
def stop(_stop_notification)
|
|
60
63
|
lifecycle.write_environment
|
|
64
|
+
lifecycle.write_globals
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
# Starts example group
|
|
@@ -92,6 +96,17 @@ module AllureRspec
|
|
|
92
96
|
lifecycle.stop_test_container
|
|
93
97
|
end
|
|
94
98
|
|
|
99
|
+
# Capture errors raised by before(:suite) and after(:suite) hooks
|
|
100
|
+
# @param [RSpec::Core::Notifications::MessageNotification] notification
|
|
101
|
+
# @return [void]
|
|
102
|
+
def message(notification)
|
|
103
|
+
formatted_error = notification.message.to_s.gsub(ANSI_ESCAPE_PATTERN, "").strip
|
|
104
|
+
first_line = formatted_error.lines.first&.chomp
|
|
105
|
+
return unless SUITE_HOOK_FAILURE_PATTERN.match?(first_line.to_s)
|
|
106
|
+
|
|
107
|
+
lifecycle.add_global_error(message: first_line, trace: formatted_error)
|
|
108
|
+
end
|
|
109
|
+
|
|
95
110
|
private
|
|
96
111
|
|
|
97
112
|
attr_reader :lifecycle, :allure_config
|
|
@@ -108,6 +123,7 @@ module AllureRspec
|
|
|
108
123
|
description_html: "Location - #{strip_relative(parser.location)}",
|
|
109
124
|
history_id: example.id,
|
|
110
125
|
full_name: example.full_description,
|
|
126
|
+
title_path: parser.title_path,
|
|
111
127
|
labels: parser.labels,
|
|
112
128
|
links: parser.links,
|
|
113
129
|
status_details: parser.status_details,
|
|
@@ -124,7 +140,7 @@ module AllureRspec
|
|
|
124
140
|
test_case.stage = Allure::Stage::FINISHED
|
|
125
141
|
test_case.status = status(result)
|
|
126
142
|
test_case.status_details.message = status_detail.message
|
|
127
|
-
test_case.status_details.trace = status_detail.trace&.gsub(
|
|
143
|
+
test_case.status_details.trace = status_detail.trace&.gsub(ANSI_ESCAPE_PATTERN, "")
|
|
128
144
|
end
|
|
129
145
|
end
|
|
130
146
|
end
|
|
@@ -67,6 +67,12 @@ module AllureRspec
|
|
|
67
67
|
)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
# Title path without the final example display name.
|
|
71
|
+
# @return [Array<String>]
|
|
72
|
+
def title_path
|
|
73
|
+
[strip_relative(example.file_path), *SuiteLabels.new(example.example_group).title_path]
|
|
74
|
+
end
|
|
75
|
+
|
|
70
76
|
# Example location
|
|
71
77
|
#
|
|
72
78
|
# @return [String]
|
|
@@ -13,9 +13,7 @@ module AllureRspec
|
|
|
13
13
|
# Get test suite labels
|
|
14
14
|
# @return [Array<Allure::Label>]
|
|
15
15
|
def fetch
|
|
16
|
-
parents =
|
|
17
|
-
group.description.empty? ? "Anonymous" : group.description
|
|
18
|
-
end
|
|
16
|
+
parents = parent_groups
|
|
19
17
|
|
|
20
18
|
labels = []
|
|
21
19
|
labels << Allure::ResultUtils.suite_label(suite(parents))
|
|
@@ -25,10 +23,23 @@ module AllureRspec
|
|
|
25
23
|
labels
|
|
26
24
|
end
|
|
27
25
|
|
|
26
|
+
# Get title path from outermost group to innermost group.
|
|
27
|
+
# @return [Array<String>]
|
|
28
|
+
def title_path
|
|
29
|
+
parent_groups.reverse
|
|
30
|
+
end
|
|
31
|
+
|
|
28
32
|
private
|
|
29
33
|
|
|
30
34
|
attr_reader :example_group
|
|
31
35
|
|
|
36
|
+
# @return [Array<String>]
|
|
37
|
+
def parent_groups
|
|
38
|
+
@parent_groups ||= example_group.parent_groups.map do |group|
|
|
39
|
+
group.description.empty? ? "Anonymous" : group.description
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
32
43
|
# @param [Array<String>] parents
|
|
33
44
|
# @return [String]
|
|
34
45
|
def suite(parents)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: allure-rspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.30.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrejs Cunskis
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 2.
|
|
18
|
+
version: 2.30.1
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 2.
|
|
25
|
+
version: 2.30.1
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rspec-core
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -43,7 +43,7 @@ dependencies:
|
|
|
43
43
|
- - "<"
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '4'
|
|
46
|
-
description: Cucumber
|
|
46
|
+
description: Cucumber adapter to generate rich allure test reports
|
|
47
47
|
email: andrejs.cunskis@gmail.com
|
|
48
48
|
executables: []
|
|
49
49
|
extensions: []
|
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
82
|
requirements: []
|
|
83
|
-
rubygems_version:
|
|
83
|
+
rubygems_version: 4.0.20
|
|
84
84
|
specification_version: 4
|
|
85
|
-
summary: Allure rspec ruby
|
|
85
|
+
summary: Allure rspec ruby adapter
|
|
86
86
|
test_files: []
|