allure-cucumber 2.13.8.4 → 2.14.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 +4 -1
- data/lib/allure-cucumber.rb +2 -2
- data/lib/allure_cucumber/config.rb +28 -7
- data/lib/allure_cucumber/formatter.rb +8 -13
- data/lib/allure_cucumber/models/cucumber_model.rb +6 -4
- data/lib/allure_cucumber/models/metadata_parser.rb +22 -14
- data/lib/allure_cucumber/models/scenario.rb +4 -4
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98ad3f0d2bdf151309fc8ce66bffc89a1fdcc38159bcde6e55c764591a631bcc
|
4
|
+
data.tar.gz: 36084b12d289dd34d839ccf987116630575663e6d599e6e9e132c399f129a845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6113e15c4e3a1a3d1f21c8c40777fbd7e52cf5382dc02a2c91f8b4f38c12b4f3fb97d122b657d03a57f78208083c9bddf6224c992710763f736fbe343c27b9dc
|
7
|
+
data.tar.gz: bca4e3569efb395e4c9e1e893cd4300155cd06e2c2a35e92ef8b2735d69a6beb665daa9a4f668cc9cf0d7645c1c734e5b0ad76cf9ced22a114ad5840f3f4e403
|
data/README.md
CHANGED
@@ -43,9 +43,12 @@ Common allure configuration is set via `AllureCucumber.configure` method. To cha
|
|
43
43
|
require "allure-cucumber"
|
44
44
|
|
45
45
|
AllureCucumber.configure do |config|
|
46
|
-
config.results_directory = "/
|
46
|
+
config.results_directory = "report/allure-results"
|
47
47
|
config.clean_results_directory = true
|
48
48
|
config.logging_level = Logger::INFO
|
49
|
+
config.logger = Logger.new($stdout, Logger::DEBUG)
|
50
|
+
config.environment = "staging"
|
51
|
+
|
49
52
|
# these are used for creating links to bugs or test cases where {} is replaced with keys of relevant items
|
50
53
|
config.link_tms_pattern = "http://www.jira.com/browse/{}"
|
51
54
|
config.link_issue_pattern = "http://www.jira.com/browse/{}"
|
data/lib/allure-cucumber.rb
CHANGED
@@ -9,13 +9,13 @@ require_rel "allure_cucumber"
|
|
9
9
|
module AllureCucumber
|
10
10
|
class << self
|
11
11
|
# Get allure cucumber configuration
|
12
|
-
# @return [
|
12
|
+
# @return [AllureCucumber::CucumberConfig]
|
13
13
|
def configuration
|
14
14
|
CucumberConfig.instance
|
15
15
|
end
|
16
16
|
|
17
17
|
# Set allure configuration
|
18
|
-
# @yieldparam [
|
18
|
+
# @yieldparam [AllureCucumber::CucumberConfig]
|
19
19
|
# @yieldreturn [void]
|
20
20
|
# @return [void]
|
21
21
|
def configure
|
@@ -1,11 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "singleton"
|
4
|
-
require "forwardable"
|
5
4
|
|
6
5
|
module AllureCucumber
|
7
|
-
# Allure
|
8
|
-
|
6
|
+
# Allure Cucumber 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 CucumberConfig
|
9
23
|
include Singleton
|
10
24
|
extend Forwardable
|
11
25
|
|
@@ -31,14 +45,21 @@ module AllureCucumber
|
|
31
45
|
:link_tms_pattern=,
|
32
46
|
:logging_level,
|
33
47
|
:logging_level=,
|
48
|
+
:logger,
|
49
|
+
:logger=,
|
34
50
|
:results_directory,
|
35
|
-
:results_directory
|
51
|
+
:results_directory=,
|
52
|
+
:environment,
|
53
|
+
:environment=
|
36
54
|
|
37
|
-
attr_writer :tms_prefix,
|
55
|
+
attr_writer :tms_prefix,
|
56
|
+
:issue_prefix,
|
57
|
+
:severity_prefix,
|
58
|
+
:epic_prefix,
|
59
|
+
:feature_prefix,
|
60
|
+
:story_prefix
|
38
61
|
|
39
62
|
def initialize
|
40
|
-
super()
|
41
|
-
|
42
63
|
@allure_config = Allure.configuration
|
43
64
|
end
|
44
65
|
|
@@ -19,14 +19,15 @@ module AllureCucumber
|
|
19
19
|
|
20
20
|
# @param [Cucumber::Configuration] config
|
21
21
|
def initialize(config)
|
22
|
-
|
23
|
-
|
22
|
+
allure_config = AllureCucumber.configuration
|
23
|
+
allure_config.results_directory = config.out_stream if config.out_stream.is_a?(String)
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
Allure.lifecycle = @lifecycle = Allure::AllureLifecycle.new(allure_config)
|
26
|
+
|
27
|
+
@cucumber_model ||= AllureCucumberModel.new(config, allure_config)
|
28
28
|
|
29
|
-
|
29
|
+
names = Allure::TestPlan.test_names
|
30
|
+
config.name_regexps.push(*names.map { |name| /#{name}/ }) if names
|
30
31
|
|
31
32
|
config.on_event(:test_run_started) { |event| on_test_run_started(event) }
|
32
33
|
config.on_event(:test_case_started) { |event| on_test_case_started(event) }
|
@@ -88,13 +89,7 @@ module AllureCucumber
|
|
88
89
|
|
89
90
|
private
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
# Get thread specific lifecycle
|
94
|
-
# @return [Allure::AllureLifecycle]
|
95
|
-
def lifecycle
|
96
|
-
Allure.lifecycle
|
97
|
-
end
|
92
|
+
attr_reader :lifecycle, :cucumber_model
|
98
93
|
|
99
94
|
# Is hook fixture like Before, After or Step as AfterStep
|
100
95
|
# @param [String] text
|
@@ -8,8 +8,9 @@ module AllureCucumber
|
|
8
8
|
# Support class for transforming cucumber test entities in to allure model entities
|
9
9
|
class AllureCucumberModel
|
10
10
|
# @param [Cucumber::Configuration] config
|
11
|
-
def initialize(config)
|
11
|
+
def initialize(config, allure_config)
|
12
12
|
@ast_lookup = Cucumber::Formatter::AstLookup.new(config)
|
13
|
+
@config = allure_config
|
13
14
|
end
|
14
15
|
|
15
16
|
# Convert to allure test result
|
@@ -17,7 +18,7 @@ module AllureCucumber
|
|
17
18
|
# @return [Allure::TestResult]
|
18
19
|
def test_result(test_case)
|
19
20
|
scenario = Scenario.new(test_case, ast_lookup)
|
20
|
-
parser = MetadataParser.new(scenario)
|
21
|
+
parser = MetadataParser.new(scenario, config)
|
21
22
|
|
22
23
|
Allure::TestResult.new(
|
23
24
|
name: scenario.name,
|
@@ -28,7 +29,8 @@ module AllureCucumber
|
|
28
29
|
labels: parser.labels,
|
29
30
|
links: parser.links,
|
30
31
|
parameters: parser.parameters,
|
31
|
-
status_details: parser.status_details
|
32
|
+
status_details: parser.status_details,
|
33
|
+
environment: config.environment
|
32
34
|
)
|
33
35
|
end
|
34
36
|
|
@@ -65,7 +67,7 @@ module AllureCucumber
|
|
65
67
|
|
66
68
|
private
|
67
69
|
|
68
|
-
attr_reader :ast_lookup, :
|
70
|
+
attr_reader :ast_lookup, :config
|
69
71
|
|
70
72
|
# @param [Step] step
|
71
73
|
# @return [Array<Allure::Attachment>]
|
@@ -3,8 +3,13 @@
|
|
3
3
|
module AllureCucumber
|
4
4
|
# Cucumber tag parser helper methods
|
5
5
|
class MetadataParser
|
6
|
-
|
6
|
+
# Metadata parser instance
|
7
|
+
#
|
8
|
+
# @param [AllureCucumber::Scenario] scenario
|
9
|
+
# @param [AllureCucumber::CucumberConfig] config
|
10
|
+
def initialize(scenario, config)
|
7
11
|
@scenario = scenario
|
12
|
+
@config = config
|
8
13
|
end
|
9
14
|
|
10
15
|
# @return [Array<Allure::Label>]
|
@@ -17,7 +22,7 @@ module AllureCucumber
|
|
17
22
|
severity,
|
18
23
|
*behavior_labels,
|
19
24
|
*tag_labels
|
20
|
-
]
|
25
|
+
].select(&:value)
|
21
26
|
end
|
22
27
|
|
23
28
|
# @return [Array<Allure::Label>]
|
@@ -57,7 +62,7 @@ module AllureCucumber
|
|
57
62
|
def behavior_labels
|
58
63
|
epic = tag_value(:epic) || scenario.feature_folder
|
59
64
|
feature = tag_value(:feature) || scenario.feature_name
|
60
|
-
story = tag_value(:story)
|
65
|
+
story = tag_value(:story)
|
61
66
|
|
62
67
|
[
|
63
68
|
Allure::ResultUtils.epic_label(epic),
|
@@ -68,8 +73,7 @@ module AllureCucumber
|
|
68
73
|
|
69
74
|
private
|
70
75
|
|
71
|
-
|
72
|
-
attr_reader :scenario
|
76
|
+
attr_reader :scenario, :config
|
73
77
|
|
74
78
|
# Get scenario tags
|
75
79
|
#
|
@@ -80,14 +84,14 @@ module AllureCucumber
|
|
80
84
|
|
81
85
|
# @return [Array<Allure::Link>]
|
82
86
|
def tms_links
|
83
|
-
return [] unless
|
87
|
+
return [] unless config.link_tms_pattern
|
84
88
|
|
85
89
|
matching_links(:tms)
|
86
90
|
end
|
87
91
|
|
88
92
|
# @return [Array<Allure::Link>]
|
89
93
|
def issue_links
|
90
|
-
return [] unless
|
94
|
+
return [] unless config.link_issue_pattern
|
91
95
|
|
92
96
|
matching_links(:issue)
|
93
97
|
end
|
@@ -96,20 +100,24 @@ module AllureCucumber
|
|
96
100
|
# @return [Array<Allure::Link>]
|
97
101
|
def matching_links(type)
|
98
102
|
pattern = reserved_patterns[type]
|
103
|
+
link_pattern = config.public_send("link_#{type}_pattern")
|
104
|
+
|
99
105
|
tags
|
100
106
|
.select { |tag| tag.match?(pattern) }
|
101
|
-
.map
|
107
|
+
.map do |tag|
|
108
|
+
tag.match(pattern) { |match| Allure::ResultUtils.public_send("#{type}_link", match[type], link_pattern) }
|
109
|
+
end
|
102
110
|
end
|
103
111
|
|
104
112
|
# @return [Hash<Symbol, Regexp>]
|
105
113
|
def reserved_patterns
|
106
114
|
@reserved_patterns ||= {
|
107
|
-
tms: /@#{
|
108
|
-
issue: /@#{
|
109
|
-
severity: /@#{
|
110
|
-
epic: /@#{
|
111
|
-
feature: /@#{
|
112
|
-
story: /@#{
|
115
|
+
tms: /@#{config.tms_prefix}(?<tms>\S+)/,
|
116
|
+
issue: /@#{config.issue_prefix}(?<issue>\S+)/,
|
117
|
+
severity: /@#{config.severity_prefix}(?<severity>\S+)/,
|
118
|
+
epic: /@#{config.epic_prefix}(?<epic>\S+)/,
|
119
|
+
feature: /@#{config.feature_prefix}(?<feature>\S+)/,
|
120
|
+
story: /@#{config.story_prefix}(?<story>\S+)/,
|
113
121
|
flaky: /@flaky/,
|
114
122
|
muted: /@muted/,
|
115
123
|
known: /@known/
|
@@ -34,9 +34,7 @@ module AllureCucumber
|
|
34
34
|
# Scenario description or it's location
|
35
35
|
# @return [String]
|
36
36
|
def description
|
37
|
-
@description ||=
|
38
|
-
scenario.description.empty? ? "Location - #{test_case.location}" : scenario.description.strip
|
39
|
-
end
|
37
|
+
@description ||= scenario.description.empty? ? "Location - #{test_case.location}" : scenario.description.strip
|
40
38
|
end
|
41
39
|
|
42
40
|
# Scenario outline row parameters
|
@@ -86,7 +84,9 @@ module AllureCucumber
|
|
86
84
|
# @return [String]
|
87
85
|
def example_row
|
88
86
|
@example_row ||= begin
|
89
|
-
|
87
|
+
scneario_examples = scenario_source.examples.table_body.index { |row| row.id == scenario_source.row.id } + 1
|
88
|
+
|
89
|
+
"Examples (##{scneario_examples})"
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.1
|
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-06-10 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.1
|
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.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cucumber
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 4.0.0
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '7'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 4.0.0
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '7'
|
47
47
|
description: Cucumber adaptor to generate rich allure test reports
|
48
48
|
email: andrejs.cunskis@gmail.com
|
49
49
|
executables: []
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
|
-
rubygems_version: 3.2.
|
85
|
+
rubygems_version: 3.2.15
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Allure cucumber ruby adaptor
|