spec_tracker 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +7 -0
  4. data/CHANGELOG.md +48 -0
  5. data/CODE_OF_CONDUCT.md +76 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +79 -0
  8. data/LICENSE +24 -0
  9. data/README.md +84 -0
  10. data/Rakefile +10 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/exe/spec_tracker +5 -0
  14. data/lib/spec_tracker.rb +50 -0
  15. data/lib/spec_tracker/cli.rb +24 -0
  16. data/lib/spec_tracker/config/configuration.rb +23 -0
  17. data/lib/spec_tracker/config/en.yml +8 -0
  18. data/lib/spec_tracker/config/fr.yml +8 -0
  19. data/lib/spec_tracker/report_task.rb +26 -0
  20. data/lib/spec_tracker/reporter/base_reporter.rb +24 -0
  21. data/lib/spec_tracker/reporter/base_ui_mapper.rb +25 -0
  22. data/lib/spec_tracker/reporter/report.rb +17 -0
  23. data/lib/spec_tracker/reporter/report_datum.rb +13 -0
  24. data/lib/spec_tracker/reporter/report_mapper.rb +19 -0
  25. data/lib/spec_tracker/reporter/status_ui.rb +8 -0
  26. data/lib/spec_tracker/reporter/terminal/reporter.rb +28 -0
  27. data/lib/spec_tracker/reporter/terminal/ui_mapper.rb +13 -0
  28. data/lib/spec_tracker/spec_parser/base_parser.rb +36 -0
  29. data/lib/spec_tracker/spec_parser/csv_parser.rb +24 -0
  30. data/lib/spec_tracker/spec_parser/gherkin_parser.rb +27 -0
  31. data/lib/spec_tracker/spec_parser/scenario.rb +12 -0
  32. data/lib/spec_tracker/spec_parser/specification.rb +12 -0
  33. data/lib/spec_tracker/test_report_parser/base_mapper.rb +52 -0
  34. data/lib/spec_tracker/test_report_parser/base_parser.rb +43 -0
  35. data/lib/spec_tracker/test_report_parser/j_unit/mapper.rb +25 -0
  36. data/lib/spec_tracker/test_report_parser/j_unit/parser.rb +31 -0
  37. data/lib/spec_tracker/test_report_parser/test_result.rb +12 -0
  38. data/lib/spec_tracker/test_status.rb +46 -0
  39. data/lib/spec_tracker/version.rb +3 -0
  40. data/spec_tracker.gemspec +39 -0
  41. data/specifications/Spec Fonctionnelles SpecTracker - Configuration.csv +11 -0
  42. data/specifications/Spec Fonctionnelles SpecTracker - Parse specifications.csv +20 -0
  43. data/specifications/configuration.feature +11 -0
  44. data/specifications/parse_csv_specifications.feature +11 -0
  45. data/specifications/parse_gherkin_specifications.feature +11 -0
  46. metadata +249 -0
@@ -0,0 +1,25 @@
1
+ module SpecTracker
2
+ module TestReportParser
3
+ module JUnit
4
+ class Mapper < BaseMapper
5
+ private
6
+
7
+ def get_scenario_name(test_case)
8
+ test_case['name']
9
+ end
10
+
11
+ def failed?(testcase)
12
+ !success?(testcase) && !skipped?(testcase)
13
+ end
14
+
15
+ def success?(testcase)
16
+ testcase.xpath('child::*').empty?
17
+ end
18
+
19
+ def skipped?(testcase)
20
+ testcase.xpath('child::skipped').any?
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ module SpecTracker
2
+ module TestReportParser
3
+ module JUnit
4
+ class Parser < BaseParser
5
+ def initialize
6
+ @test_result_mapper = Mapper.new
7
+ end
8
+
9
+ private
10
+
11
+ attr_reader :test_result_mapper
12
+
13
+ def parse_single(file)
14
+ test_results = []
15
+ return test_results unless valid_extension?(file)
16
+ xml_report = File.open(file) {|f| Nokogiri::XML(f)}
17
+ test_cases(xml_report).each {|test_case| test_results << test_result_mapper.map(test_case)}
18
+ test_results
19
+ end
20
+
21
+ def file_extension
22
+ '.xml'.freeze
23
+ end
24
+
25
+ def test_cases(xml_report)
26
+ xml_report.xpath('//testcase')
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,12 @@
1
+ module SpecTracker
2
+ module TestReportParser
3
+ class TestResult
4
+ attr_reader :scenario_id, :status
5
+
6
+ def initialize(scenario_id:, status:)
7
+ @scenario_id = scenario_id
8
+ @status = status
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,46 @@
1
+ module SpecTracker
2
+ class TestStatus
3
+ def initialize
4
+ @status = nil
5
+ end
6
+
7
+ def success!
8
+ @status = SUCCESS
9
+ end
10
+
11
+ def success?
12
+ @status == SUCCESS
13
+ end
14
+
15
+ def failure!
16
+ @status = FAILURE
17
+ end
18
+
19
+ def failure?
20
+ @status == FAILURE
21
+ end
22
+
23
+ def skipped!
24
+ @status = SKIPPED
25
+ end
26
+
27
+ def skipped?
28
+ @status == SKIPPED
29
+ end
30
+
31
+ def missing!
32
+ @status = MISSING
33
+ end
34
+
35
+ def missing?
36
+ @status == MISSING
37
+ end
38
+
39
+ private
40
+
41
+ SUCCESS = 0.freeze
42
+ FAILURE = 1.freeze
43
+ SKIPPED = 2.freeze
44
+ MISSING = 3.freeze
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ module SpecTracker
2
+ VERSION = "1.2.0"
3
+ end
@@ -0,0 +1,39 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "spec_tracker/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "spec_tracker"
8
+ spec.version = SpecTracker::VERSION
9
+ spec.licenses = ['Apache-2.0']
10
+ spec.authors = ["Joanna Vigné"]
11
+ spec.email = ["joanna.vigne@fabernovel.com"]
12
+
13
+ spec.summary = %q{Track tests that validate specification use cases}
14
+ spec.description = %q{Get an overview of your project traceability matrix.}
15
+ spec.homepage = %q{https://github.com/jvigne/spec_tracker}
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.17"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "minitest", "~> 5.0"
29
+ spec.add_development_dependency "byebug", '~> 9.0'
30
+ spec.add_development_dependency "minitest-reporters", '~> 1.3'
31
+ spec.add_development_dependency "activesupport", '>= 3.0', '< 6.0'
32
+ spec.add_dependency 'nokogiri', '~> 1.10'
33
+ spec.add_dependency 'terminal-table', '~> 1.8'
34
+ spec.add_dependency 'gemoji', '~> 3.0'
35
+ spec.add_dependency 'thor', '~> 0.20'
36
+ spec.add_dependency 'cucumber', '~> 3.1'
37
+
38
+ spec.required_ruby_version = "~> 2.3"
39
+ end
@@ -0,0 +1,11 @@
1
+ Ecran,#Feature,#Scenario,Scenario ID,Category,Name/Rule,Extra comment,Platform,Biz Value,Criticity,Estim Dev iOS,Estim Dev Android,Screen iOS,Screen Android,Redmine URL iOS,Version iOS,Status iOS,Estimate iOS,Time spent iOS,% Completed iOS,Priority iOS,Redmine URL Android,Version Android,Status Android,Estimate Android,Time spent Android,% Completed Android,Priority Android
2
+ 0 - Ecran 1,,,,,,,,,,,`,,,,,,,,,,,,,,,,
3
+ ,0.4,,,,Configuration,,All,A,,6,,,,,,,,,,,,,,,,,
4
+ ,,0.4.1,default-configuration,,Apply default configuration,,Android only,A,,,,,,,,,,,,,,,,,,,
5
+ ,,,,Condition,Provide no configuration,,,,,,,,,,,,,,,,,,,,,,
6
+ ,,,,Action,Configure the library,,,,,,,,,,,,,,,,,,,,,,
7
+ ,,,,Traitement,Get the default configuration,,,,,,,,,,,,,,,,,,,,,,
8
+ ,,0.4.2,local-configuration,,Apply local configuration,,iOS only,B,,,,,,,,,,,,,,,,,,,
9
+ ,,,,Condition,Provide configuration,,,,,,,,,,,,,,,,,,,,,,
10
+ ,,,,Action,configure the library,,,,,,,,,,,,,,,,,,,,,,
11
+ ,,,,Traitement,Get the local configuration,,,,,,,,,,,,,,,,,,,,,,
@@ -0,0 +1,20 @@
1
+ Ecran,#Feature,#Scenario,Scenario ID,Category,Name/Rule,Extra comment,Platform,Biz Value,Criticity,Estim Dev iOS,Estim Dev Android,Screen iOS,Screen Android,Redmine URL iOS,Version iOS,Status iOS,Estimate iOS,Time spent iOS,% Completed iOS,Priority iOS,Redmine URL Android,Version Android,Status Android,Estimate Android,Time spent Android,% Completed Android,Priority Android
2
+ 0 - Ecran 1,,,,,,,,,,,`,,,,,,,,,,,,,,,,
3
+ ,0.2,,,,Parse CSV specifications,,All,A,,6,,,,,,,,,,,,,,,,,
4
+ ,,0.2.1,single-csv-file,,Get scenarios from a single specification file,,Android only,A,,,,,,,,,,,,,,,,,,,
5
+ ,,,,Condition,the configuration indicates a path to a csv file with a header matching the configuration,,,,,,,,,,,,,,,,,,,,,,
6
+ ,,,,Action,parsing the file,,,,,,,,,,,,,,,,,,,,,,
7
+ ,,,,Traitement,return the scenarios matching the regexp from the file,,,,,,,,,,,,,,,,,,,,,,
8
+ ,,0.2.2,multiple-csv-files,,Get scenarios from multiple specification files,,iOS only,B,,,,,,,,,,,,,,,,,,,
9
+ ,,,,Condition,the configuration indicates a path to folder containing multiple a csv files with a header matching the configuration,,,,,,,,,,,,,,,,,,,,,,
10
+ ,,,,Action,parsing the files,,,,,,,,,,,,,,,,,,,,,,
11
+ ,,,,Traitement,return the scenarios matching the regexp from all the files,,,,,,,,,,,,,,,,,,,,,,
12
+ ,0.3,,,,Parse Gherkin specifications,,All,B,,5,,,,,,,,,,,,,,,,,
13
+ ,,0.3.1,single-gherkin-file,,Get scenarios from a single specification file,,Android only,C,,,,,,,,,,,,,,,,,,,
14
+ ,,,,Condition,the configuration indicates a path to a csv file with a header matching the configuration,,,,,,,,,,,,,,,,,,,,,,
15
+ ,,,,Action,parsing the file,,,,,,,,,,,,,,,,,,,,,,
16
+ ,,,,Traitement,return the scenarios matching the regexp from the file,,,,,,,,,,,,,,,,,,,,,,
17
+ ,,0.3.2,multiple-gherkin-files,,Get scenarios from multiple specification files,,iOS only,B,,,,,,,,,,,,,,,,,,,
18
+ ,,,,Condition,the configuration indicates a path to folder containing multiple a csv files with a header matching the configuration,,,,,,,,,,,,,,,,,,,,,,
19
+ ,,,,Action,parsing the files,,,,,,,,,,,,,,,,,,,,,,
20
+ ,,,,Traitement,return the scenarios matching the regexp from all the files,,,,,,,,,,,,,,,,,,,,,,
@@ -0,0 +1,11 @@
1
+ Feature: Configuration
2
+
3
+ Scenario: [default-configuration] En tant qu'utilisateur je peux utiliser la configuration par défaut
4
+ Given En tant qu'utilisateur
5
+ When Quand je ne précise pas de configuration
6
+ Then Une configuration par défaut est appliquée
7
+
8
+ Scenario: [local-configuration] En tant qu'utilisateur je peux modifier la configuration de la commande de rapport
9
+ Given: En tant qu'utilisateur
10
+ When: Quand je modifie des paramètres de configuration
11
+ Then: les valeurs fournies remplacent les valeurs précédentes de la configuration
@@ -0,0 +1,11 @@
1
+ Feature: Parse CSV specifications
2
+
3
+ Scenario: [single-csv-file] Get scenarios from a single specification file
4
+ Given: the configuration indicates a path to a csv file with a header matching the configuration
5
+ When parsing the file
6
+ Then return the scenarios matching the regexp from the file
7
+
8
+ Scenario: [multiple-csv-files] Get scenarios from multiple specification files
9
+ Given the configuration indicates a path to folder containing multiple a csv files with a header matching the configuration
10
+ When parsing the files
11
+ Then return the scenarios matching the regexp from all the files
@@ -0,0 +1,11 @@
1
+ Feature: Parse Gherkin specifications
2
+
3
+ Scenario: [single-gherkin-file] Get scenarios from a single specification file
4
+ Given the configuration indicates a path to a csv file with a header matching the configuration
5
+ When parsing the file
6
+ Then return the scenarios matching the regexp from the file
7
+
8
+ Scenario: [multiple-gherkin-files] Get scenarios from multiple specification files
9
+ Given the configuration indicates a path to folder containing multiple a csv files with a header matching the configuration
10
+ When parsing the files
11
+ Then return the scenarios matching the regexp from all the files
metadata ADDED
@@ -0,0 +1,249 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spec_tracker
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Joanna Vigné
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '9.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '9.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-reporters
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '6.0'
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '3.0'
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '6.0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: nokogiri
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.10'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.10'
117
+ - !ruby/object:Gem::Dependency
118
+ name: terminal-table
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.8'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.8'
131
+ - !ruby/object:Gem::Dependency
132
+ name: gemoji
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '3.0'
138
+ type: :runtime
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '3.0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: thor
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '0.20'
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '0.20'
159
+ - !ruby/object:Gem::Dependency
160
+ name: cucumber
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '3.1'
166
+ type: :runtime
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '3.1'
173
+ description: Get an overview of your project traceability matrix.
174
+ email:
175
+ - joanna.vigne@fabernovel.com
176
+ executables:
177
+ - spec_tracker
178
+ extensions: []
179
+ extra_rdoc_files: []
180
+ files:
181
+ - ".gitignore"
182
+ - ".travis.yml"
183
+ - CHANGELOG.md
184
+ - CODE_OF_CONDUCT.md
185
+ - Gemfile
186
+ - Gemfile.lock
187
+ - LICENSE
188
+ - README.md
189
+ - Rakefile
190
+ - bin/console
191
+ - bin/setup
192
+ - exe/spec_tracker
193
+ - lib/spec_tracker.rb
194
+ - lib/spec_tracker/cli.rb
195
+ - lib/spec_tracker/config/configuration.rb
196
+ - lib/spec_tracker/config/en.yml
197
+ - lib/spec_tracker/config/fr.yml
198
+ - lib/spec_tracker/report_task.rb
199
+ - lib/spec_tracker/reporter/base_reporter.rb
200
+ - lib/spec_tracker/reporter/base_ui_mapper.rb
201
+ - lib/spec_tracker/reporter/report.rb
202
+ - lib/spec_tracker/reporter/report_datum.rb
203
+ - lib/spec_tracker/reporter/report_mapper.rb
204
+ - lib/spec_tracker/reporter/status_ui.rb
205
+ - lib/spec_tracker/reporter/terminal/reporter.rb
206
+ - lib/spec_tracker/reporter/terminal/ui_mapper.rb
207
+ - lib/spec_tracker/spec_parser/base_parser.rb
208
+ - lib/spec_tracker/spec_parser/csv_parser.rb
209
+ - lib/spec_tracker/spec_parser/gherkin_parser.rb
210
+ - lib/spec_tracker/spec_parser/scenario.rb
211
+ - lib/spec_tracker/spec_parser/specification.rb
212
+ - lib/spec_tracker/test_report_parser/base_mapper.rb
213
+ - lib/spec_tracker/test_report_parser/base_parser.rb
214
+ - lib/spec_tracker/test_report_parser/j_unit/mapper.rb
215
+ - lib/spec_tracker/test_report_parser/j_unit/parser.rb
216
+ - lib/spec_tracker/test_report_parser/test_result.rb
217
+ - lib/spec_tracker/test_status.rb
218
+ - lib/spec_tracker/version.rb
219
+ - spec_tracker.gemspec
220
+ - specifications/Spec Fonctionnelles SpecTracker - Configuration.csv
221
+ - specifications/Spec Fonctionnelles SpecTracker - Parse specifications.csv
222
+ - specifications/configuration.feature
223
+ - specifications/parse_csv_specifications.feature
224
+ - specifications/parse_gherkin_specifications.feature
225
+ homepage: https://github.com/jvigne/spec_tracker
226
+ licenses:
227
+ - Apache-2.0
228
+ metadata: {}
229
+ post_install_message:
230
+ rdoc_options: []
231
+ require_paths:
232
+ - lib
233
+ required_ruby_version: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - "~>"
236
+ - !ruby/object:Gem::Version
237
+ version: '2.3'
238
+ required_rubygems_version: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
243
+ requirements: []
244
+ rubyforge_project:
245
+ rubygems_version: 2.7.6
246
+ signing_key:
247
+ specification_version: 4
248
+ summary: Track tests that validate specification use cases
249
+ test_files: []