cuke_cataloger 1.6.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -3
- data/LICENSE.txt +1 -1
- data/README.md +11 -11
- data/cuke_cataloger.gemspec +33 -13
- data/exe/cuke_cataloger +53 -0
- data/lib/cuke_cataloger/formatters/text_report_formatter.rb +7 -2
- data/lib/cuke_cataloger/rake_tasks.rb +9 -4
- data/lib/cuke_cataloger/unique_test_case_tagger.rb +152 -147
- data/lib/cuke_cataloger/version.rb +1 -1
- data/lib/cuke_cataloger.rb +0 -1
- metadata +90 -51
- data/.cucumberproignore +0 -1
- data/.gitignore +0 -18
- data/.simplecov +0 -7
- data/.travis.yml +0 -67
- data/Gemfile +0 -41
- data/Rakefile +0 -70
- data/appveyor.yml +0 -188
- data/bin/cuke_cataloger +0 -49
- data/testing/cucumber/step_definitions/action_steps.rb +0 -64
- data/testing/cucumber/step_definitions/setup_steps.rb +0 -76
- data/testing/cucumber/step_definitions/verification_steps.rb +0 -211
- data/testing/cucumber/support/env.rb +0 -40
- data/testing/file_helper.rb +0 -42
- data/testing/fixtures/Rakefile +0 -19
- data/testing/fixtures/tests/foo.feature +0 -11
- data/testing/gemfiles/cql1.gemfile +0 -40
- data/testing/gemfiles/cuke_modeler0.gemfile +0 -35
- data/testing/gemfiles/cuke_modeler1.gemfile +0 -35
- data/testing/gemfiles/cuke_modeler2.gemfile +0 -35
- data/testing/gemfiles/cuke_modeler3.gemfile +0 -9
- data/testing/gemfiles/rake10.gemfile +0 -38
- data/testing/gemfiles/rake11.gemfile +0 -30
- data/testing/gemfiles/rake12.gemfile +0 -35
- data/testing/gemfiles/rake13.gemfile +0 -8
- data/testing/gemfiles/thor0.gemfile +0 -39
- data/testing/gemfiles/thor1.gemfile +0 -11
- data/testing/rspec/spec/cuke_cataloger_spec.rb +0 -22
- data/testing/rspec/spec/spec_helper.rb +0 -23
- data/testing/rspec/spec/unique_test_case_tagger_integration_spec.rb +0 -295
- data/testing/rspec/spec/unique_test_case_tagger_unit_spec.rb +0 -81
- data/todo.txt +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3fd5cae38ab765ef2915d216509608ce7bbf28767baf54b370bf19eff41c90
|
4
|
+
data.tar.gz: 040f1d882042efd4a4da63f8fbcbaa0d1b37ad3e3126b54a3beb809088dfa419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e57370bfb86b86f211c93641f0fba504279570612502d2dfce5d790c1c6061b93b2b4489bcacc4d206f51e9e748d0942633faba01a54cff1bf3ad785310cdd83
|
7
|
+
data.tar.gz: 3a48e9559901b71336a48adb65172de4d739975b3c883859ed5f184647ecc5bfb5ad2f703eb1b3f46697956e99224ecfd55b48efe9cef59783cce3392772c521
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
|
9
9
|
Nothing yet...
|
10
10
|
|
11
|
+
## [2.0.0] - 2022-02-05
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- Added support for Ruby 3.x
|
16
|
+
|
17
|
+
### Removed
|
18
|
+
|
19
|
+
- Removed support for some older versions of the gem's dependencies:
|
20
|
+
- Ruby 1.x
|
21
|
+
- Rake 0.x
|
22
|
+
- CukeModeler 0.x
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
- Test case IDs are no longer erroneously detected if a tag only partially matches the ID pattern. For example, the
|
27
|
+
gem would incorrectly identify `@test_case_123_plus_more` as an ID tag even though it was not one.
|
28
|
+
- Cataloging tests now correctly handles tests that are nested in rules. Previously, the presence of a `Rule`
|
29
|
+
keyword would cause new ID tags to be placed on the wrong lines in the cataloged file.
|
30
|
+
|
31
|
+
|
11
32
|
## [1.6.0] - 2020-06-21
|
12
33
|
|
13
34
|
### Added
|
@@ -24,7 +45,8 @@ Nothing yet...
|
|
24
45
|
## [1.5.0] - 2018-09-09
|
25
46
|
|
26
47
|
### Added
|
27
|
-
- The default cataloging prefix used by the Rake tasks is now also the default prefix used by the various object
|
48
|
+
- The default cataloging prefix used by the Rake tasks is now also the default prefix used by the various object
|
49
|
+
based methods.
|
28
50
|
|
29
51
|
## [1.4.1] - 2017-07-09
|
30
52
|
|
@@ -46,7 +68,8 @@ Nothing yet...
|
|
46
68
|
|
47
69
|
### Added
|
48
70
|
- Added an executable file for the gem so that it can be used without having to use Rake tasks.
|
49
|
-
- A basic cataloging location and prefix is used by default so that specifying these values will not be necessary in
|
71
|
+
- A basic cataloging location and prefix is used by default so that specifying these values will not be necessary in
|
72
|
+
many cases.
|
50
73
|
|
51
74
|
### Fixed
|
52
75
|
- Replaced non-Ruby 1.8.x compatible code so that the gem now correctly works with older versions of Ruby.
|
@@ -68,7 +91,8 @@ Nothing yet...
|
|
68
91
|
- Initial release
|
69
92
|
|
70
93
|
|
71
|
-
[Unreleased]: https://github.com/enkessler/cuke_cataloger/compare/
|
94
|
+
[Unreleased]: https://github.com/enkessler/cuke_cataloger/compare/v2.0.0...HEAD
|
95
|
+
[2.0.0]: https://github.com/enkessler/cuke_cataloger/compare/v1.6.0...v2.0.0
|
72
96
|
[1.6.0]: https://github.com/enkessler/cuke_cataloger/compare/v1.5.0...v1.6.0
|
73
97
|
[1.5.0]: https://github.com/enkessler/cuke_cataloger/compare/v1.4.1...v1.5.0
|
74
98
|
[1.4.1]: https://github.com/enkessler/cuke_cataloger/compare/v1.4.0...v1.4.1
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -4,15 +4,14 @@ Basic stuff:
|
|
4
4
|
[![Downloads](https://img.shields.io/gem/dt/cuke_cataloger.svg)](https://rubygems.org/gems/cuke_cataloger)
|
5
5
|
|
6
6
|
User stuff:
|
7
|
-
[![Cucumber Docs](http://img.shields.io/badge/Documentation-Features-green.svg)](https://
|
7
|
+
[![Cucumber Docs](http://img.shields.io/badge/Documentation-Features-green.svg)](https://github.com/enkessler/cuke_cataloger/tree/master/testing/cucumber/features)
|
8
8
|
[![Yard Docs](http://img.shields.io/badge/Documentation-API-blue.svg)](https://www.rubydoc.info/gems/cuke_cataloger)
|
9
9
|
|
10
10
|
Developer stuff:
|
11
|
-
[![Build Status](https://
|
12
|
-
[![
|
13
|
-
[![Coverage Status](https://coveralls.io/repos/github/enkessler/cuke_cataloger/badge.svg)](https://coveralls.io/github/enkessler/cuke_cataloger)
|
11
|
+
[![Build Status](https://github.com/enkessler/cuke_cataloger/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/enkessler/cuke_cataloger/actions/workflows/ci.yml?query=branch%3Amaster)
|
12
|
+
[![Coverage Status](https://coveralls.io/repos/github/enkessler/cuke_cataloger/badge.svg?branch=master)](https://coveralls.io/github/enkessler/cuke_cataloger?branch=master)
|
14
13
|
[![Maintainability](https://api.codeclimate.com/v1/badges/662f0e7aa69bf9725515/maintainability)](https://codeclimate.com/github/enkessler/cuke_cataloger/maintainability)
|
15
|
-
[![Inline docs](http://inch-ci.org/github/enkessler/cuke_cataloger.svg)](https://inch-ci.org/github/enkessler/cuke_cataloger)
|
14
|
+
[![Inline docs](http://inch-ci.org/github/enkessler/cuke_cataloger.svg?branch=master)](https://inch-ci.org/github/enkessler/cuke_cataloger)
|
16
15
|
|
17
16
|
|
18
17
|
---
|
@@ -164,11 +163,12 @@ By default, the cataloging and validation process uses `test_case_id` as the col
|
|
164
163
|
|
165
164
|
`Rake::Task['validate_tests'].invoke('./features','@test_case_',nil, true, 'my_special_column_id') # 5th argument is the id column name`
|
166
165
|
|
166
|
+
For more information and usage examples, see the documentation [here](https://github.com/enkessler/cuke_cataloger/tree/master/testing/cucumber/features).
|
167
167
|
|
168
|
-
## Contributing
|
168
|
+
## Development and Contributing
|
169
169
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
170
|
+
See [CONTRIBUTING.md](https://github.com/enkessler/cuke_cataloger/blob/master/CONTRIBUTING.md)
|
171
|
+
|
172
|
+
## License
|
173
|
+
|
174
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/cuke_cataloger.gemspec
CHANGED
@@ -1,33 +1,53 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'cuke_cataloger/version'
|
5
4
|
|
6
|
-
Gem::Specification.new do |spec|
|
5
|
+
Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength - Gemspecs inherently have a lot of lines
|
7
6
|
spec.name = 'cuke_cataloger'
|
8
7
|
spec.version = CukeCataloger::VERSION
|
9
8
|
spec.authors = ['Eric Kessler']
|
10
9
|
spec.email = ['morrow748@gmail.com']
|
11
10
|
spec.summary = 'A tool to give every Cucumber test a unique id'
|
12
|
-
spec.description = 'Scans existing Cucumber tests and updates them to include an id tag that is unique for the
|
11
|
+
spec.description = ['Scans existing Cucumber tests and updates them to include an id tag that is unique for the ',
|
12
|
+
'test suite.'].join
|
13
13
|
spec.homepage = 'https://github.com/enkessler/cuke_cataloger'
|
14
14
|
spec.license = 'MIT'
|
15
|
+
spec.metadata = {
|
16
|
+
'bug_tracker_uri' => 'https://github.com/enkessler/cuke_cataloger/issues',
|
17
|
+
'changelog_uri' => 'https://github.com/enkessler/cuke_cataloger/blob/master/CHANGELOG.md',
|
18
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/cuke_cataloger',
|
19
|
+
'homepage_uri' => 'https://github.com/enkessler/cuke_cataloger',
|
20
|
+
'source_code_uri' => 'https://github.com/enkessler/cuke_cataloger'
|
21
|
+
}
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
spec.
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path('', __dir__)) do
|
26
|
+
source_controlled_files = `git ls-files -z`.split("\x0")
|
27
|
+
source_controlled_files.keep_if { |file| file =~ %r{^(lib|exe|testing/cucumber/features)} }
|
28
|
+
source_controlled_files + ['README.md', 'LICENSE.txt', 'CHANGELOG.md', 'cuke_cataloger.gemspec']
|
29
|
+
end
|
30
|
+
|
31
|
+
spec.bindir = 'exe'
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
33
|
spec.require_paths = ['lib']
|
20
34
|
|
21
|
-
spec.
|
35
|
+
spec.required_ruby_version = '>= 2.0', '< 4.0'
|
36
|
+
|
37
|
+
spec.add_runtime_dependency 'cuke_modeler', '>= 1.0', '< 4.0'
|
22
38
|
spec.add_runtime_dependency 'cql', '>= 1.0.1', '< 2.0'
|
23
|
-
spec.add_runtime_dependency 'rake', '< 14.0'
|
39
|
+
spec.add_runtime_dependency 'rake', '>=10.0', '< 14.0'
|
24
40
|
spec.add_runtime_dependency 'thor', '< 2.0'
|
25
41
|
|
26
|
-
spec.add_development_dependency
|
42
|
+
spec.add_development_dependency 'childprocess', '< 5.0'
|
43
|
+
spec.add_development_dependency 'ffi', '< 2.0' # This is an invisible dependency for the `childprocess` gem on Windows
|
44
|
+
spec.add_development_dependency 'bundler', '< 3'
|
27
45
|
spec.add_development_dependency 'cucumber', '< 4.0'
|
28
46
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency 'simplecov', '< 1.0'
|
31
|
-
spec.add_development_dependency 'coveralls', '< 1.0'
|
47
|
+
spec.add_development_dependency 'simplecov', '~> 0.18'
|
48
|
+
spec.add_development_dependency 'simplecov-lcov', '< 1.0'
|
32
49
|
spec.add_development_dependency 'rainbow', '< 4.0.0'
|
50
|
+
spec.add_development_dependency 'rubocop', '<= 0.50.0' # RuboCop can not lint against Ruby 2.0 after this version
|
51
|
+
spec.add_development_dependency 'yard', '< 1.0'
|
52
|
+
spec.add_development_dependency 'pry', '< 0.14'
|
33
53
|
end
|
data/exe/cuke_cataloger
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'cuke_cataloger'
|
5
|
+
|
6
|
+
# The Command Line Interface for the gem
|
7
|
+
class CLI < Thor
|
8
|
+
|
9
|
+
desc 'catalog_test_cases',
|
10
|
+
'Catalog the test cases in LOCATION with an id based on PREFIX'
|
11
|
+
option :location, default: '.'
|
12
|
+
option :prefix, default: '@test_case_'
|
13
|
+
option :row_id, type: :boolean, default: true
|
14
|
+
option :id_column_name, default: 'test_case_id'
|
15
|
+
|
16
|
+
def catalog_test_cases # rubocop:disable Metrics/AbcSize - Seems to be reporting high for some reason
|
17
|
+
puts "Tagging tests in '#{options[:location]}' with tag '#{options[:prefix]}'\n"
|
18
|
+
puts "Including outline rows\n" if options[:row_id]
|
19
|
+
|
20
|
+
tagger = CukeCataloger::UniqueTestCaseTagger.new
|
21
|
+
tagger.tag_tests(options[:location], options[:prefix], {}, options[:row_id], options[:id_column_name])
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'validate_test_cases',
|
25
|
+
'Validate the test cases in LOCATION with an id based on PREFIX. Will output the report to FILE, if provided.'
|
26
|
+
option :location, default: '.'
|
27
|
+
option :prefix, default: '@test_case_'
|
28
|
+
option :row_id, type: :boolean, default: true
|
29
|
+
option :id_column_name, default: 'test_case_id'
|
30
|
+
option :file
|
31
|
+
|
32
|
+
def validate_test_cases # rubocop:disable Metrics/AbcSize - Seems to be reporting high for some reason
|
33
|
+
puts "Validating tests in '#{options[:location]}' with tag '#{options[:prefix]}'\n"
|
34
|
+
puts "Including outline rows\n" if options[:row_id]
|
35
|
+
|
36
|
+
results = CukeCataloger::UniqueTestCaseTagger.new.validate_test_ids(options[:location],
|
37
|
+
options[:prefix],
|
38
|
+
options[:row_id],
|
39
|
+
options[:id_column_name])
|
40
|
+
report_text = CukeCataloger::TextReportFormatter.new.format_data(results)
|
41
|
+
|
42
|
+
if options[:file]
|
43
|
+
puts "Problems found: #{results.count}"
|
44
|
+
File.open(options[:file], 'w') { |file| file.write(report_text) }
|
45
|
+
else
|
46
|
+
puts report_text
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
CLI.start(ARGV)
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# TODO: have better testing so that this can be safely refactored
|
2
|
+
# rubocop:disable Metrics/AbcSize - Not going to mess with this, given how little testing is present
|
3
|
+
|
1
4
|
module CukeCataloger
|
2
5
|
|
3
6
|
# Not a part of the public API. Subject to change at any time.
|
@@ -14,11 +17,11 @@ module CukeCataloger
|
|
14
17
|
results_by_category[result[:problem]] << result
|
15
18
|
end
|
16
19
|
|
17
|
-
results_by_category.
|
20
|
+
results_by_category.each_key do |problem_category|
|
18
21
|
report_text << "#{problem_category} problems: #{results_by_category[problem_category].count}\n"
|
19
22
|
end
|
20
23
|
|
21
|
-
results_by_category.
|
24
|
+
results_by_category.each_key do |problem_category|
|
22
25
|
report_text << "\n\n#{problem_category} problems (#{results_by_category[problem_category].count}):\n"
|
23
26
|
|
24
27
|
results_by_category[problem_category].each do |result|
|
@@ -31,3 +34,5 @@ module CukeCataloger
|
|
31
34
|
|
32
35
|
end
|
33
36
|
end
|
37
|
+
|
38
|
+
# rubocop:enable Metrics/AbcSize
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# TODO: have better testing so that this can be safely refactored
|
2
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/LineLength, Metrics/MethodLength, Metrics/PerceivedComplexity - Not going to mess with this, given how little testing is present
|
3
|
+
|
4
|
+
|
5
|
+
# The top level namespace used by this gem
|
1
6
|
module CukeCataloger
|
2
7
|
|
3
8
|
extend Rake::DSL
|
@@ -5,9 +10,8 @@ module CukeCataloger
|
|
5
10
|
|
6
11
|
# Adds the gem's provided Rake tasks to the namespace from which the method is called
|
7
12
|
def self.create_tasks
|
8
|
-
|
9
13
|
desc 'Add unique id tags to tests in the given directory'
|
10
|
-
task 'tag_tests', [:directory, :prefix, :row_id, :id_column_name] do |
|
14
|
+
task 'tag_tests', [:directory, :prefix, :row_id, :id_column_name] do |_t, args|
|
11
15
|
location = args[:directory] || '.'
|
12
16
|
prefix = args[:prefix] || '@test_case_'
|
13
17
|
tag_rows = args[:row_id].nil? ? true : args[:row_id]
|
@@ -21,7 +25,7 @@ module CukeCataloger
|
|
21
25
|
end
|
22
26
|
|
23
27
|
desc 'Scan tests in the given directory for id problems'
|
24
|
-
task 'validate_tests', [:directory, :prefix, :out_file, :row_id, :id_column_name] do |
|
28
|
+
task 'validate_tests', [:directory, :prefix, :out_file, :row_id, :id_column_name] do |_t, args|
|
25
29
|
location = args[:directory] || '.'
|
26
30
|
prefix = args[:prefix] || '@test_case_'
|
27
31
|
tag_rows = args[:row_id].nil? ? true : args[:row_id]
|
@@ -40,7 +44,8 @@ module CukeCataloger
|
|
40
44
|
puts report_text
|
41
45
|
end
|
42
46
|
end
|
43
|
-
|
44
47
|
end
|
45
48
|
|
46
49
|
end
|
50
|
+
|
51
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/LineLength, Metrics/MethodLength, Metrics/PerceivedComplexity
|