cucumber_analytics 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.rdoc +76 -0
- data/Rakefile +2 -0
- data/cucumber_analytics.gemspec +22 -0
- data/features/analysis/feature_collection.feature +39 -0
- data/features/analysis/feature_file_collection.feature +36 -0
- data/features/analysis/step_collection.feature +137 -0
- data/features/analysis/tag_collection.feature +91 -0
- data/features/analysis/test_collection.feature +69 -0
- data/features/analysis/test_comparison.feature +123 -0
- data/features/modeling/background_modeling.feature +147 -0
- data/features/modeling/directory_modeling.feature +86 -0
- data/features/modeling/feature_file_modeling.feature +37 -0
- data/features/modeling/feature_modeling.feature +163 -0
- data/features/modeling/outline_modeling.feature +186 -0
- data/features/modeling/scenario_modeling.feature +154 -0
- data/features/step_definitions/background_steps.rb +55 -0
- data/features/step_definitions/directory_steps.rb +20 -0
- data/features/step_definitions/feature_steps.rb +62 -0
- data/features/step_definitions/file_steps.rb +18 -0
- data/features/step_definitions/outline_steps.rb +26 -0
- data/features/step_definitions/setup_steps.rb +50 -0
- data/features/step_definitions/test_steps.rb +82 -0
- data/features/step_definitions/world_steps.rb +158 -0
- data/features/support/env.rb +29 -0
- data/features/support/transforms.rb +3 -0
- data/lib/cucumber_analytics/feature_element.rb +54 -0
- data/lib/cucumber_analytics/outline_example.rb +31 -0
- data/lib/cucumber_analytics/parsed_background.rb +23 -0
- data/lib/cucumber_analytics/parsed_directory.rb +56 -0
- data/lib/cucumber_analytics/parsed_feature.rb +70 -0
- data/lib/cucumber_analytics/parsed_file.rb +140 -0
- data/lib/cucumber_analytics/parsed_scenario.rb +29 -0
- data/lib/cucumber_analytics/parsed_scenario_outline.rb +57 -0
- data/lib/cucumber_analytics/step.rb +81 -0
- data/lib/cucumber_analytics/test_element.rb +93 -0
- data/lib/cucumber_analytics/version.rb +3 -0
- data/lib/cucumber_analytics/world.rb +182 -0
- data/lib/cucumber_analytics.rb +12 -0
- metadata +174 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 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.rdoc
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
= CucumberAnalytics
|
2
|
+
|
3
|
+
The intention of this gem is to provide a useful mechanism by which to answer
|
4
|
+
all of the burning questions that one might have about their Cucumber test base.
|
5
|
+
|
6
|
+
* Did old features get removed and leave dead step definitions behind? Or
|
7
|
+
perhaps the other way around and half of the steps in the code base are
|
8
|
+
undefined?
|
9
|
+
|
10
|
+
* Are there duplicate scenarios strewn about everywhere that only differ in
|
11
|
+
their step arguments and could be reduced into a single outline?
|
12
|
+
|
13
|
+
* Just how many different tags *are* there in this thing?
|
14
|
+
|
15
|
+
These are the kinds of questions that this gem aims to make answering easy,
|
16
|
+
either through directly providing the answer or by providing sufficient tools
|
17
|
+
that determining the answer yourself is just a few straightforward object
|
18
|
+
manipulations away.
|
19
|
+
|
20
|
+
== Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
gem 'cucumber_analytics'
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
$ gem install cucumber_analytics
|
33
|
+
|
34
|
+
== Usage
|
35
|
+
|
36
|
+
First things first. Load up the gem code.
|
37
|
+
|
38
|
+
require 'cucumber_analytics'
|
39
|
+
|
40
|
+
Next, let's generate a model for our Cucumber suite.
|
41
|
+
|
42
|
+
directory = CucumberAnalytics::ParsedDirectory.new('path/to/the/code_directory')
|
43
|
+
world = CucumberAnalytics::World
|
44
|
+
|
45
|
+
Now it's time to take a look around and see what we can see.
|
46
|
+
|
47
|
+
all_tags = world.tags_in(directory)
|
48
|
+
puts all_tags
|
49
|
+
#=> ["@Unit", "@Fragile", "@wip", "@wip", "@Critical", "@Unit", "@wip", "@Deprecated", "@wip", "@wip"]
|
50
|
+
|
51
|
+
puts all_tags.uniq
|
52
|
+
#=> ["@Unit", "@Fragile", "@wip", "@Critical", "@Deprecated"]
|
53
|
+
|
54
|
+
wip_tags = all_tags.select{ |tag| tag == '@wip' }
|
55
|
+
|
56
|
+
puts wip_tags.count.to_f / all_tags.count
|
57
|
+
#=> 0.5
|
58
|
+
|
59
|
+
|
60
|
+
all_steps = world.steps_in(directory)
|
61
|
+
puts all_steps.collect{ |step| step.step_text(with_keywords: false)}
|
62
|
+
#=> ["some step", "the user logs in", "the user will log in", "another step", "the user "Bob" logs in"]
|
63
|
+
|
64
|
+
So with a few simple commands we have discovered that there are five different
|
65
|
+
tags in our codebase and that @wip tags account for half of all usages. We have
|
66
|
+
also discovered that our team is creating several redundant steps that could be
|
67
|
+
rewritten into a single, reusable step.
|
68
|
+
|
69
|
+
|
70
|
+
== Contributing
|
71
|
+
|
72
|
+
1. Fork it
|
73
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
74
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
75
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
76
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/cucumber_analytics/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Eric Kessler"]
|
6
|
+
gem.email = ["morrow748@gmail.com"]
|
7
|
+
gem.description = %q{Static analysis of Cucumber tests made easy.}
|
8
|
+
gem.summary = %q{This gem provides an API to programmatically break down Cucumber feature files so that they can be inspected and analyzed in a straightforward manner.}
|
9
|
+
gem.homepage = "https://github.com/enkessler/cucumber_analytics"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "cucumber_analytics"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = CucumberAnalytics::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency("rake")
|
19
|
+
gem.add_development_dependency("cucumber")
|
20
|
+
gem.add_development_dependency("wrong")
|
21
|
+
gem.add_development_dependency("simplecov")
|
22
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: Features can be collected from arbitrary parts of the codebase.
|
2
|
+
|
3
|
+
|
4
|
+
Acceptance criteria
|
5
|
+
|
6
|
+
Features can be collected from:
|
7
|
+
1. files
|
8
|
+
2. directories
|
9
|
+
|
10
|
+
|
11
|
+
Background: Setup test codebase
|
12
|
+
Given a directory "feature_directory"
|
13
|
+
And the following feature file "test_file_1.feature":
|
14
|
+
"""
|
15
|
+
Feature: The test feature 1.
|
16
|
+
"""
|
17
|
+
And the file "test_file_1.feature" is read
|
18
|
+
And a directory "feature_directory/nested_directory"
|
19
|
+
And the following feature file "test_file_2.feature":
|
20
|
+
"""
|
21
|
+
Feature: The test feature 2.
|
22
|
+
"""
|
23
|
+
And the file "test_file_2.feature" is read
|
24
|
+
When the directory "feature_directory" is read
|
25
|
+
And the directory "feature_directory/nested_directory" is read
|
26
|
+
|
27
|
+
|
28
|
+
Scenario: Features can be collected from files
|
29
|
+
Then the features collected from file "1" are as follows:
|
30
|
+
| The test feature 1. |
|
31
|
+
Then the features collected from file "2" are as follows:
|
32
|
+
| The test feature 2. |
|
33
|
+
|
34
|
+
Scenario: Features can be collected from directories
|
35
|
+
Then the features collected from directory "1" are as follows:
|
36
|
+
| The test feature 1. |
|
37
|
+
| The test feature 2. |
|
38
|
+
And the features collected from directory "2" are as follows:
|
39
|
+
| The test feature 2. |
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Feature: Feature files can be collected from arbitrary parts of the codebase.
|
2
|
+
|
3
|
+
|
4
|
+
Acceptance criteria
|
5
|
+
|
6
|
+
Feature files can be collected from:
|
7
|
+
1. directories
|
8
|
+
|
9
|
+
|
10
|
+
Background: Setup test codebase
|
11
|
+
Given a directory "feature_directory"
|
12
|
+
And a directory "feature_directory/nested_directory_1"
|
13
|
+
And the following feature file "test_file_1.feature":
|
14
|
+
"""
|
15
|
+
Feature: The test feature 1.
|
16
|
+
"""
|
17
|
+
And the file "test_file_1.feature" is read
|
18
|
+
And a directory "feature_directory/nested_directory_2"
|
19
|
+
And the following feature file "test_file_2.feature":
|
20
|
+
"""
|
21
|
+
Feature: The test feature 2.
|
22
|
+
"""
|
23
|
+
And the file "test_file_2.feature" is read
|
24
|
+
When the directory "feature_directory" is read
|
25
|
+
And the directory "feature_directory/nested_directory_1" is read
|
26
|
+
And the directory "feature_directory/nested_directory_2" is read
|
27
|
+
|
28
|
+
|
29
|
+
Scenario: Feature files can be collected from directories
|
30
|
+
Then the files collected from directory "1" are as follows:
|
31
|
+
| test_file_1.feature |
|
32
|
+
| test_file_2.feature |
|
33
|
+
And the files collected from directory "2" are as follows:
|
34
|
+
| test_file_1.feature |
|
35
|
+
And the files collected from directory "3" are as follows:
|
36
|
+
| test_file_2.feature |
|
@@ -0,0 +1,137 @@
|
|
1
|
+
Feature: Steps can be collected from arbitrary parts of the codebase.
|
2
|
+
|
3
|
+
|
4
|
+
Acceptance criteria
|
5
|
+
|
6
|
+
Steps (both defined and undefined) can be collected from:
|
7
|
+
1. backgrounds
|
8
|
+
2. scenarios
|
9
|
+
3. outlines
|
10
|
+
4. features
|
11
|
+
5. files
|
12
|
+
6. directories
|
13
|
+
|
14
|
+
|
15
|
+
Background: Setup test directories
|
16
|
+
Given a directory "feature_directory"
|
17
|
+
And the following feature file "test_file_1.feature":
|
18
|
+
"""
|
19
|
+
Feature: The test feature 1.
|
20
|
+
|
21
|
+
Background: Some general test setup stuff.
|
22
|
+
Given a defined step
|
23
|
+
And an undefined step
|
24
|
+
|
25
|
+
Scenario: The scenario's name.
|
26
|
+
Given another defined step
|
27
|
+
Then another undefined step
|
28
|
+
"""
|
29
|
+
And the file "test_file_1.feature" is read
|
30
|
+
And a directory "feature_directory/nested_directory"
|
31
|
+
And the following feature file "test_file_2.feature":
|
32
|
+
"""
|
33
|
+
Feature: The test feature 2.
|
34
|
+
|
35
|
+
Scenario Outline: The scenario outline's name.
|
36
|
+
Given a defined step
|
37
|
+
When another defined step
|
38
|
+
Then *<this>* *step is* *<undefined>*
|
39
|
+
Examples:
|
40
|
+
| this | undefined |
|
41
|
+
| x | y |
|
42
|
+
Examples:
|
43
|
+
| this | undefined |
|
44
|
+
| a | b |
|
45
|
+
"""
|
46
|
+
And the file "test_file_2.feature" is read
|
47
|
+
And the following step definition file "some_step_defs.rb":
|
48
|
+
"""
|
49
|
+
Given /^a defined step$/ do
|
50
|
+
pending
|
51
|
+
end
|
52
|
+
"""
|
53
|
+
And the following step definition file "more_step_defs.rb":
|
54
|
+
"""
|
55
|
+
Given /^another defined step$/ do
|
56
|
+
pending
|
57
|
+
end
|
58
|
+
"""
|
59
|
+
When the step definition file "some_step_defs.rb" is read
|
60
|
+
And the step definition file "more_step_defs.rb" is read
|
61
|
+
And the directory "feature_directory" is read
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
Scenario: Steps can be collected from backgrounds
|
66
|
+
Then the steps collected from feature "1" background are as follows:
|
67
|
+
| Given a defined step |
|
68
|
+
| And an undefined step |
|
69
|
+
And the "defined" steps collected from feature "1" background are as follows:
|
70
|
+
| Given a defined step |
|
71
|
+
And the "undefined" steps collected from feature "1" background are as follows:
|
72
|
+
| And an undefined step |
|
73
|
+
|
74
|
+
Scenario: Steps can be collected from scenarios
|
75
|
+
Then the steps collected from feature "1" test "1" are as follows:
|
76
|
+
| Given another defined step |
|
77
|
+
| Then another undefined step |
|
78
|
+
And the "defined" steps collected from feature "1" test "1" are as follows:
|
79
|
+
| Given another defined step |
|
80
|
+
And the "undefined" steps collected from feature "1" test "1" are as follows:
|
81
|
+
| Then another undefined step |
|
82
|
+
|
83
|
+
Scenario: Steps can be collected from scenario outlines
|
84
|
+
Then the steps collected from feature "2" test "1" are as follows:
|
85
|
+
| Given a defined step |
|
86
|
+
| When another defined step |
|
87
|
+
| Then *<this>* *step is* *<undefined>* |
|
88
|
+
And the "defined" steps collected from feature "2" test "1" are as follows:
|
89
|
+
| Given a defined step |
|
90
|
+
| When another defined step |
|
91
|
+
And the "undefined" steps collected from feature "2" test "1" are as follows:
|
92
|
+
| Then *<this>* *step is* *<undefined>* |
|
93
|
+
|
94
|
+
Scenario: Steps can be collected from features
|
95
|
+
Then the steps collected from feature "1" are as follows:
|
96
|
+
| Given a defined step |
|
97
|
+
| And an undefined step |
|
98
|
+
| Given another defined step |
|
99
|
+
| Then another undefined step |
|
100
|
+
And the "defined" steps collected from feature "1" are as follows:
|
101
|
+
| Given a defined step |
|
102
|
+
| Given another defined step |
|
103
|
+
And the "undefined" steps collected from feature "1" are as follows:
|
104
|
+
| And an undefined step |
|
105
|
+
| Then another undefined step |
|
106
|
+
|
107
|
+
Scenario: Steps can be collected from files
|
108
|
+
Then the steps collected from file "1" are as follows:
|
109
|
+
| Given a defined step |
|
110
|
+
| And an undefined step |
|
111
|
+
| Given another defined step |
|
112
|
+
| Then another undefined step |
|
113
|
+
And the "defined" steps collected from file "1" are as follows:
|
114
|
+
| Given a defined step |
|
115
|
+
| Given another defined step |
|
116
|
+
And the "undefined" steps collected from file "1" are as follows:
|
117
|
+
| And an undefined step |
|
118
|
+
| Then another undefined step |
|
119
|
+
|
120
|
+
Scenario: Steps can be collected from directories
|
121
|
+
Then the steps collected from the directory are as follows:
|
122
|
+
| Given a defined step |
|
123
|
+
| And an undefined step |
|
124
|
+
| Given another defined step |
|
125
|
+
| Then another undefined step |
|
126
|
+
| Given a defined step |
|
127
|
+
| When another defined step |
|
128
|
+
| Then *<this>* *step is* *<undefined>* |
|
129
|
+
And the "defined" steps collected from the directory are as follows:
|
130
|
+
| Given a defined step |
|
131
|
+
| Given another defined step |
|
132
|
+
| Given a defined step |
|
133
|
+
| When another defined step |
|
134
|
+
And the "undefined" steps collected from the directory are as follows:
|
135
|
+
| And an undefined step |
|
136
|
+
| Then another undefined step |
|
137
|
+
| Then *<this>* *step is* *<undefined>* |
|
@@ -0,0 +1,91 @@
|
|
1
|
+
Feature: Tags can be collected from arbitrary parts of the codebase.
|
2
|
+
|
3
|
+
|
4
|
+
Acceptance criteria
|
5
|
+
|
6
|
+
Tags can be collected from:
|
7
|
+
1. scenarios
|
8
|
+
2. outlines
|
9
|
+
3. features
|
10
|
+
4. files
|
11
|
+
5. directories
|
12
|
+
|
13
|
+
|
14
|
+
Background: Setup test codebase
|
15
|
+
Given a directory "feature_directory"
|
16
|
+
And the following feature file "test_file_1.feature":
|
17
|
+
"""
|
18
|
+
@feature_tag_1
|
19
|
+
Feature: The test feature 1.
|
20
|
+
|
21
|
+
@scenario_tag_1
|
22
|
+
Scenario: The first scenario's name.
|
23
|
+
Given the first step
|
24
|
+
When the second step
|
25
|
+
Then the third step
|
26
|
+
|
27
|
+
@outline_tag_1
|
28
|
+
Scenario Outline: The scenario outline's name.
|
29
|
+
Given the first "<param1>"
|
30
|
+
When the second "<param2>"
|
31
|
+
Then the third step
|
32
|
+
@example_tag_1
|
33
|
+
Examples: text describing the significance of the examples
|
34
|
+
| param1 | param2 |
|
35
|
+
| x | y |
|
36
|
+
@example_tag_2
|
37
|
+
Examples: some examples with different significance and a tag
|
38
|
+
| param1 | param2 |
|
39
|
+
| a | b |
|
40
|
+
"""
|
41
|
+
And the file "test_file_1.feature" is read
|
42
|
+
And a directory "feature_directory/nested_directory"
|
43
|
+
And the following feature file "test_file_2.feature":
|
44
|
+
"""
|
45
|
+
@feature_tag_2
|
46
|
+
Feature: The test feature 2.
|
47
|
+
|
48
|
+
@scenario_tag_2
|
49
|
+
Scenario: The first scenario's name.
|
50
|
+
Given the first step
|
51
|
+
When the second step
|
52
|
+
Then the third step
|
53
|
+
"""
|
54
|
+
And the file "test_file_2.feature" is read
|
55
|
+
When the directory "feature_directory" is read
|
56
|
+
|
57
|
+
Scenario: Tags can be collected from scenarios
|
58
|
+
Then the tags collected from feature "1" test "1" are as follows:
|
59
|
+
| @scenario_tag_1 |
|
60
|
+
|
61
|
+
Scenario: Tags can be collected from scenario outlines
|
62
|
+
Then the tags collected from feature "1" test "2" are as follows:
|
63
|
+
| @outline_tag_1 |
|
64
|
+
| @example_tag_1 |
|
65
|
+
| @example_tag_2 |
|
66
|
+
|
67
|
+
Scenario: Tags can be collected from features
|
68
|
+
Then the tags collected from feature "1" are as follows:
|
69
|
+
| @feature_tag_1 |
|
70
|
+
| @scenario_tag_1 |
|
71
|
+
| @outline_tag_1 |
|
72
|
+
| @example_tag_1 |
|
73
|
+
| @example_tag_2 |
|
74
|
+
|
75
|
+
Scenario: Tags can be collected from files
|
76
|
+
Then the tags collected from file "1" are as follows:
|
77
|
+
| @feature_tag_1 |
|
78
|
+
| @scenario_tag_1 |
|
79
|
+
| @outline_tag_1 |
|
80
|
+
| @example_tag_1 |
|
81
|
+
| @example_tag_2 |
|
82
|
+
|
83
|
+
Scenario: Tags can be collected from directories
|
84
|
+
Then the tags collected from directory are as follows:
|
85
|
+
| @feature_tag_1 |
|
86
|
+
| @scenario_tag_1 |
|
87
|
+
| @outline_tag_1 |
|
88
|
+
| @example_tag_1 |
|
89
|
+
| @example_tag_2 |
|
90
|
+
| @feature_tag_2 |
|
91
|
+
| @scenario_tag_2 |
|
@@ -0,0 +1,69 @@
|
|
1
|
+
Feature: Tests can be collected from arbitrary parts of the codebase.
|
2
|
+
|
3
|
+
|
4
|
+
Acceptance criteria
|
5
|
+
|
6
|
+
Tests can be collected from:
|
7
|
+
1. features
|
8
|
+
2. files
|
9
|
+
3. directories
|
10
|
+
|
11
|
+
|
12
|
+
Background: Setup test codebase
|
13
|
+
Given a directory "feature_directory"
|
14
|
+
And the following feature file "test_file_1.feature":
|
15
|
+
"""
|
16
|
+
Feature: The test feature 1.
|
17
|
+
|
18
|
+
Scenario: Test 1
|
19
|
+
Given the first step
|
20
|
+
When the second step
|
21
|
+
Then the third step
|
22
|
+
|
23
|
+
Scenario Outline: Test 2
|
24
|
+
Given the first "<param1>"
|
25
|
+
When the second "<param2>"
|
26
|
+
Then the third step
|
27
|
+
Examples: text describing the significance of the examples
|
28
|
+
| param1 | param2 |
|
29
|
+
| x | y |
|
30
|
+
Examples: some examples with different significance and a tag
|
31
|
+
| param1 | param2 |
|
32
|
+
| a | b |
|
33
|
+
"""
|
34
|
+
And the file "test_file_1.feature" is read
|
35
|
+
And a directory "feature_directory/nested_directory"
|
36
|
+
And the following feature file "test_file_2.feature":
|
37
|
+
"""
|
38
|
+
Feature: The test feature 2.
|
39
|
+
|
40
|
+
Scenario: Test 3
|
41
|
+
Given the first step
|
42
|
+
When the second step
|
43
|
+
Then the third step
|
44
|
+
"""
|
45
|
+
And the file "test_file_2.feature" is read
|
46
|
+
When the directory "feature_directory" is read
|
47
|
+
And the directory "feature_directory/nested_directory" is read
|
48
|
+
|
49
|
+
Scenario: Tests can be collected from features
|
50
|
+
Then the tests collected from feature "1" are as follows:
|
51
|
+
| Test 1 |
|
52
|
+
| Test 2 |
|
53
|
+
Then the tests collected from feature "2" are as follows:
|
54
|
+
| Test 3 |
|
55
|
+
|
56
|
+
Scenario: Tests can be collected from files
|
57
|
+
Then the tests collected from file "1" are as follows:
|
58
|
+
| Test 1 |
|
59
|
+
| Test 2 |
|
60
|
+
Then the tests collected from file "2" are as follows:
|
61
|
+
| Test 3 |
|
62
|
+
|
63
|
+
Scenario: Tests can be collected from directories
|
64
|
+
Then the tests collected from directory "1" are as follows:
|
65
|
+
| Test 1 |
|
66
|
+
| Test 2 |
|
67
|
+
| Test 3 |
|
68
|
+
And the tests collected from directory "2" are as follows:
|
69
|
+
| Test 3 |
|
@@ -0,0 +1,123 @@
|
|
1
|
+
Feature: Test equality can be determined.
|
2
|
+
|
3
|
+
|
4
|
+
Acceptance criteria
|
5
|
+
|
6
|
+
Tests can be compared for equality.
|
7
|
+
1. tests whose steps are the same except for arguments and keywords (i.e.
|
8
|
+
they match the same step definition) are equal
|
9
|
+
|
10
|
+
|
11
|
+
Background: Test file setup.
|
12
|
+
Given the following feature file:
|
13
|
+
"""
|
14
|
+
Feature: A feature with duplicate tests.
|
15
|
+
|
16
|
+
Scenario: A test
|
17
|
+
Given this *parameterized* step takes a table:
|
18
|
+
| data 1 |
|
19
|
+
| data 2 |
|
20
|
+
And some setup step
|
21
|
+
When a step with a *parameter*
|
22
|
+
And a big step:
|
23
|
+
\"\"\"
|
24
|
+
little doc block
|
25
|
+
\"\"\"
|
26
|
+
Then *lots* *of* *parameters*
|
27
|
+
|
28
|
+
Scenario: Same test, different arguments and keywords
|
29
|
+
Given this *similarly parameterized* step takes a table:
|
30
|
+
| data 3 |
|
31
|
+
| data 4 |
|
32
|
+
Given some setup step
|
33
|
+
When a step with a *parameter*
|
34
|
+
* a big step:
|
35
|
+
\"\"\"
|
36
|
+
A little
|
37
|
+
bigger doc block
|
38
|
+
\"\"\"
|
39
|
+
Then *lots* *of* *parameters*
|
40
|
+
|
41
|
+
Scenario Outline: This is the same test as an outline
|
42
|
+
Given this *parameterized* step takes a table:
|
43
|
+
| <param1> |
|
44
|
+
| <param2> |
|
45
|
+
And some setup step
|
46
|
+
When a step with a *parameter*
|
47
|
+
And a big step:
|
48
|
+
\"\"\"
|
49
|
+
little doc block
|
50
|
+
\"\"\"
|
51
|
+
Then *lots* *of* *parameters*
|
52
|
+
Examples:
|
53
|
+
| param1 | param2 |
|
54
|
+
| x | y |
|
55
|
+
Examples:
|
56
|
+
| param1 | param2 |
|
57
|
+
| a | b |
|
58
|
+
|
59
|
+
Scenario Outline: Same outline, different arguments and keywords
|
60
|
+
Given this *similarly parameterized* step takes a table:
|
61
|
+
| <param3> |
|
62
|
+
| <param4> |
|
63
|
+
Given some setup step
|
64
|
+
When a step with a *slightly different parameter*
|
65
|
+
* a big step:
|
66
|
+
\"\"\"
|
67
|
+
A little
|
68
|
+
bigger doc block
|
69
|
+
\"\"\"
|
70
|
+
Then *lots* *of effectively the same* *parameters*
|
71
|
+
Examples:
|
72
|
+
| param1 | param2 |
|
73
|
+
| h | k |
|
74
|
+
Examples:
|
75
|
+
| param1 | param2 |
|
76
|
+
| i | j |
|
77
|
+
|
78
|
+
Scenario: A different test
|
79
|
+
Given this *parameterized* step takes a table:
|
80
|
+
| data 1 |
|
81
|
+
| data 2 |
|
82
|
+
And not the same setup step as before
|
83
|
+
When a step with a *parameter*
|
84
|
+
And a big step:
|
85
|
+
\"\"\"
|
86
|
+
little doc block
|
87
|
+
\"\"\"
|
88
|
+
Then *lots* *of* *parameters*
|
89
|
+
|
90
|
+
Scenario Outline: This is the same different test as an outline
|
91
|
+
Given this *similarly parameterized* step takes a table:
|
92
|
+
| <param1> |
|
93
|
+
| <param2> |
|
94
|
+
And not the same setup step as before
|
95
|
+
When a step with a *slightly different parameter*
|
96
|
+
And a big step:
|
97
|
+
\"\"\"
|
98
|
+
A little
|
99
|
+
bigger doc block
|
100
|
+
\"\"\"
|
101
|
+
Then *lots* *of effectively the same* *parameters*
|
102
|
+
Examples:
|
103
|
+
| param1 | param2 |
|
104
|
+
| x | y |
|
105
|
+
Examples:
|
106
|
+
| param1 | param2 |
|
107
|
+
| a | b |
|
108
|
+
"""
|
109
|
+
And parameter delimiters of "*" and "*"
|
110
|
+
When the file is read
|
111
|
+
|
112
|
+
|
113
|
+
Scenario: Scenario to Scenario comparison
|
114
|
+
Then test "1" is equal to test "2"
|
115
|
+
And test "1" is not equal to test "5"
|
116
|
+
|
117
|
+
Scenario: Outline to Outline comparison
|
118
|
+
Then test "3" is equal to test "4"
|
119
|
+
And test "3" is not equal to test "6"
|
120
|
+
|
121
|
+
Scenario: Scenario to Outline comparison
|
122
|
+
Then test "1" is equal to test "3"
|
123
|
+
And test "1" is not equal to test "6"
|