allure-rspec 2.13.9 → 2.14.2
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 +43 -11
- data/lib/allure-rspec.rb +2 -2
- data/lib/allure_rspec/{01_utils.rb → _utils.rb} +0 -0
- data/lib/allure_rspec/config.rb +76 -6
- data/lib/allure_rspec/formatter.rb +66 -19
- data/lib/allure_rspec/metadata_parser.rb +25 -58
- data/lib/allure_rspec/suite_labels.rb +50 -0
- metadata +7 -21
- 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: ebcd6e6c81d696779c9303a84b80d3264469f93618c9876f2fa9fc03be6d8637
|
4
|
+
data.tar.gz: bbe73782f89fe4819b2ba9612960da4de067a5c0762db71df8c77667ba00d8dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 989e664938fbcbb496181c09e597d355b718349ba3ee114b88f3cee57f564f3302b06c5aa8e0862966110edca662b2f86da3ace00df08624ff22d6f64a2ed5c2
|
7
|
+
data.tar.gz: d3d7a4a7f547485edc79124172b69aa7e2eb815345bff4263048b0f6455625469686b5f6d52f20273c06f952a11c0176c5f46ef655dcf5cb43ba743369dca190
|
data/README.md
CHANGED
@@ -23,14 +23,25 @@ require "allure-rspec"
|
|
23
23
|
Following configuration options are supported:
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
AllureRspec.configure do |config|
|
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/{}"
|
36
|
+
|
37
|
+
# additional metadata
|
38
|
+
# environment.properties
|
39
|
+
config.environment_properties = {
|
40
|
+
custom_attribute: "foo"
|
41
|
+
}
|
42
|
+
# categories.json
|
43
|
+
config.categories = File.new("my_custom_categories.json")
|
44
|
+
end
|
34
45
|
```
|
35
46
|
|
36
47
|
## Usage
|
@@ -53,11 +64,12 @@ end
|
|
53
64
|
|
54
65
|
### Adding tms links
|
55
66
|
|
56
|
-
Configure tms link pattern:
|
67
|
+
Configure tms link pattern and rspec tag:
|
57
68
|
|
58
69
|
```ruby
|
59
70
|
AllureRspec.configure do |config|
|
60
71
|
config.link_tms_pattern = "http://www.jira.com/browse/{}"
|
72
|
+
config.tms_tag = :tms
|
61
73
|
end
|
62
74
|
```
|
63
75
|
|
@@ -84,6 +96,7 @@ Configure issue link pattern:
|
|
84
96
|
```ruby
|
85
97
|
AllureRspec.configure do |config|
|
86
98
|
config.link_issue_pattern = "http://www.jira.com/browse/{}"
|
99
|
+
config.issue_tag = :issue
|
87
100
|
end
|
88
101
|
```
|
89
102
|
|
@@ -105,7 +118,15 @@ end
|
|
105
118
|
|
106
119
|
### Adding custom severity and status details
|
107
120
|
|
108
|
-
|
121
|
+
Configure severity tag:
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
AllureRspec.configure do |config|
|
125
|
+
config.severity_tag = :severity
|
126
|
+
end
|
127
|
+
```
|
128
|
+
|
129
|
+
Test severity is set to `normal` by default:
|
109
130
|
|
110
131
|
```ruby
|
111
132
|
it "some test case", severity: :critical do
|
@@ -131,9 +152,20 @@ it "some test case", allure_1: "visual_test", allure_2: "core_functionality" do
|
|
131
152
|
end
|
132
153
|
```
|
133
154
|
|
155
|
+
All rspec metadata tags will also be added as labels in test report.
|
156
|
+
|
134
157
|
### Behavior driven test grouping
|
135
158
|
|
136
|
-
Marking tests with tags `:epic, :feature, :story`, will group tests accordingly in Behavior report tab
|
159
|
+
Marking tests with tags `:epic, :feature, :story`, will group tests accordingly in Behavior report tab.\
|
160
|
+
Tag values can also be configured:
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
AllureRspec.configure do |config|
|
164
|
+
config.epic_tag = :epic
|
165
|
+
config.feature_tag = :feature
|
166
|
+
config.story_tag = :story
|
167
|
+
end
|
168
|
+
```
|
137
169
|
|
138
170
|
```ruby
|
139
171
|
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,56 @@ 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=,
|
54
|
+
:environment_properties,
|
55
|
+
:environment_properties=,
|
56
|
+
:categories,
|
57
|
+
:categories=
|
23
58
|
|
24
59
|
def initialize
|
25
|
-
super()
|
26
|
-
|
27
60
|
@allure_config = Allure.configuration
|
28
61
|
end
|
62
|
+
|
63
|
+
attr_writer :tms_tag,
|
64
|
+
:issue_tag,
|
65
|
+
:severity_tag,
|
66
|
+
:epic_tag,
|
67
|
+
:feature_tag,
|
68
|
+
:story_tag
|
69
|
+
|
70
|
+
# @return [Symbol]
|
71
|
+
def tms_tag
|
72
|
+
@tms_prefix || DEFAULT_TMS_TAG
|
73
|
+
end
|
74
|
+
|
75
|
+
# @return [Symbol]
|
76
|
+
def issue_tag
|
77
|
+
@issue_prefix || DEFAULT_ISSUE_TAG
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [Symbol]
|
81
|
+
def severity_tag
|
82
|
+
@severity_prefix || DEFAULT_SEVERITY_TAG
|
83
|
+
end
|
84
|
+
|
85
|
+
# @return [Symbol]
|
86
|
+
def epic_tag
|
87
|
+
@epic_prefix || DEFAULT_EPIC_TAG
|
88
|
+
end
|
89
|
+
|
90
|
+
# @return [Symbol]
|
91
|
+
def feature_tag
|
92
|
+
@feature_prefix || DEFAULT_FEATURE_TAG
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [Symbol]
|
96
|
+
def story_tag
|
97
|
+
@story_prefix || DEFAULT_STORY_TAG
|
98
|
+
end
|
29
99
|
end
|
30
100
|
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,12 @@ module AllureRspec
|
|
42
45
|
# @return [void]
|
43
46
|
def start(_start_notification)
|
44
47
|
lifecycle.clean_results_dir
|
48
|
+
lifecycle.write_environment
|
49
|
+
lifecycle.write_categories
|
50
|
+
|
51
|
+
RSpec::Core::Example.class_eval do
|
52
|
+
include Allure
|
53
|
+
end
|
45
54
|
end
|
46
55
|
|
47
56
|
# Starts example group
|
@@ -78,10 +87,48 @@ module AllureRspec
|
|
78
87
|
|
79
88
|
private
|
80
89
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
90
|
+
attr_reader :lifecycle, :allure_config
|
91
|
+
|
92
|
+
# Transform example to <Allure::TestResult>
|
93
|
+
# @param [RSpec::Core::Example] example
|
94
|
+
# @return [Allure::TestResult]
|
95
|
+
def test_result(example)
|
96
|
+
parser = RspecMetadataParser.new(example, allure_config)
|
97
|
+
|
98
|
+
Allure::TestResult.new(
|
99
|
+
name: example.description,
|
100
|
+
description: "Location - #{strip_relative(example.location)}",
|
101
|
+
description_html: "Location - #{strip_relative(example.location)}",
|
102
|
+
history_id: example.id,
|
103
|
+
full_name: example.full_description,
|
104
|
+
labels: parser.labels,
|
105
|
+
links: parser.links,
|
106
|
+
status_details: parser.status_details,
|
107
|
+
environment: allure_config.environment
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Update test status on finish
|
112
|
+
# @param [RSpec::Core::Example::ExecutionResult] result
|
113
|
+
# @return [Proc]
|
114
|
+
def update_test_proc(result)
|
115
|
+
Allure::ResultUtils.status_details(result.exception).yield_self do |status_detail|
|
116
|
+
proc do |test_case|
|
117
|
+
test_case.stage = Allure::Stage::FINISHED
|
118
|
+
test_case.status = status(result)
|
119
|
+
test_case.status_details.message = status_detail.message
|
120
|
+
test_case.status_details.trace = status_detail.trace
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Get allure status from result
|
126
|
+
# @param [RSpec::Core::Example::ExecutionResult] result
|
127
|
+
# @return [Symbol]
|
128
|
+
def status(result)
|
129
|
+
return Allure::ResultUtils.status(result.exception) if result.status == :failed
|
130
|
+
|
131
|
+
ALLURE_STATUS[result.status]
|
85
132
|
end
|
86
133
|
end
|
87
134
|
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.
|
4
|
+
version: 2.14.2
|
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-07-14 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.
|
19
|
+
version: 2.14.2
|
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.
|
26
|
+
version: 2.14.2
|
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
|
@@ -95,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
requirements: []
|
98
|
-
rubygems_version: 3.2.
|
84
|
+
rubygems_version: 3.2.22
|
99
85
|
signing_key:
|
100
86
|
specification_version: 4
|
101
87
|
summary: Allure rspec ruby adaptor
|
@@ -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
|