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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df0a75ebcd25e7169150696e4745ecef51e069a71e7491ec8317ee32b09c8bd8
4
- data.tar.gz: 659024e9b7ca69d939a2908e629a92efa62d8b68d0ff32946fdc844f1f58bf01
3
+ metadata.gz: 873143a23ec24f57279b9cb21e0e1ba2d27ba70c6e7bd2aa9c303fcacf77730a
4
+ data.tar.gz: 1908cd0093df0799a25d033f6aade71a4472f88663872a0f24a87f02af543a24
5
5
  SHA512:
6
- metadata.gz: badd202150dedfb6ce97d4f84acafa015ca19cf96cb4e4074c100cfcf057d1bd2a3f18dfe91b87ac2b03083a5ba59883d342807fda3600fbbaf84285215139db
7
- data.tar.gz: 8f80df33fafc4a7f60c27524f586182d55d3e290d48630ccf871766c2e09c2c50fc74ce4d0a225fb3d3831f6cdcefd3101226dc425d9e2b08a6318b60d54128c
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 = "/whatever/you/like"
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/{}"
@@ -9,13 +9,13 @@ require_rel "allure_cucumber"
9
9
  module AllureCucumber
10
10
  class << self
11
11
  # Get allure cucumber configuration
12
- # @return [Allure::CucumberConfig]
12
+ # @return [AllureCucumber::CucumberConfig]
13
13
  def configuration
14
14
  CucumberConfig.instance
15
15
  end
16
16
 
17
17
  # Set allure configuration
18
- # @yieldparam [Allure::CucumberConfig]
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 cucumber configuration
8
- class CucumberConfig < Allure::Config
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, :issue_prefix, :severity_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
- Allure.configure do |allure_config|
23
- allure_config.results_directory = config.out_stream if config.out_stream.is_a?(String)
22
+ allure_config = AllureCucumber.configuration
24
23
 
25
- names = allure_config.test_names
26
- config.name_regexps.push(*names.map { |name| /#{name}/ }) if names
27
- end
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
- @cucumber_model = AllureCucumberModel.new(config)
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
- attr_accessor :cucumber_model
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, :lifecycle
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
- def initialize(scenario)
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
- # @return [AllureCucumber::Scenario]
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 AllureCucumber.configuration.link_tms_pattern
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 AllureCucumber.configuration.link_issue_pattern
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 { |tag| tag.match(pattern) { |match| Allure::ResultUtils.public_send("#{type}_link", match[type]) } }
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: /@#{AllureCucumber.configuration.tms_prefix}(?<tms>\S+)/,
108
- issue: /@#{AllureCucumber.configuration.issue_prefix}(?<issue>\S+)/,
109
- severity: /@#{AllureCucumber.configuration.severity_prefix}(?<severity>\S+)/,
110
- epic: /@#{AllureCucumber.configuration.epic_prefix}(?<epic>\S+)/,
111
- feature: /@#{AllureCucumber.configuration.feature_prefix}(?<feature>\S+)/,
112
- story: /@#{AllureCucumber.configuration.story_prefix}(?<story>\S+)/,
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.9
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-04-15 00:00:00.000000000 Z
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.9
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.9
26
+ version: 2.13.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cucumber
29
29
  requirement: !ruby/object:Gem::Requirement