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
@@ -1,38 +0,0 @@
|
|
1
|
-
# Older Rubies on Windows cannot securely connect to RubyGems anymore (https://github.com/rubygems/rubygems/issues/2330)
|
2
|
-
if (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) && (RUBY_VERSION =~ /^1\./)
|
3
|
-
source 'http://rubygems.org'
|
4
|
-
else
|
5
|
-
source 'https://rubygems.org'
|
6
|
-
end
|
7
|
-
|
8
|
-
gemspec :path => "../../"
|
9
|
-
|
10
|
-
# The Coveralls gem can't handle more recent versions of the SimpleCov gem
|
11
|
-
gem 'simplecov', '<= 0.16.1'
|
12
|
-
|
13
|
-
# cuke_cataloger can play with pretty much any version of these but they all play differently with Ruby
|
14
|
-
if RUBY_VERSION =~ /^1\.8/
|
15
|
-
gem 'cucumber', '< 1.3.0'
|
16
|
-
gem 'gherkin', '< 2.12.0'
|
17
|
-
gem 'mime-types', '< 2.0' # The 'mime-types' gem requires Ruby 1.9.x on/after this version
|
18
|
-
gem 'rainbow', '< 2.0' # Ruby 1.8.x support dropped after this version
|
19
|
-
elsif RUBY_VERSION =~ /^1\./
|
20
|
-
gem 'cucumber', '< 2.0.0'
|
21
|
-
gem 'mime-types', '< 3.0.0' # The 'mime-types' gem requires Ruby 2.x on/after this version
|
22
|
-
gem 'rainbow', '< 3.0' # The 'rainbow' gem requires Ruby 2.x on/after this version
|
23
|
-
else
|
24
|
-
# Have to use this version of Cucumber in order to avoid namespace problems introduced by the `cucumber-gherkin` gem
|
25
|
-
gem 'cucumber', '2.2.0'
|
26
|
-
end
|
27
|
-
|
28
|
-
if RUBY_VERSION =~ /^1\./
|
29
|
-
gem 'cuke_modeler', '< 3.0' # The 'cuke_modeler' gem requires Ruby 2.x on/after this version
|
30
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem requires Ruby 2.x on/after this version
|
31
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
32
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
33
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
34
|
-
gem 'thor', '< 1.0' # The 'thor' gem requires Ruby 2.x on/after this version
|
35
|
-
end
|
36
|
-
|
37
|
-
# The version of Rake being tested
|
38
|
-
gem 'rake', '~> 10.0'
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# Older Rubies on Windows cannot securely connect to RubyGems anymore (https://github.com/rubygems/rubygems/issues/2330)
|
2
|
-
if (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) && (RUBY_VERSION =~ /^1\./)
|
3
|
-
source 'http://rubygems.org'
|
4
|
-
else
|
5
|
-
source 'https://rubygems.org'
|
6
|
-
end
|
7
|
-
|
8
|
-
gemspec :path => "../../"
|
9
|
-
|
10
|
-
|
11
|
-
# The version of Rake being tested
|
12
|
-
gem 'rake', '~> 11.0'
|
13
|
-
|
14
|
-
if RUBY_VERSION =~ /^1\./
|
15
|
-
gem 'cucumber', '< 2.0.0'
|
16
|
-
gem 'cuke_modeler', '< 3.0' # The 'cuke_modeler' gem requires Ruby 2.x on/after this version
|
17
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem requires Ruby 2.x on/after this version
|
18
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
19
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
20
|
-
gem 'mime-types', '< 3.0.0' # The 'mime-types' gem requires Ruby 2.x on/after this version
|
21
|
-
gem 'rainbow', '< 3.0' # The 'rainbow' gem requires Ruby 2.x on/after this version
|
22
|
-
gem 'rest-client', '< 2.0' # The 'rainbow' gem requires Ruby 2.x on/after this version
|
23
|
-
gem 'simplecov-html', '< 0.11.0' # The 'simplecov-html' gem requires Ruby 2.x on/after this version
|
24
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
25
|
-
gem 'unf_ext', '< 0.0.7.3' # The 'unf_ext' gem requires Ruby 2.x on/after this version
|
26
|
-
gem 'thor', '< 1.0' # The 'thor' gem requires Ruby 2.x on/after this version
|
27
|
-
else
|
28
|
-
# Have to use this version of Cucumber in order to avoid namespace problems introduced by the `cucumber-gherkin` gem
|
29
|
-
gem 'cucumber', '2.2.0'
|
30
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# Older Rubies on Windows cannot securely connect to RubyGems anymore (https://github.com/rubygems/rubygems/issues/2330)
|
2
|
-
if (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) && (RUBY_VERSION =~ /^1\./)
|
3
|
-
source 'http://rubygems.org'
|
4
|
-
else
|
5
|
-
source 'https://rubygems.org'
|
6
|
-
end
|
7
|
-
|
8
|
-
gemspec :path => "../../"
|
9
|
-
|
10
|
-
|
11
|
-
# Rake 12.x does not work with Ruby 1.8.x
|
12
|
-
if RUBY_VERSION =~ /^1\./
|
13
|
-
gem 'cucumber', '< 2.0.0'
|
14
|
-
gem 'cuke_modeler', '< 3.0' # The 'cuke_modeler' gem requires Ruby 2.x on/after this version
|
15
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem requires Ruby 2.x on/after this version
|
16
|
-
gem 'rainbow', '< 3.0' # The 'rainbow' gem requires Ruby 2.x on/after this version
|
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 'mime-types', '< 3.0.0' # The 'mime-types' gem requires Ruby 2.x on/after this version
|
20
|
-
gem 'rest-client', '< 2.0' # The 'rainbow' gem requires Ruby 2.x on/after this version
|
21
|
-
gem 'simplecov-html', '< 0.11.0' # The 'simplecov-html' gem requires Ruby 2.x on/after this version
|
22
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
23
|
-
gem 'unf_ext', '< 0.0.7.3' # The 'unf_ext' gem requires Ruby 2.x on/after this version
|
24
|
-
gem 'thor', '< 1.0' # The 'thor' gem requires Ruby 2.x on/after this version
|
25
|
-
else
|
26
|
-
# Have to use this version of Cucumber in order to avoid namespace problems introduced by the `cucumber-gherkin` gem
|
27
|
-
gem 'cucumber', '2.2.0'
|
28
|
-
end
|
29
|
-
|
30
|
-
# The version of Rake being tested
|
31
|
-
if RUBY_VERSION =~ /^1\./
|
32
|
-
gem 'rake', '< 12.3.0' # The 'rake' gem requires Ruby 2.x on/after this version
|
33
|
-
else
|
34
|
-
gem 'rake', '~> 12.0'
|
35
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
gemspec :path => "../../"
|
3
|
-
|
4
|
-
# The version of Rake being tested
|
5
|
-
gem 'rake', '~> 13.0'
|
6
|
-
|
7
|
-
# Have to use this version of Cucumber in order to avoid namespace problems introduced by the `cucumber-gherkin` gem
|
8
|
-
gem 'cucumber', '2.2.0'
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# Older Rubies on Windows cannot securely connect to RubyGems anymore (https://github.com/rubygems/rubygems/issues/2330)
|
2
|
-
if (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) && (RUBY_VERSION =~ /^1\./)
|
3
|
-
source 'http://rubygems.org'
|
4
|
-
else
|
5
|
-
source 'https://rubygems.org'
|
6
|
-
end
|
7
|
-
|
8
|
-
gemspec :path => "../../"
|
9
|
-
|
10
|
-
# The Coveralls gem can't handle more recent versions of the SimpleCov gem
|
11
|
-
gem 'simplecov', '<= 0.16.1'
|
12
|
-
|
13
|
-
# cuke_cataloger can play with pretty much any version of these but they all play differently with Ruby
|
14
|
-
if RUBY_VERSION =~ /^1\.8/
|
15
|
-
gem 'cucumber', '< 1.3.0'
|
16
|
-
gem 'gherkin', '< 2.12.0'
|
17
|
-
gem 'mime-types', '< 2.0' # The 'mime-types' gem requires Ruby 1.9.x on/after this version
|
18
|
-
gem 'rainbow', '< 2.0' # Ruby 1.8.x support dropped after this version
|
19
|
-
gem 'rake', '< 11.0' # Rake dropped 1.8.x support after this version
|
20
|
-
elsif RUBY_VERSION =~ /^1\./
|
21
|
-
gem 'cucumber', '< 2.0.0'
|
22
|
-
gem 'mime-types', '< 3.0.0' # The 'mime-types' gem requires Ruby 2.x on/after this version
|
23
|
-
gem 'rainbow', '< 3.0' # The 'rainbow' gem requires Ruby 2.x on/after this version
|
24
|
-
gem 'rake', '< 12.3.0' # The 'rake' gem requires Ruby 2.x on/after this version
|
25
|
-
else
|
26
|
-
# Have to use this version of Cucumber in order to avoid namespace problems introduced by the `cucumber-gherkin` gem
|
27
|
-
gem 'cucumber', '2.2.0'
|
28
|
-
end
|
29
|
-
|
30
|
-
if RUBY_VERSION =~ /^1\./
|
31
|
-
gem 'cuke_modeler', '< 3.0' # The 'cuke_modeler' gem requires Ruby 2.x on/after this version
|
32
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem requires Ruby 2.x on/after this version
|
33
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
34
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
35
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
36
|
-
end
|
37
|
-
|
38
|
-
# The version of Thor being tested
|
39
|
-
gem 'thor', '~> 0.0'
|
@@ -1,11 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
gemspec :path => "../../"
|
3
|
-
|
4
|
-
# The Coveralls gem can't handle more recent versions of the SimpleCov gem
|
5
|
-
gem 'simplecov', '<= 0.16.1'
|
6
|
-
|
7
|
-
# Have to use this version of Cucumber in order to avoid namespace problems introduced by the `cucumber-gherkin` gem
|
8
|
-
gem 'cucumber', '2.2.0'
|
9
|
-
|
10
|
-
# The version of Thor being tested
|
11
|
-
gem 'thor', '~> 1.0'
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/spec_helper"
|
2
|
-
require 'rubygems/mock_gem_ui'
|
3
|
-
|
4
|
-
|
5
|
-
describe 'the gem' do
|
6
|
-
|
7
|
-
here = File.dirname(__FILE__)
|
8
|
-
|
9
|
-
let(:gemspec) { eval(File.read "#{here}/../../../cuke_cataloger.gemspec") }
|
10
|
-
|
11
|
-
it 'has an executable' do
|
12
|
-
expect(gemspec.executables).to include('cuke_cataloger')
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'validates cleanly' do
|
16
|
-
mock_ui = Gem::MockGemUi.new
|
17
|
-
Gem::DefaultUserInteraction.use_ui(mock_ui) { gemspec.validate }
|
18
|
-
|
19
|
-
expect(mock_ui.error).to_not match(/warn/i)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
unless RUBY_VERSION.to_s < '1.9.0'
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.command_name('cuke_cataloger-cucumber')
|
4
|
-
end
|
5
|
-
|
6
|
-
here = File.dirname(__FILE__)
|
7
|
-
require "#{here}/../../file_helper"
|
8
|
-
|
9
|
-
require 'cuke_cataloger'
|
10
|
-
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
config.before(:all) do
|
14
|
-
@lib_directory = "#{here}/../../../lib"
|
15
|
-
end
|
16
|
-
|
17
|
-
config.after(:all) do
|
18
|
-
CukeCataloger::FileHelper.created_directories.each do |dir_path|
|
19
|
-
FileUtils.remove_entry(dir_path, true)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
@@ -1,295 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'UniqueTestCaseTagger, Integration' do
|
5
|
-
|
6
|
-
clazz = CukeCataloger::UniqueTestCaseTagger
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
@tagger = clazz.new
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'test tagging' do
|
13
|
-
|
14
|
-
# Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
|
15
|
-
# particular test. Some ids may already have been stored from previous method calls and, if the memory from those
|
16
|
-
# previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
|
17
|
-
# have them.
|
18
|
-
|
19
|
-
it 'clears its known ids when it tags tests' do
|
20
|
-
# Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
|
21
|
-
@tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
|
22
|
-
|
23
|
-
path = CukeCataloger::FileHelper.create_directory
|
24
|
-
@tagger.tag_tests(path, '')
|
25
|
-
|
26
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
|
27
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'uses a default tag prefix' do
|
31
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
32
|
-
|
33
|
-
starting_text = 'Feature:
|
34
|
-
|
35
|
-
Scenario:
|
36
|
-
* a step'
|
37
|
-
|
38
|
-
test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => starting_text)
|
39
|
-
|
40
|
-
|
41
|
-
@tagger.tag_tests(test_directory)
|
42
|
-
|
43
|
-
expected_text = 'Feature:
|
44
|
-
|
45
|
-
@test_case_1
|
46
|
-
Scenario:
|
47
|
-
* a step'
|
48
|
-
|
49
|
-
tagged_text = File.read(test_file)
|
50
|
-
|
51
|
-
|
52
|
-
expect(tagged_text).to eq(expected_text)
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'uses a default id column name' do
|
56
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
57
|
-
|
58
|
-
starting_text = 'Feature:
|
59
|
-
|
60
|
-
Scenario Outline:
|
61
|
-
* a step
|
62
|
-
Examples:
|
63
|
-
| param |
|
64
|
-
| value |'
|
65
|
-
|
66
|
-
test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => starting_text)
|
67
|
-
|
68
|
-
|
69
|
-
@tagger.tag_tests(test_directory)
|
70
|
-
|
71
|
-
expected_text = 'Feature:
|
72
|
-
|
73
|
-
@test_case_1
|
74
|
-
Scenario Outline:
|
75
|
-
* a step
|
76
|
-
Examples:
|
77
|
-
| param | test_case_id |
|
78
|
-
| value | 1-1 |'
|
79
|
-
|
80
|
-
tagged_text = File.read(test_file)
|
81
|
-
|
82
|
-
|
83
|
-
expect(tagged_text).to eq(expected_text)
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
describe 'data validation' do
|
89
|
-
|
90
|
-
# Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
|
91
|
-
# particular test. Some ids may already have been stored from previous method calls and, if the memory from those
|
92
|
-
# previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
|
93
|
-
# have them.
|
94
|
-
|
95
|
-
it 'clears its known ids when it validates test ids' do
|
96
|
-
# Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
|
97
|
-
@tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
|
98
|
-
|
99
|
-
path = CukeCataloger::FileHelper.create_directory
|
100
|
-
@tagger.validate_test_ids(path, '')
|
101
|
-
|
102
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
|
103
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'uses a default tag prefix' do
|
107
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
108
|
-
|
109
|
-
gherkin_text = 'Feature:
|
110
|
-
|
111
|
-
@test_case_1
|
112
|
-
Scenario:
|
113
|
-
* a step'
|
114
|
-
|
115
|
-
CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
|
116
|
-
|
117
|
-
|
118
|
-
results = @tagger.validate_test_ids(test_directory)
|
119
|
-
|
120
|
-
expect(results).to be_empty
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'uses a default id column name' do
|
124
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
125
|
-
|
126
|
-
gherkin_text = 'Feature:
|
127
|
-
|
128
|
-
@test_case_1
|
129
|
-
Scenario Outline:
|
130
|
-
* a step
|
131
|
-
Examples:
|
132
|
-
| param | test_case_id |
|
133
|
-
| value 1 | 1-1 |'
|
134
|
-
|
135
|
-
CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
|
136
|
-
|
137
|
-
|
138
|
-
results = @tagger.validate_test_ids(test_directory)
|
139
|
-
|
140
|
-
expect(results).to be_empty
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe 'test scanning' do
|
145
|
-
|
146
|
-
# Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
|
147
|
-
# particular test. Some ids may already have been stored from previous method calls and, if the memory from those
|
148
|
-
# previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
|
149
|
-
# have them.
|
150
|
-
|
151
|
-
it 'clears its known ids when it scans for tagged tests' do
|
152
|
-
# Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
|
153
|
-
@tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
|
154
|
-
|
155
|
-
path = CukeCataloger::FileHelper.create_directory
|
156
|
-
@tagger.scan_for_tagged_tests(path, '')
|
157
|
-
|
158
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
|
159
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
|
160
|
-
end
|
161
|
-
|
162
|
-
it 'uses a default tag prefix' do
|
163
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
164
|
-
|
165
|
-
gherkin_text = 'Feature:
|
166
|
-
|
167
|
-
@test_case_1
|
168
|
-
Scenario:
|
169
|
-
* a step'
|
170
|
-
|
171
|
-
test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
|
172
|
-
|
173
|
-
|
174
|
-
results = @tagger.scan_for_tagged_tests(test_directory)
|
175
|
-
|
176
|
-
|
177
|
-
expect(results.collect { |result| result[:test] }).to eq(["#{test_file}:4"])
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'uses a default id column name' do
|
181
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
182
|
-
|
183
|
-
gherkin_text = 'Feature:
|
184
|
-
|
185
|
-
@test_case_1
|
186
|
-
Scenario Outline:
|
187
|
-
* a step
|
188
|
-
Examples:
|
189
|
-
| param | test_case_id |
|
190
|
-
| value 1 | 1-1 |'
|
191
|
-
|
192
|
-
test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
|
193
|
-
|
194
|
-
|
195
|
-
results = @tagger.scan_for_tagged_tests(test_directory)
|
196
|
-
|
197
|
-
expect(results.collect { |result| result[:test] }).to eq(["#{test_file}:4",
|
198
|
-
"#{test_file}:8"])
|
199
|
-
end
|
200
|
-
|
201
|
-
end
|
202
|
-
|
203
|
-
describe 'tag indexing' do
|
204
|
-
|
205
|
-
# Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
|
206
|
-
# particular test. Some ids may already have been stored from previous method calls and, if the memory from those
|
207
|
-
# previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
|
208
|
-
# have them.
|
209
|
-
|
210
|
-
it 'clears its known ids when it determines known test ids' do
|
211
|
-
# Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
|
212
|
-
@tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
|
213
|
-
|
214
|
-
path = CukeCataloger::FileHelper.create_directory
|
215
|
-
@tagger.determine_known_ids(path, '')
|
216
|
-
|
217
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
|
218
|
-
expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
|
219
|
-
end
|
220
|
-
|
221
|
-
it 'does not count id like values that are not in the specified id column' do
|
222
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
223
|
-
|
224
|
-
text = "Feature:
|
225
|
-
|
226
|
-
@test_case_1
|
227
|
-
Scenario:
|
228
|
-
* a step
|
229
|
-
|
230
|
-
@test_case_2
|
231
|
-
Scenario Outline:
|
232
|
-
* a step with a <param>
|
233
|
-
Examples: with rows
|
234
|
-
| param | test_case_id | foobar |
|
235
|
-
| value 1 | 2-1 | 2-4 |
|
236
|
-
Examples: without rows
|
237
|
-
| param | test_case_id | foobar |
|
238
|
-
| value 1 | 2-2 | 2-5 |
|
239
|
-
| value 2 | 2-3 | 2-6 |
|
240
|
-
|
241
|
-
@test_case_3
|
242
|
-
Scenario:
|
243
|
-
* a step"
|
244
|
-
|
245
|
-
CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => text)
|
246
|
-
|
247
|
-
|
248
|
-
result = @tagger.determine_known_ids(test_directory, '@test_case_', 'foobar')
|
249
|
-
|
250
|
-
|
251
|
-
expect(result).to_not include('2-1', '2-2', '2-3')
|
252
|
-
end
|
253
|
-
|
254
|
-
it 'uses a default tag prefix' do
|
255
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
256
|
-
|
257
|
-
text = 'Feature:
|
258
|
-
|
259
|
-
@test_case_1
|
260
|
-
Scenario:
|
261
|
-
* a step'
|
262
|
-
|
263
|
-
CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => text)
|
264
|
-
|
265
|
-
|
266
|
-
result = @tagger.determine_known_ids(test_directory)
|
267
|
-
|
268
|
-
|
269
|
-
expect(result).to eq(['1'])
|
270
|
-
end
|
271
|
-
|
272
|
-
it 'uses a default id column name' do
|
273
|
-
test_directory = CukeCataloger::FileHelper.create_directory
|
274
|
-
|
275
|
-
text = 'Feature:
|
276
|
-
|
277
|
-
@test_case_1
|
278
|
-
Scenario Outline:
|
279
|
-
* a step
|
280
|
-
Examples:
|
281
|
-
| param | test_case_id |
|
282
|
-
| value | 1-1 |'
|
283
|
-
|
284
|
-
CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => text)
|
285
|
-
|
286
|
-
|
287
|
-
result = @tagger.determine_known_ids(test_directory)
|
288
|
-
|
289
|
-
|
290
|
-
expect(result).to eq(['1', '1-1'])
|
291
|
-
end
|
292
|
-
|
293
|
-
end
|
294
|
-
|
295
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'UniqueTestCaseTagger, Unit' do
|
5
|
-
|
6
|
-
clazz = CukeCataloger::UniqueTestCaseTagger
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
@tagger = clazz.new
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'test tagging' do
|
13
|
-
it "can tag a suite's tests" do
|
14
|
-
expect(@tagger).to respond_to(:tag_tests)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'takes a directory, optional tag prefix, and an optional start index' do
|
18
|
-
expect(@tagger.method(:tag_tests).arity).to eq(-2)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'data validation' do
|
23
|
-
it "can check the validity of a suite's test ids" do
|
24
|
-
expect(@tagger).to respond_to(:validate_test_ids)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'validates based on a directory, optional tag prefix, and optional row tagging flag' do
|
28
|
-
expect(@tagger.method(:validate_test_ids).arity).to eq(-2)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'returns validation results' do
|
32
|
-
path = CukeCataloger::FileHelper.create_directory
|
33
|
-
results = @tagger.validate_test_ids(path, '')
|
34
|
-
|
35
|
-
expect(results).to be_a_kind_of(Array)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'test scanning' do
|
40
|
-
it "can scan for tagged tests" do
|
41
|
-
expect(@tagger).to respond_to(:scan_for_tagged_tests)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'validates based on a directory, optional tag prefix, and optional column name' do
|
45
|
-
expect(@tagger.method(:scan_for_tagged_tests).arity).to eq(-2)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'returns scanning results' do
|
49
|
-
path = CukeCataloger::FileHelper.create_directory
|
50
|
-
results = @tagger.scan_for_tagged_tests(path, '')
|
51
|
-
|
52
|
-
expect(results).to be_a_kind_of(Array)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe 'tag indexing' do
|
57
|
-
it "can determine used test case indexes" do
|
58
|
-
expect(@tagger).to respond_to(:determine_known_ids)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'determines used indexes based on a directory, optional tag prefix, and optional column name' do
|
62
|
-
expect(@tagger.method(:determine_known_ids).arity).to eq(-2)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe 'formatting' do
|
67
|
-
it 'has a tag location' do
|
68
|
-
expect(@tagger).to respond_to(:tag_location)
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'can change its tag location' do
|
72
|
-
expect(@tagger).to respond_to(:tag_location=)
|
73
|
-
|
74
|
-
@tagger.tag_location = :some_flag_value
|
75
|
-
expect(@tagger.tag_location).to eq(:some_flag_value)
|
76
|
-
@tagger.tag_location = :some_other_flag_value
|
77
|
-
expect(@tagger.tag_location).to eq(:some_other_flag_value)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
data/todo.txt
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# TODO - Include fewer files in the gem (i.e. dont include the tests). See other projects for examples.
|
2
|
-
# todo - Add better test coverage (rake tasks, cli, etc.)
|
3
|
-
# todo - Use features as documentation
|
4
|
-
# todo - Use the cuketagger gem for tagging
|
5
|
-
# todo - document functionality/add functionality for changing added tag location/column location
|