cuke_cataloger 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -18
- data/.travis.yml +4 -2
- data/Gemfile +22 -22
- data/History.md +7 -0
- data/LICENSE.txt +22 -22
- data/README.md +67 -67
- data/Rakefile +12 -3
- data/cuke_cataloger.gemspec +7 -8
- data/lib/cuke_cataloger/unique_test_case_tagger.rb +45 -13
- data/lib/cuke_cataloger/version.rb +3 -3
- data/{features → testing/cucumber/features}/formatting.feature +0 -0
- data/{features → testing/cucumber/features}/tag_indexing.feature +0 -0
- data/{features → testing/cucumber/features}/test_case_scanning.feature +0 -0
- data/{features → testing/cucumber/features}/test_case_scanning_payload.feature +2 -2
- data/{features → testing/cucumber/features}/test_case_tagging.feature +0 -0
- data/{features → testing/cucumber/features}/test_case_validation.feature +0 -0
- data/{features → testing/cucumber}/step_definitions/action_steps.rb +0 -0
- data/{features → testing/cucumber}/step_definitions/setup_steps.rb +0 -0
- data/{features → testing/cucumber}/step_definitions/verification_steps.rb +4 -2
- data/{features → testing/cucumber}/support/env.rb +0 -0
- data/{features → testing/cucumber}/support/transforms.rb +0 -0
- data/testing/gemfiles/cuke_modeler0.gemfile +21 -0
- data/testing/gemfiles/cuke_modeler1.gemfile +21 -0
- data/{spec → testing/rspec/spec}/spec_helper.rb +0 -0
- data/{spec → testing/rspec/spec}/unique_test_case_tagger_integration_spec.rb +2 -1
- data/{spec → testing/rspec/spec}/unique_test_case_tagger_unit_spec.rb +2 -1
- metadata +65 -108
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 574e7e5f5cb470529c0e545dee407f89e341ba2e
|
4
|
+
data.tar.gz: b2c082b82da4209fb75fd45baed7ce98b7c4bbe8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 663b06f1515ac03d009001a2489d0bfbc8fbaae5b2567a8db1b10abbaf8db5b24e3d3a37d9d5b38b5de5490def11094ddc644efedbc35d4acd9bc419d654867f
|
7
|
+
data.tar.gz: a341cfdd22f16abb4cb7775fb994f23cd4becca8ce7163d74637ee4a868206e7bfa337befec5b4bfbd32268cc35dda87e510e5d8bedde4c5cfd0336b6c91096c
|
data/.gitignore
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
/.idea/
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
/.idea/
|
data/.travis.yml
CHANGED
@@ -2,10 +2,12 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 1.8.7
|
4
4
|
- 1.9.3
|
5
|
-
- 2.0.0
|
6
|
-
- 2.1.6
|
7
5
|
- 2.2.2
|
8
6
|
|
7
|
+
gemfile:
|
8
|
+
- testing/gemfiles/cuke_modeler0.gemfile
|
9
|
+
- testing/gemfiles/cuke_modeler1.gemfile
|
10
|
+
|
9
11
|
# todo - Remove this once TravisCI fixes their bundler issue (https://github.com/alphagov/govuk_template/pull/186)
|
10
12
|
before_install:
|
11
13
|
- gem install bundler -v 1.9.10
|
data/Gemfile
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
source '
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in cuke_cataloger.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
gem '
|
10
|
-
gem '
|
11
|
-
gem '
|
12
|
-
elsif RUBY_VERSION =~ /^1\./
|
13
|
-
gem 'cucumber', '<2.0.0'
|
14
|
-
end
|
15
|
-
|
16
|
-
if RUBY_VERSION
|
17
|
-
|
18
|
-
#
|
19
|
-
gem '
|
20
|
-
end
|
21
|
-
|
22
|
-
gem '
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in cuke_cataloger.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
|
7
|
+
# cuke_cataloger can play with pretty much any version of these but they all play differently with Ruby
|
8
|
+
if RUBY_VERSION =~ /^1\.8/
|
9
|
+
gem 'cucumber', '< 1.3.0'
|
10
|
+
gem 'gherkin', '< 2.12.0'
|
11
|
+
gem 'rake', '< 11.0' # Rake dropped 1.8.x support after this version
|
12
|
+
elsif RUBY_VERSION =~ /^1\./
|
13
|
+
gem 'cucumber', '< 2.0.0'
|
14
|
+
end
|
15
|
+
|
16
|
+
if RUBY_VERSION =~ /^1\./
|
17
|
+
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
18
|
+
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
19
|
+
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
20
|
+
end
|
21
|
+
|
22
|
+
gem 'cuke_modeler', '~> 1.0'
|
data/History.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Release history
|
2
2
|
|
3
|
+
### Version 1.2.0 / 2016-10-02
|
4
|
+
|
5
|
+
- The gem now declares version limits on all of its dependencies.
|
6
|
+
|
7
|
+
- Added support for the 1.x series of the 'cuke_modeler' gem.
|
8
|
+
|
9
|
+
|
3
10
|
### Version 1.1.0 / 2016-02-21
|
4
11
|
|
5
12
|
- Upgraded to a more recent version of the 'cuke_modeler' gem and removed monkey patches that were
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2014 Eric Kessler
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2014 Eric Kessler
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,67 +1,67 @@
|
|
1
|
-
# CukeCataloger
|
2
|
-
|
3
|
-
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/cuke_cataloger.svg)](http://badge.fury.io/rb/cuke_cataloger)
|
5
|
-
[![Build Status](https://travis-ci.org/enkessler/cuke_cataloger.svg?branch=master)](https://travis-ci.org/enkessler/cuke_cataloger)
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/enkessler/cuke_cataloger/badge.svg?branch=master&service=github)](https://coveralls.io/github/enkessler/cuke_cataloger?branch=master)
|
7
|
-
[![Code Climate](https://codeclimate.com/github/enkessler/cuke_cataloger/badges/gpa.svg)](https://codeclimate.com/github/enkessler/cuke_cataloger)
|
8
|
-
[![Project License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/enkessler/cuke_cataloger/blob/master/LICENSE.txt)
|
9
|
-
|
10
|
-
|
11
|
-
The cuke_cataloger gem is a convenient way to provide a unique id to every test case in your Cucumber test suite.
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
Add this line to your application's Gemfile:
|
16
|
-
|
17
|
-
gem 'cuke_cataloger'
|
18
|
-
|
19
|
-
And then execute:
|
20
|
-
|
21
|
-
$ bundle
|
22
|
-
|
23
|
-
Or install it yourself as:
|
24
|
-
|
25
|
-
$ gem install cuke_cataloger
|
26
|
-
|
27
|
-
## Usage
|
28
|
-
|
29
|
-
The simplest way to use this gem is to include the Rake tasks that it provides in your project. Just require the gem
|
30
|
-
|
31
|
-
require 'cuke_cataloger'
|
32
|
-
|
33
|
-
and then call its task creation method in your Rakefile (or wherever you like to keep your Rake tasks) in order to generate the tasks.
|
34
|
-
|
35
|
-
CukeCataloger.create_tasks
|
36
|
-
|
37
|
-
If you want the tasks to be created in a certain namespace, simply call the creation method from within that namespace.
|
38
|
-
|
39
|
-
namespace 'foo' do
|
40
|
-
CukeCataloger.create_tasks
|
41
|
-
end
|
42
|
-
|
43
|
-
The classes used to tag and validate tests could also be used directly in other scripts if you want to do something more complex than the functionality provided by the two predefined Rake tasks.
|
44
|
-
|
45
|
-
### Adding ids to tests
|
46
|
-
|
47
|
-
The tag_tests task will add an id tag to every scenario (and an id column to every outline) in a test suite. To do this, it needs to be provided a directory in which the tests are located and a prefix upon which to base the tagging scheme.
|
48
|
-
|
49
|
-
rake tag_tests['path/to/your/tests','@test_case_']
|
50
|
-
|
51
|
-
The above example would result in the tags @test_case_1, @test_case_2, @test_case_3, etc. being added to every test in the given directory.
|
52
|
-
|
53
|
-
### Validating test ids
|
54
|
-
|
55
|
-
The validate_tests task scans a given directory for any problems related to id tags and generates a report detailing its results. To do this, it needs to be provided a directory in which the tests are located and a prefix upon which to base the tagging scheme. It can optionally take a file location to which it should output its report instead of printing it to the console.
|
56
|
-
|
57
|
-
rake validate_tests['path/to/your/tests','@test_case_','validation_results.txt']
|
58
|
-
|
59
|
-
The above example would result in a report called 'validation_results.txt' being generated for any test had problems related to their id (e.g. did not have an id tag, had the same id tag as another test, etc.).
|
60
|
-
|
61
|
-
## Contributing
|
62
|
-
|
63
|
-
1. Fork it ( http://github.com/<my-github-username>/cuke_cataloger/fork )
|
64
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
65
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
67
|
-
5. Create new Pull Request
|
1
|
+
# CukeCataloger
|
2
|
+
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/cuke_cataloger.svg)](http://badge.fury.io/rb/cuke_cataloger)
|
5
|
+
[![Build Status](https://travis-ci.org/enkessler/cuke_cataloger.svg?branch=master)](https://travis-ci.org/enkessler/cuke_cataloger)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/enkessler/cuke_cataloger/badge.svg?branch=master&service=github)](https://coveralls.io/github/enkessler/cuke_cataloger?branch=master)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/enkessler/cuke_cataloger/badges/gpa.svg)](https://codeclimate.com/github/enkessler/cuke_cataloger)
|
8
|
+
[![Project License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/enkessler/cuke_cataloger/blob/master/LICENSE.txt)
|
9
|
+
|
10
|
+
|
11
|
+
The cuke_cataloger gem is a convenient way to provide a unique id to every test case in your Cucumber test suite.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'cuke_cataloger'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install cuke_cataloger
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
The simplest way to use this gem is to include the Rake tasks that it provides in your project. Just require the gem
|
30
|
+
|
31
|
+
require 'cuke_cataloger'
|
32
|
+
|
33
|
+
and then call its task creation method in your Rakefile (or wherever you like to keep your Rake tasks) in order to generate the tasks.
|
34
|
+
|
35
|
+
CukeCataloger.create_tasks
|
36
|
+
|
37
|
+
If you want the tasks to be created in a certain namespace, simply call the creation method from within that namespace.
|
38
|
+
|
39
|
+
namespace 'foo' do
|
40
|
+
CukeCataloger.create_tasks
|
41
|
+
end
|
42
|
+
|
43
|
+
The classes used to tag and validate tests could also be used directly in other scripts if you want to do something more complex than the functionality provided by the two predefined Rake tasks.
|
44
|
+
|
45
|
+
### Adding ids to tests
|
46
|
+
|
47
|
+
The tag_tests task will add an id tag to every scenario (and an id column to every outline) in a test suite. To do this, it needs to be provided a directory in which the tests are located and a prefix upon which to base the tagging scheme.
|
48
|
+
|
49
|
+
rake tag_tests['path/to/your/tests','@test_case_']
|
50
|
+
|
51
|
+
The above example would result in the tags @test_case_1, @test_case_2, @test_case_3, etc. being added to every test in the given directory.
|
52
|
+
|
53
|
+
### Validating test ids
|
54
|
+
|
55
|
+
The validate_tests task scans a given directory for any problems related to id tags and generates a report detailing its results. To do this, it needs to be provided a directory in which the tests are located and a prefix upon which to base the tagging scheme. It can optionally take a file location to which it should output its report instead of printing it to the console.
|
56
|
+
|
57
|
+
rake validate_tests['path/to/your/tests','@test_case_','validation_results.txt']
|
58
|
+
|
59
|
+
The above example would result in a report called 'validation_results.txt' being generated for any test had problems related to their id (e.g. did not have an id tag, had the same id tag as another test, etc.).
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
1. Fork it ( http://github.com/<my-github-username>/cuke_cataloger/fork )
|
64
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
65
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
67
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -14,13 +14,22 @@ namespace 'cuke_cataloger' do
|
|
14
14
|
Racatt.create_tasks
|
15
15
|
|
16
16
|
# Redefining the task from 'racatt' in order to clear the code coverage results
|
17
|
-
task :test_everything
|
17
|
+
task :test_everything => :clear_coverage
|
18
|
+
|
19
|
+
|
20
|
+
desc 'Test the project'
|
21
|
+
task :smart_test do |t, args|
|
22
|
+
rspec_args = '--tag ~@wip --pattern testing/rspec/spec/**/*_spec.rb'
|
23
|
+
cucumber_args = 'testing/cucumber/features -r testing/cucumber/support -r testing/cucumber/step_definitions -f progress -t ~@wip'
|
24
|
+
|
25
|
+
Rake::Task['cuke_cataloger:test_everything'].invoke(rspec_args, cucumber_args)
|
26
|
+
end
|
18
27
|
|
19
28
|
|
20
29
|
# The task that CI will use
|
21
30
|
Coveralls::RakeTask.new
|
22
|
-
task :ci_build => [:
|
31
|
+
task :ci_build => [:smart_test, 'coveralls:push']
|
23
32
|
end
|
24
33
|
|
25
34
|
|
26
|
-
task :default => 'cuke_cataloger:
|
35
|
+
task :default => 'cuke_cataloger:smart_test'
|
data/cuke_cataloger.gemspec
CHANGED
@@ -18,15 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'cuke_modeler', '
|
21
|
+
spec.add_runtime_dependency 'cuke_modeler', '>= 0.2', '< 2.0'
|
22
22
|
spec.add_runtime_dependency 'cql', '~>1.0', '>= 1.0.1'
|
23
|
-
spec.add_runtime_dependency 'rake'
|
23
|
+
spec.add_runtime_dependency 'rake', '< 12.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
26
|
-
spec.add_development_dependency '
|
27
|
-
spec.add_development_dependency '
|
28
|
-
spec.add_development_dependency '
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency 'coveralls'
|
26
|
+
spec.add_development_dependency 'cucumber', '< 3.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'racatt', '~> 1.0'
|
29
|
+
spec.add_development_dependency 'simplecov', '< 1.0'
|
30
|
+
spec.add_development_dependency 'coveralls', '< 1.0'
|
32
31
|
end
|
@@ -139,10 +139,14 @@ module CukeCataloger
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def check_for_duplicated_test_id_tags(test)
|
142
|
-
@existing_tags
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
unless @existing_tags
|
143
|
+
@existing_tags = @model_repo.query do
|
144
|
+
select tags
|
145
|
+
from features, scenarios, outlines, examples
|
146
|
+
end.collect { |result| result['tags'] }.flatten
|
147
|
+
|
148
|
+
@existing_tags.collect! { |tag| tag.name } if Gem.loaded_specs['cuke_modeler'].version.version[/^1/]
|
149
|
+
end
|
146
150
|
|
147
151
|
test_id_tag = static_id_tag_for(test)
|
148
152
|
|
@@ -152,7 +156,11 @@ module CukeCataloger
|
|
152
156
|
end
|
153
157
|
|
154
158
|
def check_for_multiple_test_id_tags(test)
|
155
|
-
|
159
|
+
tags = test.tags
|
160
|
+
|
161
|
+
tags = tags.collect { |tag| tag.name } if Gem.loaded_specs['cuke_modeler'].version.version[/^1/]
|
162
|
+
|
163
|
+
id_tags_found = tags.select { |tag| tag =~ @tag_pattern }
|
156
164
|
|
157
165
|
add_to_results(test, :multiple_tags) if id_tags_found.count > 1
|
158
166
|
end
|
@@ -233,7 +241,12 @@ module CukeCataloger
|
|
233
241
|
def row_id_for(row)
|
234
242
|
id_index = determine_row_id_cell_index(row)
|
235
243
|
|
236
|
-
|
244
|
+
if id_index
|
245
|
+
cell_value = row.cells[id_index]
|
246
|
+
cell_value = cell_value.value if Gem.loaded_specs['cuke_modeler'].version.version[/^1/]
|
247
|
+
|
248
|
+
cell_value != '' ? cell_value : nil
|
249
|
+
end
|
237
250
|
end
|
238
251
|
|
239
252
|
def has_row_id?(row)
|
@@ -314,17 +327,25 @@ module CukeCataloger
|
|
314
327
|
|
315
328
|
File.open(file_path, 'w') { |file| file.print file_lines.join }
|
316
329
|
@file_line_increases[file_path] += 1
|
317
|
-
|
330
|
+
|
331
|
+
if Gem.loaded_specs['cuke_modeler'].version.version[/^0/]
|
332
|
+
test.tags << tag
|
333
|
+
else
|
334
|
+
new_tag = CukeModeler::Tag.new
|
335
|
+
new_tag.name = tag
|
336
|
+
test.tags << new_tag
|
337
|
+
end
|
318
338
|
end
|
319
339
|
|
320
340
|
def update_parameters_if_needed(test)
|
321
341
|
feature_file = test.get_ancestor(:feature_file)
|
322
342
|
file_path = feature_file.path
|
323
343
|
index_adjustment = @file_line_increases[file_path]
|
344
|
+
method_for_rows = Gem.loaded_specs['cuke_modeler'].version.version[/^0/] ? :row_elements : :rows
|
324
345
|
|
325
346
|
test.examples.each do |example|
|
326
347
|
unless has_id_parameter?(example)
|
327
|
-
parameter_line_index = (example.
|
348
|
+
parameter_line_index = (example.send(method_for_rows).first.source_line - 1) + index_adjustment
|
328
349
|
|
329
350
|
file_lines = File.readlines(file_path)
|
330
351
|
|
@@ -339,13 +360,14 @@ module CukeCataloger
|
|
339
360
|
feature_file = test.get_ancestor(:feature_file)
|
340
361
|
file_path = feature_file.path
|
341
362
|
index_adjustment = @file_line_increases[file_path]
|
363
|
+
method_for_rows = Gem.loaded_specs['cuke_modeler'].version.version[/^0/] ? :row_elements : :rows
|
342
364
|
|
343
365
|
tag_index = fast_id_tag_for(test)[/\d+/]
|
344
366
|
|
345
367
|
file_lines = File.readlines(file_path)
|
346
368
|
|
347
369
|
test.examples.each do |example|
|
348
|
-
example.
|
370
|
+
example.send(method_for_rows)[1..(example.send(method_for_rows).count - 1)].each do |row|
|
349
371
|
unless has_row_id?(row)
|
350
372
|
row_id = "#{tag_index}-#{sub_id}".ljust(parameter_spacing(example))
|
351
373
|
|
@@ -394,7 +416,11 @@ module CukeCataloger
|
|
394
416
|
end
|
395
417
|
|
396
418
|
def id_tag_for(thing)
|
397
|
-
|
419
|
+
tags = thing.tags
|
420
|
+
|
421
|
+
tags = tags.collect { |tag| tag.name } unless Gem.loaded_specs['cuke_modeler'].version.version[/^0/]
|
422
|
+
|
423
|
+
tags.select { |tag| tag =~ @tag_pattern }.first
|
398
424
|
end
|
399
425
|
|
400
426
|
def test_id_for(test)
|
@@ -449,7 +475,9 @@ module CukeCataloger
|
|
449
475
|
end
|
450
476
|
|
451
477
|
def example_rows_for(example)
|
452
|
-
|
478
|
+
method_for_rows = Gem.loaded_specs['cuke_modeler'].version.version[/^0/] ? :row_elements : :rows
|
479
|
+
|
480
|
+
rows = example.send(method_for_rows).dup
|
453
481
|
rows.shift
|
454
482
|
|
455
483
|
rows
|
@@ -538,13 +566,17 @@ module CukeCataloger
|
|
538
566
|
def determine_highest_tag_line(test)
|
539
567
|
return adjacent_tag_line(test) if test.tags.empty?
|
540
568
|
|
541
|
-
|
569
|
+
method_for_tag_models = Gem.loaded_specs['cuke_modeler'].version.version[/^0/] ? :tag_elements : :tags
|
570
|
+
|
571
|
+
test.send(method_for_tag_models).collect { |tag_element| tag_element.source_line }.min - 1
|
542
572
|
end
|
543
573
|
|
544
574
|
def determine_lowest_tag_line(test)
|
545
575
|
return adjacent_tag_line(test) if test.tags.empty?
|
546
576
|
|
547
|
-
|
577
|
+
method_for_tag_models = Gem.loaded_specs['cuke_modeler'].version.version[/^0/] ? :tag_elements : :tags
|
578
|
+
|
579
|
+
test.send(method_for_tag_models).collect { |tag_element| tag_element.source_line }.max
|
548
580
|
end
|
549
581
|
|
550
582
|
def adjacent_tag_line(test)
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module CukeCataloger
|
2
|
-
VERSION = '1.
|
3
|
-
end
|
1
|
+
module CukeCataloger
|
2
|
+
VERSION = '1.2.0'
|
3
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Feature: Scan results return useful information
|
2
2
|
|
3
|
-
|
3
|
+
Model objects are returned in the results of a scan.
|
4
4
|
|
5
5
|
Scenario: Scanned scenario
|
6
6
|
Given the following feature file "file1.feature":
|
@@ -13,7 +13,7 @@ Feature: Scan results return useful information
|
|
13
13
|
"""
|
14
14
|
And a tag prefix of "@test_case_"
|
15
15
|
When the files are scanned
|
16
|
-
Then the payload is a
|
16
|
+
Then the payload is a model object
|
17
17
|
|
18
18
|
Scenario: Scanned outline
|
19
19
|
Given the following feature file "test_file.feature":
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -75,8 +75,10 @@ Then(/^the following tagged test objects are found:$/) do |expected_results|
|
|
75
75
|
verify_results(expected_results)
|
76
76
|
end
|
77
77
|
|
78
|
-
Then(/^the payload is a
|
79
|
-
|
78
|
+
Then(/^the payload is a model object$/) do
|
79
|
+
class_name = @test_results.first[:object].class.name.split('::').last
|
80
|
+
|
81
|
+
expect(CukeModeler.const_defined?(class_name)).to be true
|
80
82
|
end
|
81
83
|
|
82
84
|
Then(/^the payload has a test and a test row$/) do
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec :path => "../../"
|
4
|
+
|
5
|
+
|
6
|
+
# cuke_cataloger can play with pretty much any version of these but they all play differently with Ruby
|
7
|
+
if RUBY_VERSION =~ /^1\.8/
|
8
|
+
gem 'cucumber', '< 1.3.0'
|
9
|
+
gem 'gherkin', '< 2.12.0'
|
10
|
+
gem 'rake', '< 11.0' # Rake dropped 1.8.x support after this version
|
11
|
+
elsif RUBY_VERSION =~ /^1\./
|
12
|
+
gem 'cucumber', '< 2.0.0'
|
13
|
+
end
|
14
|
+
|
15
|
+
if RUBY_VERSION =~ /^1\./
|
16
|
+
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
17
|
+
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
18
|
+
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
19
|
+
end
|
20
|
+
|
21
|
+
gem 'cuke_modeler', '~> 0.0'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec :path => "../../"
|
4
|
+
|
5
|
+
|
6
|
+
# cuke_cataloger can play with pretty much any version of these but they all play differently with Ruby
|
7
|
+
if RUBY_VERSION =~ /^1\.8/
|
8
|
+
gem 'cucumber', '< 1.3.0'
|
9
|
+
gem 'gherkin', '< 2.12.0'
|
10
|
+
gem 'rake', '< 11.0' # Rake dropped 1.8.x support after this version
|
11
|
+
elsif RUBY_VERSION =~ /^1\./
|
12
|
+
gem 'cucumber', '< 2.0.0'
|
13
|
+
end
|
14
|
+
|
15
|
+
if RUBY_VERSION =~ /^1\./
|
16
|
+
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
17
|
+
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
18
|
+
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
19
|
+
end
|
20
|
+
|
21
|
+
gem 'cuke_modeler', '~> 1.0'
|
File without changes
|
metadata
CHANGED
@@ -1,182 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke_cataloger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Eric Kessler
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2016-02
|
11
|
+
date: 2016-10-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: cuke_modeler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
30
33
|
- !ruby/object:Gem::Dependency
|
31
34
|
name: cql
|
32
35
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
36
|
requirements:
|
35
|
-
- - ~>
|
37
|
+
- - "~>"
|
36
38
|
- !ruby/object:Gem::Version
|
37
39
|
version: '1.0'
|
38
|
-
- -
|
40
|
+
- - ">="
|
39
41
|
- !ruby/object:Gem::Version
|
40
42
|
version: 1.0.1
|
41
43
|
type: :runtime
|
42
44
|
prerelease: false
|
43
45
|
version_requirements: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
46
|
requirements:
|
46
|
-
- - ~>
|
47
|
+
- - "~>"
|
47
48
|
- !ruby/object:Gem::Version
|
48
49
|
version: '1.0'
|
49
|
-
- -
|
50
|
+
- - ">="
|
50
51
|
- !ruby/object:Gem::Version
|
51
52
|
version: 1.0.1
|
52
53
|
- !ruby/object:Gem::Dependency
|
53
54
|
name: rake
|
54
55
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - "<"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0'
|
59
|
+
version: '12.0'
|
60
60
|
type: :runtime
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
63
|
requirements:
|
65
|
-
- -
|
64
|
+
- - "<"
|
66
65
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
66
|
+
version: '12.0'
|
68
67
|
- !ruby/object:Gem::Dependency
|
69
68
|
name: bundler
|
70
69
|
requirement: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
70
|
requirements:
|
73
|
-
- - ~>
|
71
|
+
- - "~>"
|
74
72
|
- !ruby/object:Gem::Version
|
75
73
|
version: '1.5'
|
76
74
|
type: :development
|
77
75
|
prerelease: false
|
78
76
|
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
77
|
requirements:
|
81
|
-
- - ~>
|
78
|
+
- - "~>"
|
82
79
|
- !ruby/object:Gem::Version
|
83
80
|
version: '1.5'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
|
-
requirements:
|
89
|
-
- - ! '>='
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
|
-
requirements:
|
97
|
-
- - ! '>='
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '0'
|
100
81
|
- !ruby/object:Gem::Dependency
|
101
82
|
name: cucumber
|
102
83
|
requirement: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
84
|
requirements:
|
105
|
-
- -
|
85
|
+
- - "<"
|
106
86
|
- !ruby/object:Gem::Version
|
107
|
-
version: '0'
|
87
|
+
version: '3.0'
|
108
88
|
type: :development
|
109
89
|
prerelease: false
|
110
90
|
version_requirements: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
91
|
requirements:
|
113
|
-
- -
|
92
|
+
- - "<"
|
114
93
|
- !ruby/object:Gem::Version
|
115
|
-
version: '0'
|
94
|
+
version: '3.0'
|
116
95
|
- !ruby/object:Gem::Dependency
|
117
96
|
name: rspec
|
118
97
|
requirement: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
98
|
requirements:
|
121
|
-
- -
|
99
|
+
- - "~>"
|
122
100
|
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
101
|
+
version: '3.0'
|
124
102
|
type: :development
|
125
103
|
prerelease: false
|
126
104
|
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
105
|
requirements:
|
129
|
-
- -
|
106
|
+
- - "~>"
|
130
107
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
108
|
+
version: '3.0'
|
132
109
|
- !ruby/object:Gem::Dependency
|
133
110
|
name: racatt
|
134
111
|
requirement: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
112
|
requirements:
|
137
|
-
- -
|
113
|
+
- - "~>"
|
138
114
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
115
|
+
version: '1.0'
|
140
116
|
type: :development
|
141
117
|
prerelease: false
|
142
118
|
version_requirements: !ruby/object:Gem::Requirement
|
143
|
-
none: false
|
144
119
|
requirements:
|
145
|
-
- -
|
120
|
+
- - "~>"
|
146
121
|
- !ruby/object:Gem::Version
|
147
|
-
version: '0'
|
122
|
+
version: '1.0'
|
148
123
|
- !ruby/object:Gem::Dependency
|
149
124
|
name: simplecov
|
150
125
|
requirement: !ruby/object:Gem::Requirement
|
151
|
-
none: false
|
152
126
|
requirements:
|
153
|
-
- -
|
127
|
+
- - "<"
|
154
128
|
- !ruby/object:Gem::Version
|
155
|
-
version: '0'
|
129
|
+
version: '1.0'
|
156
130
|
type: :development
|
157
131
|
prerelease: false
|
158
132
|
version_requirements: !ruby/object:Gem::Requirement
|
159
|
-
none: false
|
160
133
|
requirements:
|
161
|
-
- -
|
134
|
+
- - "<"
|
162
135
|
- !ruby/object:Gem::Version
|
163
|
-
version: '0'
|
136
|
+
version: '1.0'
|
164
137
|
- !ruby/object:Gem::Dependency
|
165
138
|
name: coveralls
|
166
139
|
requirement: !ruby/object:Gem::Requirement
|
167
|
-
none: false
|
168
140
|
requirements:
|
169
|
-
- -
|
141
|
+
- - "<"
|
170
142
|
- !ruby/object:Gem::Version
|
171
|
-
version: '0'
|
143
|
+
version: '1.0'
|
172
144
|
type: :development
|
173
145
|
prerelease: false
|
174
146
|
version_requirements: !ruby/object:Gem::Requirement
|
175
|
-
none: false
|
176
147
|
requirements:
|
177
|
-
- -
|
148
|
+
- - "<"
|
178
149
|
- !ruby/object:Gem::Version
|
179
|
-
version: '0'
|
150
|
+
version: '1.0'
|
180
151
|
description: Scans existing Cucumber tests and updates them to include an id tag that
|
181
152
|
is unique for the test suite.
|
182
153
|
email:
|
@@ -185,70 +156,56 @@ executables: []
|
|
185
156
|
extensions: []
|
186
157
|
extra_rdoc_files: []
|
187
158
|
files:
|
188
|
-
- .gitignore
|
189
|
-
- .simplecov
|
190
|
-
- .travis.yml
|
159
|
+
- ".gitignore"
|
160
|
+
- ".simplecov"
|
161
|
+
- ".travis.yml"
|
191
162
|
- Gemfile
|
192
163
|
- History.md
|
193
164
|
- LICENSE.txt
|
194
165
|
- README.md
|
195
166
|
- Rakefile
|
196
167
|
- cuke_cataloger.gemspec
|
197
|
-
- features/formatting.feature
|
198
|
-
- features/step_definitions/action_steps.rb
|
199
|
-
- features/step_definitions/setup_steps.rb
|
200
|
-
- features/step_definitions/verification_steps.rb
|
201
|
-
- features/support/env.rb
|
202
|
-
- features/support/transforms.rb
|
203
|
-
- features/tag_indexing.feature
|
204
|
-
- features/test_case_scanning.feature
|
205
|
-
- features/test_case_scanning_payload.feature
|
206
|
-
- features/test_case_tagging.feature
|
207
|
-
- features/test_case_validation.feature
|
208
168
|
- lib/cuke_cataloger.rb
|
209
169
|
- lib/cuke_cataloger/unique_test_case_tagger.rb
|
210
170
|
- lib/cuke_cataloger/version.rb
|
211
|
-
-
|
212
|
-
-
|
213
|
-
-
|
171
|
+
- testing/cucumber/features/formatting.feature
|
172
|
+
- testing/cucumber/features/tag_indexing.feature
|
173
|
+
- testing/cucumber/features/test_case_scanning.feature
|
174
|
+
- testing/cucumber/features/test_case_scanning_payload.feature
|
175
|
+
- testing/cucumber/features/test_case_tagging.feature
|
176
|
+
- testing/cucumber/features/test_case_validation.feature
|
177
|
+
- testing/cucumber/step_definitions/action_steps.rb
|
178
|
+
- testing/cucumber/step_definitions/setup_steps.rb
|
179
|
+
- testing/cucumber/step_definitions/verification_steps.rb
|
180
|
+
- testing/cucumber/support/env.rb
|
181
|
+
- testing/cucumber/support/transforms.rb
|
182
|
+
- testing/gemfiles/cuke_modeler0.gemfile
|
183
|
+
- testing/gemfiles/cuke_modeler1.gemfile
|
184
|
+
- testing/rspec/spec/spec_helper.rb
|
185
|
+
- testing/rspec/spec/unique_test_case_tagger_integration_spec.rb
|
186
|
+
- testing/rspec/spec/unique_test_case_tagger_unit_spec.rb
|
214
187
|
homepage: https://github.com/enkessler/cuke_cataloger
|
215
188
|
licenses:
|
216
189
|
- MIT
|
190
|
+
metadata: {}
|
217
191
|
post_install_message:
|
218
192
|
rdoc_options: []
|
219
193
|
require_paths:
|
220
194
|
- lib
|
221
195
|
required_ruby_version: !ruby/object:Gem::Requirement
|
222
|
-
none: false
|
223
196
|
requirements:
|
224
|
-
- -
|
197
|
+
- - ">="
|
225
198
|
- !ruby/object:Gem::Version
|
226
199
|
version: '0'
|
227
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
|
-
none: false
|
229
201
|
requirements:
|
230
|
-
- -
|
202
|
+
- - ">="
|
231
203
|
- !ruby/object:Gem::Version
|
232
204
|
version: '0'
|
233
205
|
requirements: []
|
234
206
|
rubyforge_project:
|
235
|
-
rubygems_version:
|
207
|
+
rubygems_version: 2.2.5
|
236
208
|
signing_key:
|
237
|
-
specification_version:
|
209
|
+
specification_version: 4
|
238
210
|
summary: A tool to give every Cucumber test a unique id
|
239
|
-
test_files:
|
240
|
-
- features/formatting.feature
|
241
|
-
- features/step_definitions/action_steps.rb
|
242
|
-
- features/step_definitions/setup_steps.rb
|
243
|
-
- features/step_definitions/verification_steps.rb
|
244
|
-
- features/support/env.rb
|
245
|
-
- features/support/transforms.rb
|
246
|
-
- features/tag_indexing.feature
|
247
|
-
- features/test_case_scanning.feature
|
248
|
-
- features/test_case_scanning_payload.feature
|
249
|
-
- features/test_case_tagging.feature
|
250
|
-
- features/test_case_validation.feature
|
251
|
-
- spec/spec_helper.rb
|
252
|
-
- spec/unique_test_case_tagger_integration_spec.rb
|
253
|
-
- spec/unique_test_case_tagger_unit_spec.rb
|
254
|
-
has_rdoc:
|
211
|
+
test_files: []
|