allure_turnip 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d71432b09244223c990ea3a50e18b52addba8e6c2858aa69e0a5ca9aa6a405d
4
- data.tar.gz: d5e833a9f398b21fd4a25610aa1bf8b962dd0f6ab709f3cf9fdfbe4199a22eaf
3
+ metadata.gz: ef7d70576f3dc4e0b4f6f42ffd33b16357755d782775c28252869622b20ffcd9
4
+ data.tar.gz: 45d9429e548a4da68085190c4f492ba6ca02c1ffb7205c309485de930d060cd2
5
5
  SHA512:
6
- metadata.gz: 95820a00fbf22bb47745a21fd59eb08ca04d9056476a49b0c4f97e7cab9fdf91fc90345884cd9fd56c8467bd05079a85d67fd8bd60ece9fcb7374e678c655fbe
7
- data.tar.gz: 507e947a1c882b9a7d03d8f517013ccfa2b9c28375e727fd28d4634dcae270e1df80477ae8c7fed5ef0c132beb9f23051b4f55889e5356333afae227289c453d
6
+ metadata.gz: 7cce7ffb7ac770d8660089a996d5c414be9d620b2fb35dddfd660582f85afcf98930686a7c40d4396e1516dbb327515b5d8d4388c89b611132f06d40fba50e92
7
+ data.tar.gz: ead43ca78aaea53cc8ea228881469d9272acfcbe6615f573198a303e265150b5c8354aef63ee462045fd59da90a663b23271b3721a8330e4caf54ab8b568a314
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- allure_turnip (0.1.1)
4
+ allure_turnip (0.2.0)
5
5
  allure-ruby-adaptor-api (= 0.7.0)
6
6
  rspec (~> 3.5)
7
7
  turnip (~> 3.0)
data/README.md CHANGED
@@ -36,7 +36,8 @@ And then include it in your spec_helper.rb:
36
36
  You can specify the directory where the Allure test results will appear. By default it would be 'gen/allure-results'
37
37
  within your current directory.
38
38
  When you add a `feature_with_filename` option, the suites of the the Allure test results include file's name as a prefix.
39
- This options is useful if you have some same feature names. Because Allure overwrites the same feature name's result if there are some same feature names.
39
+ This options is useful if you have some same feature names. Because Allure overwrites the same feature name's result if there are some same feature names.
40
+ Allure_turnip will analyze your tags looking for Test Management, Issue Management. These will be displayed in the generated allure report (see allure-core for further info).
40
41
 
41
42
  ```ruby
42
43
  AllureTurnip.configure do |c|
@@ -44,6 +45,8 @@ This options is useful if you have some same feature names. Because Allure overw
44
45
  c.clean_dir = false # clean the output directory first? (default: true)
45
46
  c.logging_level = Logger::DEBUG # logging level (default: DEBUG)
46
47
  c.feature_with_filename = true # default: false
48
+ c.tms_prefix = '@HIPTEST--' # default: '@TMS:'
49
+ c.issue_prefix = '@JIRA++' # default: '@ISSUE:'
47
50
  end
48
51
  ```
49
52
 
@@ -56,6 +59,8 @@ The method attaches the file in the Allure result.
56
59
  **feature**
57
60
  ```ruby
58
61
  Feature: Attach File
62
+ @HIPTEST--1234
63
+ @JIRA++abc1234
59
64
  Scenario: This is an attaching file feature
60
65
  Given attach file
61
66
  ```
data/lib/allure_turnip.rb CHANGED
@@ -10,14 +10,13 @@ require 'allure_turnip/turnip_extension'
10
10
  module AllureTurnip
11
11
  module Config
12
12
  class << self
13
- attr_accessor :output_dir
14
- attr_accessor :clean_dir
15
- attr_accessor :logging_level
16
- attr_accessor :feature_with_filename
13
+ attr_accessor :output_dir, :clean_dir, :logging_level, :feature_with_filename, :tms_prefix, :issue_prefix
17
14
 
18
15
  DEFAULT_OUTPUT_DIR = 'gen/allure-results'
19
16
  DEFAULT_LOGGING_LEVEL = Logger::DEBUG
20
17
  DEFAULT_FEATURE_WITH_FILENAME = false
18
+ DEFAULT_TMS_PREFIX = '@TMS:'
19
+ DEFAULT_ISSUE_PREFIX = '@ISSUE:'
21
20
 
22
21
  def output_dir
23
22
  @output_dir || DEFAULT_OUTPUT_DIR
@@ -34,6 +33,14 @@ module AllureTurnip
34
33
  def feature_with_filename?
35
34
  @feature_with_filename || DEFAULT_FEATURE_WITH_FILENAME
36
35
  end
36
+
37
+ def tms_prefix
38
+ @tms_prefix || DEFAULT_TMS_PREFIX
39
+ end
40
+
41
+ def issue_prefix
42
+ @issue_prefix || DEFAULT_ISSUE_PREFIX
43
+ end
37
44
  end
38
45
  end
39
46
 
@@ -114,6 +114,7 @@ module AllureTurnip
114
114
  find_all { |value| !value[1].nil? }.
115
115
  inject({}) { |res, value| res.merge(value[0] => value[1]) }
116
116
  detect_feature_story(labels, example_or_group)
117
+ detect_tags(labels, example_or_group)
117
118
  labels
118
119
  end
119
120
 
@@ -121,6 +122,21 @@ module AllureTurnip
121
122
  metadata.respond_to?(key) ? metadata.send(key) : metadata[key]
122
123
  end
123
124
 
125
+ def detect_tags(labels, example_or_group)
126
+ keys = metadata(example_or_group).keys
127
+ testId = abstract_tags(keys, AllureTurnip::Config.tms_prefix)
128
+ issue = abstract_tags(keys, AllureTurnip::Config.issue_prefix)
129
+ labels[:testId] = testId if testId
130
+ labels[:issue] = issue if issue
131
+ end
132
+
133
+ def abstract_tags(keys, prefix)
134
+ prefix = prefix.gsub(/^@/, '')
135
+ keys.select {|key| key =~ /#{Regexp.escape(prefix)}/}
136
+ .map {|key| key.match(/#{Regexp.escape(prefix)}(.*)/)[1]}
137
+ .first
138
+ end
139
+
124
140
  def detect_feature_story(labels, example_or_group)
125
141
  metadata = metadata(example_or_group)
126
142
  is_group = group?(example_or_group)
@@ -1,5 +1,5 @@
1
1
  module AllureTurnip # :nodoc:
2
2
  module Version # :nodoc:
3
- STRING = '0.1.1'
3
+ STRING = '0.2.0'
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ Feature: Annotation
2
+
3
+ @HIPTEST--1234
4
+ @JIRA++abc123
5
+ Scenario: This is an annotation feature
6
+ Given there is a monster
7
+
8
+ @HIPTEST--5678
9
+ @JIRA++abc567
10
+ Scenario: This is an annotation feature2
11
+ Given there is a monster
data/spec/spec_helper.rb CHANGED
@@ -19,5 +19,7 @@ end
19
19
  AllureTurnip.configure do |c|
20
20
  c.output_dir = "allure"
21
21
  c.feature_with_filename = true
22
+ c.tms_prefix = '@HIPTEST--'
23
+ c.issue_prefix = '@JIRA++'
22
24
  end
23
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allure_turnip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aha-oretama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-09 00:00:00.000000000 Z
11
+ date: 2019-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -106,6 +106,7 @@ files:
106
106
  - rspec/file_check_spec.rb
107
107
  - rspec/spec_helper.rb
108
108
  - spec/ambiguous.feature
109
+ - spec/annotation.feature
109
110
  - spec/attach_file.feature
110
111
  - spec/autoload_steps.feature
111
112
  - spec/backgrounds.feature
@@ -157,5 +158,5 @@ requirements: []
157
158
  rubygems_version: 3.0.2
158
159
  signing_key:
159
160
  specification_version: 4
160
- summary: allure_turnip-0.1.1
161
+ summary: allure_turnip-0.2.0
161
162
  test_files: []