allure-cucumber 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 +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 +20 -12
- 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: 873143a23ec24f57279b9cb21e0e1ba2d27ba70c6e7bd2aa9c303fcacf77730a
|
4
|
+
data.tar.gz: 1908cd0093df0799a25d033f6aade71a4472f88663872a0f24a87f02af543a24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fa6fdc572ac4c4471ba25269b8e2d3a857f0184d9f77bbb3d27e5557537f529490f2dfed70331e0836fcd3c34f468984f64565e1101ad8b5d85dafd8c92b2f6
|
7
|
+
data.tar.gz: b0087f620863f69a70ab877cbd6e54aa7450afdd650caa82256968ce7bfb09cfe35864b25c3cab8588f9f4126f2575beeedc409d8987c202070240f39786cef5
|
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
|
-
allure_config.results_directory = config.out_stream if config.out_stream.is_a?(String)
|
22
|
+
allure_config = AllureCucumber.configuration
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
Allure.lifecycle = @lifecycle = Allure::AllureLifecycle.new(allure_config)
|
25
|
+
allure_config.results_directory = config.out_stream if config.out_stream.is_a?(String)
|
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>]
|
@@ -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/
|
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.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: cucumber
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|