allure-rspec 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 +33 -9
- data/lib/allure-rspec.rb +2 -2
- data/lib/allure_rspec/{01_utils.rb → _utils.rb} +0 -0
- data/lib/allure_rspec/config.rb +72 -6
- data/lib/allure_rspec/formatter.rb +64 -19
- data/lib/allure_rspec/metadata_parser.rb +25 -58
- data/lib/allure_rspec/suite_labels.rb +50 -0
- metadata +6 -20
- data/lib/allure_rspec/rspec_model.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6713eef98c82f9aaaedf42b680dfc60cd6a1f0d078d0bbde6d41ca093bd43cc7
|
4
|
+
data.tar.gz: f2621a5be7fe54c960a40cb49aba240aa6ade93aefc7843a671b42011ee5b6d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c55b18d7fe448382e93a775f71f00c1297c621947d655466baab033923aba86c466bc40d377d5f0a9bcd54e281edc1befb602dfad44d04b47f2b72a65fb60739
|
7
|
+
data.tar.gz: 89a69e78576802c4c3c3c36bd816c6e00c75bda47edac1d029e430c019d9556db80d10f88d6c6e6a99d1144d3e64549e4e6e0b0e8f7ec15ff277a967dd796ce6
|
data/README.md
CHANGED
@@ -24,12 +24,15 @@ Following configuration options are supported:
|
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
AllureRspec.configure do |config|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
config.results_directory = "report/allure-results"
|
28
|
+
config.clean_results_directory = true
|
29
|
+
config.logging_level = Logger::INFO
|
30
|
+
config.logger = Logger.new($stdout, Logger::DEBUG)
|
31
|
+
config.environment = "staging"
|
32
|
+
|
33
|
+
# these are used for creating links to bugs or test cases where {} is replaced with keys of relevant items
|
34
|
+
config.link_tms_pattern = "http://www.jira.com/browse/{}"
|
35
|
+
config.link_issue_pattern = "http://www.jira.com/browse/{}"
|
33
36
|
end
|
34
37
|
```
|
35
38
|
|
@@ -53,11 +56,12 @@ end
|
|
53
56
|
|
54
57
|
### Adding tms links
|
55
58
|
|
56
|
-
Configure tms link pattern:
|
59
|
+
Configure tms link pattern and rspec tag:
|
57
60
|
|
58
61
|
```ruby
|
59
62
|
AllureRspec.configure do |config|
|
60
63
|
config.link_tms_pattern = "http://www.jira.com/browse/{}"
|
64
|
+
config.tms_tag = :tms
|
61
65
|
end
|
62
66
|
```
|
63
67
|
|
@@ -84,6 +88,7 @@ Configure issue link pattern:
|
|
84
88
|
```ruby
|
85
89
|
AllureRspec.configure do |config|
|
86
90
|
config.link_issue_pattern = "http://www.jira.com/browse/{}"
|
91
|
+
config.issue_tag = :issue
|
87
92
|
end
|
88
93
|
```
|
89
94
|
|
@@ -105,7 +110,15 @@ end
|
|
105
110
|
|
106
111
|
### Adding custom severity and status details
|
107
112
|
|
108
|
-
|
113
|
+
Configure severity tag:
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
AllureRspec.configure do |config|
|
117
|
+
config.severity_tag = :severity
|
118
|
+
end
|
119
|
+
```
|
120
|
+
|
121
|
+
Test severity is set to `normal` by default:
|
109
122
|
|
110
123
|
```ruby
|
111
124
|
it "some test case", severity: :critical do
|
@@ -131,9 +144,20 @@ it "some test case", allure_1: "visual_test", allure_2: "core_functionality" do
|
|
131
144
|
end
|
132
145
|
```
|
133
146
|
|
147
|
+
All rspec metadata tags will also be added as labels in test report.
|
148
|
+
|
134
149
|
### Behavior driven test grouping
|
135
150
|
|
136
|
-
Marking tests with tags `:epic, :feature, :story`, will group tests accordingly in Behavior report tab
|
151
|
+
Marking tests with tags `:epic, :feature, :story`, will group tests accordingly in Behavior report tab.\
|
152
|
+
Tag values can also be configured:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
AllureRspec.configure do |config|
|
156
|
+
config.epic_tag = :epic
|
157
|
+
config.feature_tag = :feature
|
158
|
+
config.story_tag = :story
|
159
|
+
end
|
160
|
+
```
|
137
161
|
|
138
162
|
```ruby
|
139
163
|
context "context", feature: "my feature" do
|
data/lib/allure-rspec.rb
CHANGED
@@ -8,13 +8,13 @@ require_rel "allure_rspec/**/*.rb"
|
|
8
8
|
module AllureRspec
|
9
9
|
class << self
|
10
10
|
# Get allure cucumber configuration
|
11
|
-
# @return [RspecConfig]
|
11
|
+
# @return [AllureRspec::RspecConfig]
|
12
12
|
def configuration
|
13
13
|
RspecConfig.instance
|
14
14
|
end
|
15
15
|
|
16
16
|
# Set allure configuration
|
17
|
-
# @yieldparam [RspecConfig]
|
17
|
+
# @yieldparam [AllureRspec::RspecConfig]
|
18
18
|
# @yieldreturn [void]
|
19
19
|
# @return [void]
|
20
20
|
def configure
|
File without changes
|
data/lib/allure_rspec/config.rb
CHANGED
@@ -1,14 +1,41 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "forwardable"
|
4
3
|
require "singleton"
|
5
4
|
|
6
5
|
module AllureRspec
|
7
|
-
#
|
8
|
-
|
6
|
+
# Allure RSpec configuration class
|
7
|
+
#
|
8
|
+
# @!attribute results_directory
|
9
|
+
# @return [String]
|
10
|
+
# @!attribute clean_results_directory
|
11
|
+
# @return [Boolean]
|
12
|
+
# @!attribute link_issue_pattern
|
13
|
+
# @return [String]
|
14
|
+
# @!attribute link_tms_pattern
|
15
|
+
# @return [String]
|
16
|
+
# @!attribute logging_level
|
17
|
+
# @return [Integer]
|
18
|
+
# @!attribute [r] logger
|
19
|
+
# @return [Logger]
|
20
|
+
# @!attribute environment
|
21
|
+
# @return [String]
|
22
|
+
class RspecConfig
|
9
23
|
include Singleton
|
10
24
|
extend Forwardable
|
11
25
|
|
26
|
+
# @return [Symbol] default tms tag
|
27
|
+
DEFAULT_TMS_TAG = :tms
|
28
|
+
# @return [Symbol] default issue tag
|
29
|
+
DEFAULT_ISSUE_TAG = :issue
|
30
|
+
# @return [Symbol] default severity tag
|
31
|
+
DEFAULT_SEVERITY_TAG = :severity
|
32
|
+
# @return [Symbol] default epic tag
|
33
|
+
DEFAULT_EPIC_TAG = :epic
|
34
|
+
# @return [Symbol] default feature tag
|
35
|
+
DEFAULT_FEATURE_TAG = :feature
|
36
|
+
# @return [Symbol] default story tag
|
37
|
+
DEFAULT_STORY_TAG = :story
|
38
|
+
|
12
39
|
def_delegators :@allure_config,
|
13
40
|
:clean_results_directory,
|
14
41
|
:clean_results_directory=,
|
@@ -18,13 +45,52 @@ module AllureRspec
|
|
18
45
|
:link_tms_pattern=,
|
19
46
|
:logging_level,
|
20
47
|
:logging_level=,
|
48
|
+
:logger,
|
49
|
+
:logger=,
|
21
50
|
:results_directory,
|
22
|
-
:results_directory
|
51
|
+
:results_directory=,
|
52
|
+
:environment,
|
53
|
+
:environment=
|
23
54
|
|
24
55
|
def initialize
|
25
|
-
super()
|
26
|
-
|
27
56
|
@allure_config = Allure.configuration
|
28
57
|
end
|
58
|
+
|
59
|
+
attr_writer :tms_tag,
|
60
|
+
:issue_tag,
|
61
|
+
:severity_tag,
|
62
|
+
:epic_tag,
|
63
|
+
:feature_tag,
|
64
|
+
:story_tag
|
65
|
+
|
66
|
+
# @return [Symbol]
|
67
|
+
def tms_tag
|
68
|
+
@tms_prefix || DEFAULT_TMS_TAG
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [Symbol]
|
72
|
+
def issue_tag
|
73
|
+
@issue_prefix || DEFAULT_ISSUE_TAG
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Symbol]
|
77
|
+
def severity_tag
|
78
|
+
@severity_prefix || DEFAULT_SEVERITY_TAG
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [Symbol]
|
82
|
+
def epic_tag
|
83
|
+
@epic_prefix || DEFAULT_EPIC_TAG
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [Symbol]
|
87
|
+
def feature_tag
|
88
|
+
@feature_prefix || DEFAULT_FEATURE_TAG
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return [Symbol]
|
92
|
+
def story_tag
|
93
|
+
@story_prefix || DEFAULT_STORY_TAG
|
94
|
+
end
|
29
95
|
end
|
30
96
|
end
|
@@ -1,16 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "ruby2_keywords"
|
4
3
|
require "rspec/core"
|
5
4
|
require "rspec/core/formatters/base_formatter"
|
6
5
|
|
7
|
-
require_relative "rspec_model"
|
8
|
-
|
9
6
|
# Main allure-rspec module
|
10
7
|
module AllureRspec
|
11
8
|
# Main rspec formatter class translating rspec events to allure lifecycle
|
12
9
|
class RSpecFormatter < RSpec::Core::Formatters::BaseFormatter
|
13
|
-
include
|
10
|
+
include Utils
|
11
|
+
|
12
|
+
# @return [Hash] allure statuses mapping
|
13
|
+
ALLURE_STATUS = {
|
14
|
+
failed: Allure::Status::FAILED,
|
15
|
+
pending: Allure::Status::SKIPPED,
|
16
|
+
passed: Allure::Status::PASSED
|
17
|
+
}.freeze
|
14
18
|
|
15
19
|
RSpec::Core::Formatters.register(
|
16
20
|
self,
|
@@ -21,20 +25,19 @@ module AllureRspec
|
|
21
25
|
:example_finished
|
22
26
|
)
|
23
27
|
|
24
|
-
RSpec
|
25
|
-
Allure.
|
26
|
-
|
27
|
-
|
28
|
+
RSpec.configure do |config|
|
29
|
+
ids = Allure::TestPlan.test_ids
|
30
|
+
names = Allure::TestPlan.test_names
|
31
|
+
|
32
|
+
config.filter_run_when_matching(*ids.map { |id| { allure_id: id } }) if ids
|
33
|
+
config.full_description = names if names
|
28
34
|
end
|
29
35
|
|
30
|
-
|
31
|
-
|
32
|
-
ids = allure_config.test_ids
|
33
|
-
names = allure_config.test_names
|
36
|
+
def initialize(output)
|
37
|
+
super
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
end
|
39
|
+
@allure_config = AllureRspec.configuration
|
40
|
+
Allure.lifecycle = @lifecycle = Allure::AllureLifecycle.new(@allure_config)
|
38
41
|
end
|
39
42
|
|
40
43
|
# Start test run
|
@@ -42,6 +45,10 @@ module AllureRspec
|
|
42
45
|
# @return [void]
|
43
46
|
def start(_start_notification)
|
44
47
|
lifecycle.clean_results_dir
|
48
|
+
|
49
|
+
RSpec::Core::Example.class_eval do
|
50
|
+
include Allure
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
47
54
|
# Starts example group
|
@@ -78,10 +85,48 @@ module AllureRspec
|
|
78
85
|
|
79
86
|
private
|
80
87
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
88
|
+
attr_reader :lifecycle, :allure_config
|
89
|
+
|
90
|
+
# Transform example to <Allure::TestResult>
|
91
|
+
# @param [RSpec::Core::Example] example
|
92
|
+
# @return [Allure::TestResult]
|
93
|
+
def test_result(example)
|
94
|
+
parser = RspecMetadataParser.new(example, allure_config)
|
95
|
+
|
96
|
+
Allure::TestResult.new(
|
97
|
+
name: example.description,
|
98
|
+
description: "Location - #{strip_relative(example.location)}",
|
99
|
+
description_html: "Location - #{strip_relative(example.location)}",
|
100
|
+
history_id: Digest::MD5.hexdigest(example.id),
|
101
|
+
full_name: example.full_description,
|
102
|
+
labels: parser.labels,
|
103
|
+
links: parser.links,
|
104
|
+
status_details: parser.status_details,
|
105
|
+
environment: allure_config.environment
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Update test status on finish
|
110
|
+
# @param [RSpec::Core::Example::ExecutionResult] result
|
111
|
+
# @return [Proc]
|
112
|
+
def update_test_proc(result)
|
113
|
+
Allure::ResultUtils.status_details(result.exception).yield_self do |status_detail|
|
114
|
+
proc do |test_case|
|
115
|
+
test_case.stage = Allure::Stage::FINISHED
|
116
|
+
test_case.status = status(result)
|
117
|
+
test_case.status_details.message = status_detail.message
|
118
|
+
test_case.status_details.trace = status_detail.trace
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Get allure status from result
|
124
|
+
# @param [RSpec::Core::Example::ExecutionResult] result
|
125
|
+
# @return [Symbol]
|
126
|
+
def status(result)
|
127
|
+
return Allure::ResultUtils.status(result.exception) if result.status == :failed
|
128
|
+
|
129
|
+
ALLURE_STATUS[result.status]
|
85
130
|
end
|
86
131
|
end
|
87
132
|
end
|
@@ -1,53 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module AllureRspec
|
4
|
-
# Suite label generator
|
5
|
-
#
|
6
|
-
class SuiteLabels
|
7
|
-
include Utils
|
8
|
-
|
9
|
-
def initialize(example_group)
|
10
|
-
@example_group = example_group
|
11
|
-
end
|
12
|
-
|
13
|
-
# Get test suite labels
|
14
|
-
# @return [Array<Allure::Label>]
|
15
|
-
def fetch
|
16
|
-
parents = example_group.parent_groups.map do |group|
|
17
|
-
group.description.empty? ? "Anonymous" : group.description
|
18
|
-
end
|
19
|
-
|
20
|
-
labels = []
|
21
|
-
labels << Allure::ResultUtils.suite_label(suite(parents))
|
22
|
-
labels << Allure::ResultUtils.parent_suite_label(parent_suite(parents)) if parent_suite(parents)
|
23
|
-
labels << Allure::ResultUtils.sub_suite_label(sub_suites(parents)) if sub_suites(parents)
|
24
|
-
|
25
|
-
labels
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
attr_reader :example_group
|
31
|
-
|
32
|
-
# @param [Array<String>] parents
|
33
|
-
# @return [String]
|
34
|
-
def suite(parents)
|
35
|
-
parents.length == 1 ? parents.last : parents[-2]
|
36
|
-
end
|
37
|
-
|
38
|
-
# @param [Array<String>] parents
|
39
|
-
# @return [String]
|
40
|
-
def parent_suite(parents)
|
41
|
-
parents.length > 1 ? parents.last : nil
|
42
|
-
end
|
43
|
-
|
44
|
-
# @param [Array<String>] parents
|
45
|
-
# @return [String]
|
46
|
-
def sub_suites(parents)
|
47
|
-
parents.length > 2 ? parents[0..-3].join(" > ") : nil
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
4
|
# RSpec metadata parser
|
52
5
|
#
|
53
6
|
class RspecMetadataParser
|
@@ -75,8 +28,13 @@ module AllureRspec
|
|
75
28
|
type
|
76
29
|
].freeze
|
77
30
|
|
78
|
-
|
31
|
+
# Metadata parser instance
|
32
|
+
#
|
33
|
+
# @param [RSpec::Core::Example] example
|
34
|
+
# @param [AllureRspec::RspecConfig] config <description>
|
35
|
+
def initialize(example, config)
|
79
36
|
@example = example
|
37
|
+
@config = config
|
80
38
|
end
|
81
39
|
|
82
40
|
# Get allure labels
|
@@ -111,9 +69,12 @@ module AllureRspec
|
|
111
69
|
|
112
70
|
private
|
113
71
|
|
114
|
-
# @
|
72
|
+
# @return [RSpec::Core::Example]
|
115
73
|
attr_reader :example
|
116
74
|
|
75
|
+
# @return [AllureRspec::RspecConfig]
|
76
|
+
attr_reader :config
|
77
|
+
|
117
78
|
# Example metadata
|
118
79
|
#
|
119
80
|
# @return [Hash]
|
@@ -143,7 +104,7 @@ module AllureRspec
|
|
143
104
|
# Get severity
|
144
105
|
# @return [String]
|
145
106
|
def severity
|
146
|
-
Allure::ResultUtils.severity_label(metadata[
|
107
|
+
Allure::ResultUtils.severity_label(metadata[config.severity_tag] || "normal")
|
147
108
|
end
|
148
109
|
|
149
110
|
# Get test suite labels
|
@@ -164,9 +125,9 @@ module AllureRspec
|
|
164
125
|
# @return [Array<Allure::Label>]
|
165
126
|
def behavior_labels
|
166
127
|
metadata = example.metadata
|
167
|
-
epic = metadata[
|
168
|
-
feature = metadata[
|
169
|
-
story = metadata[
|
128
|
+
epic = metadata[config.epic_tag] || Pathname.new(strip_relative(example.file_path)).parent.to_s
|
129
|
+
feature = metadata[config.feature_tag] || example.example_group.description
|
130
|
+
story = metadata[config.story_tag]
|
170
131
|
|
171
132
|
[
|
172
133
|
Allure::ResultUtils.epic_label(epic),
|
@@ -179,11 +140,12 @@ module AllureRspec
|
|
179
140
|
# @param [Symbol] type
|
180
141
|
# @return [Array<Allure::Link>]
|
181
142
|
def matching_links(type)
|
182
|
-
|
143
|
+
link_pattern = config.public_send("link_#{type}_pattern")
|
144
|
+
return [] unless link_pattern
|
183
145
|
|
184
146
|
metadata
|
185
147
|
.select { |k| __send__("#{type}?", k) }.values
|
186
|
-
.map { |v| Allure::ResultUtils.public_send("#{type}_link", v) }
|
148
|
+
.map { |v| Allure::ResultUtils.public_send("#{type}_link", v, link_pattern) }
|
187
149
|
end
|
188
150
|
|
189
151
|
# Special allure metadata tags
|
@@ -191,7 +153,12 @@ module AllureRspec
|
|
191
153
|
# @param [Symbol] key
|
192
154
|
# @return [boolean]
|
193
155
|
def special_metadata_tag?(key)
|
194
|
-
tms?(key) || issue?(key) ||
|
156
|
+
tms?(key) || issue?(key) || [
|
157
|
+
config.severity_tag,
|
158
|
+
config.epic_tag,
|
159
|
+
config.feature_tag,
|
160
|
+
config.story_tag
|
161
|
+
].include?(key)
|
195
162
|
end
|
196
163
|
|
197
164
|
# Does key match custom allure label
|
@@ -205,14 +172,14 @@ module AllureRspec
|
|
205
172
|
# @param [Symbol] key
|
206
173
|
# @return [boolean]
|
207
174
|
def tms?(key)
|
208
|
-
key.to_s.match?(
|
175
|
+
key.to_s.match?(/#{config.tms_tag}(_\d+)?/i)
|
209
176
|
end
|
210
177
|
|
211
178
|
# Does key match issue pattern
|
212
179
|
# @param [Symbol] key
|
213
180
|
# @return [boolean]
|
214
181
|
def issue?(key)
|
215
|
-
key.to_s.match?(
|
182
|
+
key.to_s.match?(/#{config.issue_tag}(_\d+)?/i)
|
216
183
|
end
|
217
184
|
end
|
218
185
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AllureRspec
|
4
|
+
# Suite label generator
|
5
|
+
#
|
6
|
+
class SuiteLabels
|
7
|
+
include Utils
|
8
|
+
|
9
|
+
def initialize(example_group)
|
10
|
+
@example_group = example_group
|
11
|
+
end
|
12
|
+
|
13
|
+
# Get test suite labels
|
14
|
+
# @return [Array<Allure::Label>]
|
15
|
+
def fetch
|
16
|
+
parents = example_group.parent_groups.map do |group|
|
17
|
+
group.description.empty? ? "Anonymous" : group.description
|
18
|
+
end
|
19
|
+
|
20
|
+
labels = []
|
21
|
+
labels << Allure::ResultUtils.suite_label(suite(parents))
|
22
|
+
labels << Allure::ResultUtils.parent_suite_label(parent_suite(parents)) if parent_suite(parents)
|
23
|
+
labels << Allure::ResultUtils.sub_suite_label(sub_suites(parents)) if sub_suites(parents)
|
24
|
+
|
25
|
+
labels
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
attr_reader :example_group
|
31
|
+
|
32
|
+
# @param [Array<String>] parents
|
33
|
+
# @return [String]
|
34
|
+
def suite(parents)
|
35
|
+
parents.length == 1 ? parents.last : parents[-2]
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param [Array<String>] parents
|
39
|
+
# @return [String]
|
40
|
+
def parent_suite(parents)
|
41
|
+
parents.length > 1 ? parents.last : nil
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param [Array<String>] parents
|
45
|
+
# @return [String]
|
46
|
+
def sub_suites(parents)
|
47
|
+
parents.length > 2 ? parents[0..-3].join(" > ") : nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-rspec
|
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: allure-ruby-commons
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.13.
|
19
|
+
version: 2.13.10
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.13.
|
26
|
+
version: 2.13.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,20 +44,6 @@ dependencies:
|
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '4'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: ruby2_keywords
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.0.2
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 0.0.2
|
61
47
|
description: Cucumber adaptor to generate rich allure test reports
|
62
48
|
email: andrejs.cunskis@gmail.com
|
63
49
|
executables: []
|
@@ -66,11 +52,11 @@ extra_rdoc_files: []
|
|
66
52
|
files:
|
67
53
|
- README.md
|
68
54
|
- lib/allure-rspec.rb
|
69
|
-
- lib/allure_rspec/
|
55
|
+
- lib/allure_rspec/_utils.rb
|
70
56
|
- lib/allure_rspec/config.rb
|
71
57
|
- lib/allure_rspec/formatter.rb
|
72
58
|
- lib/allure_rspec/metadata_parser.rb
|
73
|
-
- lib/allure_rspec/
|
59
|
+
- lib/allure_rspec/suite_labels.rb
|
74
60
|
homepage: https://github.com/allure-framework/allure-ruby/tree/master/allure-rspec
|
75
61
|
licenses:
|
76
62
|
- Apache-2.0
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "digest"
|
4
|
-
require "pathname"
|
5
|
-
|
6
|
-
module AllureRspec
|
7
|
-
# Support class for transforming rspec test entities in to allure model entities
|
8
|
-
module AllureRspecModel
|
9
|
-
include AllureRspec::Utils
|
10
|
-
|
11
|
-
# @return [Hash] allure statuses mapping
|
12
|
-
ALLURE_STATUS = {
|
13
|
-
failed: Allure::Status::FAILED,
|
14
|
-
pending: Allure::Status::SKIPPED,
|
15
|
-
passed: Allure::Status::PASSED
|
16
|
-
}.freeze
|
17
|
-
|
18
|
-
# Transform example to <Allure::TestResult>
|
19
|
-
# @param [RSpec::Core::Example] example
|
20
|
-
# @return [Allure::TestResult]
|
21
|
-
def test_result(example)
|
22
|
-
parser = RspecMetadataParser.new(example)
|
23
|
-
|
24
|
-
Allure::TestResult.new(
|
25
|
-
name: example.description,
|
26
|
-
description: "Location - #{strip_relative(example.location)}",
|
27
|
-
description_html: "Location - #{strip_relative(example.location)}",
|
28
|
-
history_id: Digest::MD5.hexdigest(example.id),
|
29
|
-
full_name: example.full_description,
|
30
|
-
labels: parser.labels,
|
31
|
-
links: parser.links,
|
32
|
-
status_details: parser.status_details
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Update test status on finish
|
37
|
-
# @param [RSpec::Core::Example::ExecutionResult] result
|
38
|
-
# @return [Proc]
|
39
|
-
def update_test_proc(result)
|
40
|
-
Allure::ResultUtils.status_details(result.exception).yield_self do |status_detail|
|
41
|
-
proc do |test_case|
|
42
|
-
test_case.stage = Allure::Stage::FINISHED
|
43
|
-
test_case.status = status(result)
|
44
|
-
test_case.status_details.message = status_detail.message
|
45
|
-
test_case.status_details.trace = status_detail.trace
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
# Get allure status from result
|
53
|
-
# @param [RSpec::Core::Example::ExecutionResult] result
|
54
|
-
# @return [Symbol]
|
55
|
-
def status(result)
|
56
|
-
return Allure::ResultUtils.status(result.exception) if result.status == :failed
|
57
|
-
|
58
|
-
ALLURE_STATUS[result.status]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|