cuke_modeler 3.27.0 → 3.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +579 -572
- data/LICENSE.txt +22 -22
- data/README.md +135 -135
- data/cuke_modeler.gemspec +59 -59
- data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_15_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_16_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_17_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_18_adapter.rb +27 -27
- data/lib/cuke_modeler/adapters/gherkin_19_adapter.rb +64 -64
- data/lib/cuke_modeler/adapters/gherkin_20_adapter.rb +359 -359
- data/lib/cuke_modeler/adapters/gherkin_21_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_22_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_23_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_24_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_25_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_26_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_27_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_28_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_29_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_30_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_31_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_32_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_33_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_34_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_35_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_36_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_37_adapter.rb +13 -13
- data/lib/cuke_modeler/adapters/gherkin_38_adapter.rb +13 -0
- data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +375 -375
- data/lib/cuke_modeler/adapters/gherkin_base_adapter.rb +17 -17
- data/lib/cuke_modeler/containing.rb +105 -105
- data/lib/cuke_modeler/described.rb +71 -71
- data/lib/cuke_modeler/models/background.rb +122 -122
- data/lib/cuke_modeler/models/cell.rb +88 -88
- data/lib/cuke_modeler/models/comment.rb +82 -82
- data/lib/cuke_modeler/models/directory.rb +143 -143
- data/lib/cuke_modeler/models/doc_string.rb +104 -104
- data/lib/cuke_modeler/models/example.rb +274 -274
- data/lib/cuke_modeler/models/feature.rb +200 -200
- data/lib/cuke_modeler/models/feature_file.rb +116 -116
- data/lib/cuke_modeler/models/model.rb +87 -87
- data/lib/cuke_modeler/models/outline.rb +145 -145
- data/lib/cuke_modeler/models/row.rb +104 -104
- data/lib/cuke_modeler/models/rule.rb +162 -162
- data/lib/cuke_modeler/models/scenario.rb +128 -128
- data/lib/cuke_modeler/models/step.rb +178 -178
- data/lib/cuke_modeler/models/table.rb +117 -117
- data/lib/cuke_modeler/models/tag.rb +75 -75
- data/lib/cuke_modeler/named.rb +26 -26
- data/lib/cuke_modeler/nested.rb +61 -61
- data/lib/cuke_modeler/parsed.rb +24 -24
- data/lib/cuke_modeler/parsing.rb +208 -208
- data/lib/cuke_modeler/sourceable.rb +29 -29
- data/lib/cuke_modeler/stepped.rb +34 -34
- data/lib/cuke_modeler/taggable.rb +57 -57
- data/lib/cuke_modeler/version.rb +4 -4
- data/lib/cuke_modeler.rb +32 -32
- data/testing/cucumber/features/analysis/step_comparison.feature +25 -25
- data/testing/cucumber/features/analysis/test_comparison.feature +35 -35
- data/testing/cucumber/features/modeling/background_modeling.feature +105 -105
- data/testing/cucumber/features/modeling/background_output.feature +60 -60
- data/testing/cucumber/features/modeling/cell_modeling.feature +68 -68
- data/testing/cucumber/features/modeling/cell_output.feature +36 -36
- data/testing/cucumber/features/modeling/comment_modeling.feature +62 -62
- data/testing/cucumber/features/modeling/comment_output.feature +40 -40
- data/testing/cucumber/features/modeling/directory_modeling.feature +62 -62
- data/testing/cucumber/features/modeling/directory_output.feature +33 -33
- data/testing/cucumber/features/modeling/doc_string_modeling.feature +85 -85
- data/testing/cucumber/features/modeling/doc_string_output.feature +50 -50
- data/testing/cucumber/features/modeling/example_modeling.feature +155 -155
- data/testing/cucumber/features/modeling/example_output.feature +57 -57
- data/testing/cucumber/features/modeling/feature_file_modeling.feature +49 -49
- data/testing/cucumber/features/modeling/feature_file_output.feature +33 -33
- data/testing/cucumber/features/modeling/feature_modeling.feature +149 -149
- data/testing/cucumber/features/modeling/feature_output.feature +144 -144
- data/testing/cucumber/features/modeling/model_output.feature +61 -61
- data/testing/cucumber/features/modeling/model_structure.feature +42 -42
- data/testing/cucumber/features/modeling/outline_modeling.feature +175 -175
- data/testing/cucumber/features/modeling/outline_output.feature +87 -87
- data/testing/cucumber/features/modeling/row_modeling.feature +70 -70
- data/testing/cucumber/features/modeling/row_output.feature +40 -40
- data/testing/cucumber/features/modeling/rule_modeling.feature +171 -171
- data/testing/cucumber/features/modeling/rule_output.feature +136 -136
- data/testing/cucumber/features/modeling/scenario_modeling.feature +146 -146
- data/testing/cucumber/features/modeling/scenario_output.feature +63 -63
- data/testing/cucumber/features/modeling/step_modeling.feature +105 -105
- data/testing/cucumber/features/modeling/step_output.feature +47 -47
- data/testing/cucumber/features/modeling/table_modeling.feature +73 -73
- data/testing/cucumber/features/modeling/table_output.feature +42 -42
- data/testing/cucumber/features/modeling/tag_modeling.feature +62 -62
- data/testing/cucumber/features/modeling/tag_output.feature +40 -40
- metadata +6 -8
data/LICENSE.txt
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
Copyright (c) 2014-2026 Eric Kessler, et al
|
|
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-2026 Eric Kessler, et al
|
|
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,135 +1,135 @@
|
|
|
1
|
-
Basic stuff:
|
|
2
|
-
[](https://rubygems.org/gems/cuke_modeler)
|
|
3
|
-
[](https://opensource.org/licenses/mit-license.php)
|
|
4
|
-
[](https://rubygems.org/gems/cuke_modeler)
|
|
5
|
-
|
|
6
|
-
User stuff:
|
|
7
|
-
[](https://github.com/enkessler/cuke_modeler/tree/master/testing/cucumber/features)
|
|
8
|
-
[](https://www.rubydoc.info/gems/cuke_modeler)
|
|
9
|
-
|
|
10
|
-
Developer stuff:
|
|
11
|
-
[](https://github.com/enkessler/cuke_modeler/actions/workflows/ci.yml?query=branch%3Amaster)
|
|
12
|
-
[](https://coveralls.io/github/enkessler/cuke_modeler?branch=master)
|
|
13
|
-
[](https://codeclimate.com/github/enkessler/cuke_modeler/maintainability)
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# CukeModeler
|
|
18
|
-
|
|
19
|
-
There comes a time in every programmer's adventures with Cucumber when they
|
|
20
|
-
want to do Really Cool Stuff with their tests. This usually necessitates
|
|
21
|
-
scanning all of their feature files and playing with the output. While the
|
|
22
|
-
**[cucumber-gherkin](https://github.com/cucumber/gherkin)** gem ([previously](https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md#300---2020-06-08) just the `gherkin` gem) does a fine job of parsing feature files, reading or even manipulating
|
|
23
|
-
the resulting Abstract Syntax Tree is not always fun. **cuke_modeler** comes to
|
|
24
|
-
the rescue by providing a modeling layer that is easier to work with.
|
|
25
|
-
|
|
26
|
-
Whether you just want something that will let you easily inspect your test
|
|
27
|
-
suite or you are looking for a foundation tool upon which to build something
|
|
28
|
-
[Really Neat](#projects), this gem has you covered.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## Installation
|
|
32
|
-
|
|
33
|
-
Add this line to your application's Gemfile:
|
|
34
|
-
|
|
35
|
-
gem 'cuke_modeler'
|
|
36
|
-
|
|
37
|
-
And then execute:
|
|
38
|
-
|
|
39
|
-
$ bundle
|
|
40
|
-
|
|
41
|
-
Or install it yourself as:
|
|
42
|
-
|
|
43
|
-
$ gem install cuke_modeler
|
|
44
|
-
|
|
45
|
-
## Usage
|
|
46
|
-
|
|
47
|
-
First, load up the gem code.
|
|
48
|
-
|
|
49
|
-
require 'cuke_modeler'
|
|
50
|
-
|
|
51
|
-
Next, choose what you want to model. Directories and feature files are the most
|
|
52
|
-
common thing to model but smaller portions of a test suite can be modeled as
|
|
53
|
-
well.
|
|
54
|
-
|
|
55
|
-
directory = CukeModeler::Directory.new('path/to/the/code_directory')
|
|
56
|
-
file = CukeModeler::FeatureFile.new('path/to/the/feature_file')
|
|
57
|
-
|
|
58
|
-
gherkin = "Scenario: some test\n* a step"
|
|
59
|
-
test = CukeModeler::Scenario.new(gherkin)
|
|
60
|
-
|
|
61
|
-
The models can then be inspected for information.
|
|
62
|
-
|
|
63
|
-
directory.path #=> 'path/to/the/code_directory'
|
|
64
|
-
file.feature.name #=> 'the name of the feature'
|
|
65
|
-
test.steps.count #=> 1
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Things can be done in the other direction as well by starting with empty models
|
|
69
|
-
and setting their attributes afterward.
|
|
70
|
-
|
|
71
|
-
step = CukeModeler::Step.new
|
|
72
|
-
step.keyword = 'Given'
|
|
73
|
-
step.text = 'some step'
|
|
74
|
-
|
|
75
|
-
test = CukeModeler::Scenario.new
|
|
76
|
-
test.steps = [step]
|
|
77
|
-
|
|
78
|
-
test.to_s #=> "Scenario:\n Given some step"
|
|
79
|
-
|
|
80
|
-
One could, if so inclined, use this method to dynamically edit or even create
|
|
81
|
-
an entire test suite!
|
|
82
|
-
|
|
83
|
-
For more information on the different models (which more or less have the same relation
|
|
84
|
-
to each other as described in the AST [here](https://github.com/cucumber/cucumber/tree/master/gherkin#ast)) and how to use them, see the
|
|
85
|
-
[documentation](https://github.com/enkessler/cuke_modeler/tree/master/testing/cucumber/features).
|
|
86
|
-
|
|
87
|
-
## Modeling dialects other than English
|
|
88
|
-
|
|
89
|
-
The modeling functionality provided by this gem will work with any dialect that
|
|
90
|
-
is supported by the **cucumber-gherkin** gem. For modeling at the feature level or higher,
|
|
91
|
-
no additional effort is needed because the `# language` header at the top of a
|
|
92
|
-
feature already indicates that a non-default dialect is being used.
|
|
93
|
-
|
|
94
|
-
# language: en-au
|
|
95
|
-
Pretty much: An 'Australian' feature
|
|
96
|
-
|
|
97
|
-
Aww, look mate: An 'Australian' scenario
|
|
98
|
-
* a step
|
|
99
|
-
|
|
100
|
-
In order to model smaller portions of Gherkin, however, the parser will need
|
|
101
|
-
to be told what dialect is being used.
|
|
102
|
-
|
|
103
|
-
# Setting the dialect to 'Australian'
|
|
104
|
-
CukeModeler::Parsing.dialect = 'en-au'
|
|
105
|
-
|
|
106
|
-
gherkin = "Awww, look mate: some test\n* a step"
|
|
107
|
-
test = CukeModeler::Scenario.new(gherkin)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
## Modeling other versions of Cucumber
|
|
111
|
-
|
|
112
|
-
Although this gem is written in Ruby and requires it to run, the modeling
|
|
113
|
-
capabilities provided are for the feature file layer of a Cucumber test suite.
|
|
114
|
-
As such, any feature file that is written in Gherkin can be modeled, even if
|
|
115
|
-
that feature is ultimately run with SpecFlow (Cucumber for C#), Lettuce
|
|
116
|
-
(Cucumber for Python), or some other flavor of Cucumber.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### <a id="projects"></a>Other gems that are powered by **cuke_modeler**
|
|
120
|
-
|
|
121
|
-
* [cql](https://github.com/enkessler/cql) - A convenient DSL for querying modeled Gherkin documents
|
|
122
|
-
* [cuketagger](https://github.com/enkessler/cuketagger) - A tool for adding tags to feature files
|
|
123
|
-
* [cuke_cataloger](https://github.com/enkessler/cuke_cataloger) - Easily add uniques IDs to every test case in a suite
|
|
124
|
-
* [cuke_slicer](https://github.com/enkessler/cuke_slicer) - Break a test suite down into discrete test cases for easy parallel distribution
|
|
125
|
-
* [cuke_linter](https://github.com/enkessler/cuke_linter) - Identify common code smells in your Gherkin
|
|
126
|
-
* [turnip](https://github.com/jnicklas/turnip) – Write tests in Gherkin and run them through your RSpec environment
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
## Development and Contributing
|
|
130
|
-
|
|
131
|
-
See [CONTRIBUTING.md](https://github.com/enkessler/cuke_modeler/blob/master/CONTRIBUTING.md)
|
|
132
|
-
|
|
133
|
-
## License
|
|
134
|
-
|
|
135
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
1
|
+
Basic stuff:
|
|
2
|
+
[](https://rubygems.org/gems/cuke_modeler)
|
|
3
|
+
[](https://opensource.org/licenses/mit-license.php)
|
|
4
|
+
[](https://rubygems.org/gems/cuke_modeler)
|
|
5
|
+
|
|
6
|
+
User stuff:
|
|
7
|
+
[](https://github.com/enkessler/cuke_modeler/tree/master/testing/cucumber/features)
|
|
8
|
+
[](https://www.rubydoc.info/gems/cuke_modeler)
|
|
9
|
+
|
|
10
|
+
Developer stuff:
|
|
11
|
+
[](https://github.com/enkessler/cuke_modeler/actions/workflows/ci.yml?query=branch%3Amaster)
|
|
12
|
+
[](https://coveralls.io/github/enkessler/cuke_modeler?branch=master)
|
|
13
|
+
[](https://codeclimate.com/github/enkessler/cuke_modeler/maintainability)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# CukeModeler
|
|
18
|
+
|
|
19
|
+
There comes a time in every programmer's adventures with Cucumber when they
|
|
20
|
+
want to do Really Cool Stuff with their tests. This usually necessitates
|
|
21
|
+
scanning all of their feature files and playing with the output. While the
|
|
22
|
+
**[cucumber-gherkin](https://github.com/cucumber/gherkin)** gem ([previously](https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md#300---2020-06-08) just the `gherkin` gem) does a fine job of parsing feature files, reading or even manipulating
|
|
23
|
+
the resulting Abstract Syntax Tree is not always fun. **cuke_modeler** comes to
|
|
24
|
+
the rescue by providing a modeling layer that is easier to work with.
|
|
25
|
+
|
|
26
|
+
Whether you just want something that will let you easily inspect your test
|
|
27
|
+
suite or you are looking for a foundation tool upon which to build something
|
|
28
|
+
[Really Neat](#projects), this gem has you covered.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Add this line to your application's Gemfile:
|
|
34
|
+
|
|
35
|
+
gem 'cuke_modeler'
|
|
36
|
+
|
|
37
|
+
And then execute:
|
|
38
|
+
|
|
39
|
+
$ bundle
|
|
40
|
+
|
|
41
|
+
Or install it yourself as:
|
|
42
|
+
|
|
43
|
+
$ gem install cuke_modeler
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
First, load up the gem code.
|
|
48
|
+
|
|
49
|
+
require 'cuke_modeler'
|
|
50
|
+
|
|
51
|
+
Next, choose what you want to model. Directories and feature files are the most
|
|
52
|
+
common thing to model but smaller portions of a test suite can be modeled as
|
|
53
|
+
well.
|
|
54
|
+
|
|
55
|
+
directory = CukeModeler::Directory.new('path/to/the/code_directory')
|
|
56
|
+
file = CukeModeler::FeatureFile.new('path/to/the/feature_file')
|
|
57
|
+
|
|
58
|
+
gherkin = "Scenario: some test\n* a step"
|
|
59
|
+
test = CukeModeler::Scenario.new(gherkin)
|
|
60
|
+
|
|
61
|
+
The models can then be inspected for information.
|
|
62
|
+
|
|
63
|
+
directory.path #=> 'path/to/the/code_directory'
|
|
64
|
+
file.feature.name #=> 'the name of the feature'
|
|
65
|
+
test.steps.count #=> 1
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
Things can be done in the other direction as well by starting with empty models
|
|
69
|
+
and setting their attributes afterward.
|
|
70
|
+
|
|
71
|
+
step = CukeModeler::Step.new
|
|
72
|
+
step.keyword = 'Given'
|
|
73
|
+
step.text = 'some step'
|
|
74
|
+
|
|
75
|
+
test = CukeModeler::Scenario.new
|
|
76
|
+
test.steps = [step]
|
|
77
|
+
|
|
78
|
+
test.to_s #=> "Scenario:\n Given some step"
|
|
79
|
+
|
|
80
|
+
One could, if so inclined, use this method to dynamically edit or even create
|
|
81
|
+
an entire test suite!
|
|
82
|
+
|
|
83
|
+
For more information on the different models (which more or less have the same relation
|
|
84
|
+
to each other as described in the AST [here](https://github.com/cucumber/cucumber/tree/master/gherkin#ast)) and how to use them, see the
|
|
85
|
+
[documentation](https://github.com/enkessler/cuke_modeler/tree/master/testing/cucumber/features).
|
|
86
|
+
|
|
87
|
+
## Modeling dialects other than English
|
|
88
|
+
|
|
89
|
+
The modeling functionality provided by this gem will work with any dialect that
|
|
90
|
+
is supported by the **cucumber-gherkin** gem. For modeling at the feature level or higher,
|
|
91
|
+
no additional effort is needed because the `# language` header at the top of a
|
|
92
|
+
feature already indicates that a non-default dialect is being used.
|
|
93
|
+
|
|
94
|
+
# language: en-au
|
|
95
|
+
Pretty much: An 'Australian' feature
|
|
96
|
+
|
|
97
|
+
Aww, look mate: An 'Australian' scenario
|
|
98
|
+
* a step
|
|
99
|
+
|
|
100
|
+
In order to model smaller portions of Gherkin, however, the parser will need
|
|
101
|
+
to be told what dialect is being used.
|
|
102
|
+
|
|
103
|
+
# Setting the dialect to 'Australian'
|
|
104
|
+
CukeModeler::Parsing.dialect = 'en-au'
|
|
105
|
+
|
|
106
|
+
gherkin = "Awww, look mate: some test\n* a step"
|
|
107
|
+
test = CukeModeler::Scenario.new(gherkin)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## Modeling other versions of Cucumber
|
|
111
|
+
|
|
112
|
+
Although this gem is written in Ruby and requires it to run, the modeling
|
|
113
|
+
capabilities provided are for the feature file layer of a Cucumber test suite.
|
|
114
|
+
As such, any feature file that is written in Gherkin can be modeled, even if
|
|
115
|
+
that feature is ultimately run with SpecFlow (Cucumber for C#), Lettuce
|
|
116
|
+
(Cucumber for Python), or some other flavor of Cucumber.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### <a id="projects"></a>Other gems that are powered by **cuke_modeler**
|
|
120
|
+
|
|
121
|
+
* [cql](https://github.com/enkessler/cql) - A convenient DSL for querying modeled Gherkin documents
|
|
122
|
+
* [cuketagger](https://github.com/enkessler/cuketagger) - A tool for adding tags to feature files
|
|
123
|
+
* [cuke_cataloger](https://github.com/enkessler/cuke_cataloger) - Easily add uniques IDs to every test case in a suite
|
|
124
|
+
* [cuke_slicer](https://github.com/enkessler/cuke_slicer) - Break a test suite down into discrete test cases for easy parallel distribution
|
|
125
|
+
* [cuke_linter](https://github.com/enkessler/cuke_linter) - Identify common code smells in your Gherkin
|
|
126
|
+
* [turnip](https://github.com/jnicklas/turnip) – Write tests in Gherkin and run them through your RSpec environment
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## Development and Contributing
|
|
130
|
+
|
|
131
|
+
See [CONTRIBUTING.md](https://github.com/enkessler/cuke_modeler/blob/master/CONTRIBUTING.md)
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/cuke_modeler.gemspec
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
lib = File.expand_path('lib', __dir__)
|
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require 'cuke_modeler/version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = 'cuke_modeler'
|
|
7
|
-
spec.version = CukeModeler::VERSION
|
|
8
|
-
spec.authors = ['Eric Kessler']
|
|
9
|
-
spec.email = ['morrow748@gmail.com']
|
|
10
|
-
spec.summary = 'A gem providing functionality to model Gherkin based test suites.'
|
|
11
|
-
spec.description = ['This gem facilitates modeling a test suite that is written in Gherkin (e.g. Cucumber, ',
|
|
12
|
-
'SpecFlow, Lettuce, etc.). It does this by providing an abstraction layer on top of the ',
|
|
13
|
-
"Abstract Syntax Tree that the 'cucumber-gherkin' gem generates when parsing features, ",
|
|
14
|
-
'as well as providing models for feature files and directories in order to be able to ',
|
|
15
|
-
"have a fully traversable model tree of a test suite's structure. These models can then ",
|
|
16
|
-
'be analyzed or manipulated more easily than the underlying AST layer.'].join
|
|
17
|
-
spec.homepage = 'https://github.com/enkessler/cuke_modeler'
|
|
18
|
-
spec.license = 'MIT'
|
|
19
|
-
|
|
20
|
-
spec.metadata = {
|
|
21
|
-
'bug_tracker_uri' => 'https://github.com/enkessler/cuke_modeler/issues',
|
|
22
|
-
'changelog_uri' => 'https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md',
|
|
23
|
-
'documentation_uri' => 'https://www.rubydoc.info/gems/cuke_modeler',
|
|
24
|
-
'source_code_uri' => 'https://github.com/enkessler/cuke_modeler',
|
|
25
|
-
'rubygems_mfa_required' => 'true'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
# Specify which files should be added to the gem when it is released.
|
|
29
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
30
|
-
spec.files = Dir.chdir(File.expand_path('', __dir__)) do
|
|
31
|
-
source_controlled_files = `git ls-files -z`.split("\x0")
|
|
32
|
-
source_controlled_files.keep_if { |file| file =~ %r{^(lib|testing/cucumber/features)} }
|
|
33
|
-
source_controlled_files + ['README.md', 'LICENSE.txt', 'CHANGELOG.md', 'cuke_modeler.gemspec']
|
|
34
|
-
end
|
|
35
|
-
spec.require_paths = ['lib']
|
|
36
|
-
|
|
37
|
-
spec.required_ruby_version = '>= 2.3', '< 5.0'
|
|
38
|
-
|
|
39
|
-
spec.add_runtime_dependency 'cucumber-gherkin', '<
|
|
40
|
-
|
|
41
|
-
spec.add_development_dependency 'base64', '< 1.0' # Needed for Gherkin 27, Ruby 4.x only
|
|
42
|
-
spec.add_development_dependency 'bundler', '< 5.0'
|
|
43
|
-
spec.add_development_dependency 'childprocess', '< 6.0'
|
|
44
|
-
# Cucumber 4.x is the earliest version to use the 'cucumber-gherkin' gem but some test configurations need to use
|
|
45
|
-
# Cucumber 2.2.0 so that it uses the 'gherkin3' gem instead. Using any other Cucumber version <4.x aside from 2.2.0
|
|
46
|
-
# can cause namespace problems between 'cucumber-gherkin' and 'gherkin' (the gem used by <4.x versions of Cucumber).
|
|
47
|
-
spec.add_development_dependency 'cucumber', '>= 2.2.0', '< 11.0.0'
|
|
48
|
-
spec.add_development_dependency 'rainbow', '< 4.0.0'
|
|
49
|
-
spec.add_development_dependency 'rake', '< 14.0.0'
|
|
50
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
51
|
-
# Running recent RuboCop versions requires a recent version of Ruby but it can still lint against Ruby 2.3 styles.
|
|
52
|
-
# Can't set a lower bound because RuboCop will still get installed in the testing environments for earlier Rubies,
|
|
53
|
-
# even if it never actually gets run. Current "minimum" version is 1.44.0.
|
|
54
|
-
spec.add_development_dependency 'rubocop', '< 2.0'
|
|
55
|
-
spec.add_development_dependency 'simplecov', '< 1.0'
|
|
56
|
-
spec.add_development_dependency 'simplecov-lcov', '< 1.0'
|
|
57
|
-
spec.add_development_dependency 'test-unit', '< 4.0.0'
|
|
58
|
-
spec.add_development_dependency 'yard', '< 1.0'
|
|
59
|
-
end
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'cuke_modeler/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'cuke_modeler'
|
|
7
|
+
spec.version = CukeModeler::VERSION
|
|
8
|
+
spec.authors = ['Eric Kessler']
|
|
9
|
+
spec.email = ['morrow748@gmail.com']
|
|
10
|
+
spec.summary = 'A gem providing functionality to model Gherkin based test suites.'
|
|
11
|
+
spec.description = ['This gem facilitates modeling a test suite that is written in Gherkin (e.g. Cucumber, ',
|
|
12
|
+
'SpecFlow, Lettuce, etc.). It does this by providing an abstraction layer on top of the ',
|
|
13
|
+
"Abstract Syntax Tree that the 'cucumber-gherkin' gem generates when parsing features, ",
|
|
14
|
+
'as well as providing models for feature files and directories in order to be able to ',
|
|
15
|
+
"have a fully traversable model tree of a test suite's structure. These models can then ",
|
|
16
|
+
'be analyzed or manipulated more easily than the underlying AST layer.'].join
|
|
17
|
+
spec.homepage = 'https://github.com/enkessler/cuke_modeler'
|
|
18
|
+
spec.license = 'MIT'
|
|
19
|
+
|
|
20
|
+
spec.metadata = {
|
|
21
|
+
'bug_tracker_uri' => 'https://github.com/enkessler/cuke_modeler/issues',
|
|
22
|
+
'changelog_uri' => 'https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md',
|
|
23
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/cuke_modeler',
|
|
24
|
+
'source_code_uri' => 'https://github.com/enkessler/cuke_modeler',
|
|
25
|
+
'rubygems_mfa_required' => 'true'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
30
|
+
spec.files = Dir.chdir(File.expand_path('', __dir__)) do
|
|
31
|
+
source_controlled_files = `git ls-files -z`.split("\x0")
|
|
32
|
+
source_controlled_files.keep_if { |file| file =~ %r{^(lib|testing/cucumber/features)} }
|
|
33
|
+
source_controlled_files + ['README.md', 'LICENSE.txt', 'CHANGELOG.md', 'cuke_modeler.gemspec']
|
|
34
|
+
end
|
|
35
|
+
spec.require_paths = ['lib']
|
|
36
|
+
|
|
37
|
+
spec.required_ruby_version = '>= 2.3', '< 5.0'
|
|
38
|
+
|
|
39
|
+
spec.add_runtime_dependency 'cucumber-gherkin', '< 39.0'
|
|
40
|
+
|
|
41
|
+
spec.add_development_dependency 'base64', '< 1.0' # Needed for Gherkin 27, Ruby 4.x only
|
|
42
|
+
spec.add_development_dependency 'bundler', '< 5.0'
|
|
43
|
+
spec.add_development_dependency 'childprocess', '< 6.0'
|
|
44
|
+
# Cucumber 4.x is the earliest version to use the 'cucumber-gherkin' gem but some test configurations need to use
|
|
45
|
+
# Cucumber 2.2.0 so that it uses the 'gherkin3' gem instead. Using any other Cucumber version <4.x aside from 2.2.0
|
|
46
|
+
# can cause namespace problems between 'cucumber-gherkin' and 'gherkin' (the gem used by <4.x versions of Cucumber).
|
|
47
|
+
spec.add_development_dependency 'cucumber', '>= 2.2.0', '< 11.0.0'
|
|
48
|
+
spec.add_development_dependency 'rainbow', '< 4.0.0'
|
|
49
|
+
spec.add_development_dependency 'rake', '< 14.0.0'
|
|
50
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
51
|
+
# Running recent RuboCop versions requires a recent version of Ruby but it can still lint against Ruby 2.3 styles.
|
|
52
|
+
# Can't set a lower bound because RuboCop will still get installed in the testing environments for earlier Rubies,
|
|
53
|
+
# even if it never actually gets run. Current "minimum" version is 1.44.0.
|
|
54
|
+
spec.add_development_dependency 'rubocop', '< 2.0'
|
|
55
|
+
spec.add_development_dependency 'simplecov', '< 1.0'
|
|
56
|
+
spec.add_development_dependency 'simplecov-lcov', '< 1.0'
|
|
57
|
+
spec.add_development_dependency 'test-unit', '< 4.0.0'
|
|
58
|
+
spec.add_development_dependency 'yard', '< 1.0'
|
|
59
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative 'gherkin_9_adapter'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module CukeModeler
|
|
5
|
-
|
|
6
|
-
# @api private
|
|
7
|
-
#
|
|
8
|
-
# An adapter that can convert the output of version 10.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
-
# by this gem. Internal helper class.
|
|
10
|
-
class Gherkin10Adapter < Gherkin9Adapter; end
|
|
11
|
-
|
|
12
|
-
private_constant :Gherkin10Adapter
|
|
13
|
-
end
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module CukeModeler
|
|
5
|
+
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# An adapter that can convert the output of version 10.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
+
# by this gem. Internal helper class.
|
|
10
|
+
class Gherkin10Adapter < Gherkin9Adapter; end
|
|
11
|
+
|
|
12
|
+
private_constant :Gherkin10Adapter
|
|
13
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative 'gherkin_9_adapter'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module CukeModeler
|
|
5
|
-
|
|
6
|
-
# @api private
|
|
7
|
-
#
|
|
8
|
-
# An adapter that can convert the output of version 11.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
-
# by this gem. Internal helper class.
|
|
10
|
-
class Gherkin11Adapter < Gherkin9Adapter; end
|
|
11
|
-
|
|
12
|
-
private_constant :Gherkin11Adapter
|
|
13
|
-
end
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module CukeModeler
|
|
5
|
+
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# An adapter that can convert the output of version 11.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
+
# by this gem. Internal helper class.
|
|
10
|
+
class Gherkin11Adapter < Gherkin9Adapter; end
|
|
11
|
+
|
|
12
|
+
private_constant :Gherkin11Adapter
|
|
13
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative 'gherkin_9_adapter'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module CukeModeler
|
|
5
|
-
|
|
6
|
-
# @api private
|
|
7
|
-
#
|
|
8
|
-
# An adapter that can convert the output of version 12.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
-
# by this gem. Internal helper class.
|
|
10
|
-
class Gherkin12Adapter < Gherkin9Adapter; end
|
|
11
|
-
|
|
12
|
-
private_constant :Gherkin12Adapter
|
|
13
|
-
end
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module CukeModeler
|
|
5
|
+
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# An adapter that can convert the output of version 12.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
+
# by this gem. Internal helper class.
|
|
10
|
+
class Gherkin12Adapter < Gherkin9Adapter; end
|
|
11
|
+
|
|
12
|
+
private_constant :Gherkin12Adapter
|
|
13
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative 'gherkin_9_adapter'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module CukeModeler
|
|
5
|
-
|
|
6
|
-
# @api private
|
|
7
|
-
#
|
|
8
|
-
# An adapter that can convert the output of version 13.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
-
# by this gem. Internal helper class.
|
|
10
|
-
class Gherkin13Adapter < Gherkin9Adapter; end
|
|
11
|
-
|
|
12
|
-
private_constant :Gherkin13Adapter
|
|
13
|
-
end
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module CukeModeler
|
|
5
|
+
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# An adapter that can convert the output of version 13.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
+
# by this gem. Internal helper class.
|
|
10
|
+
class Gherkin13Adapter < Gherkin9Adapter; end
|
|
11
|
+
|
|
12
|
+
private_constant :Gherkin13Adapter
|
|
13
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative 'gherkin_9_adapter'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module CukeModeler
|
|
5
|
-
|
|
6
|
-
# @api private
|
|
7
|
-
#
|
|
8
|
-
# An adapter that can convert the output of version 14.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
-
# by this gem. Internal helper class.
|
|
10
|
-
class Gherkin14Adapter < Gherkin9Adapter; end
|
|
11
|
-
|
|
12
|
-
private_constant :Gherkin14Adapter
|
|
13
|
-
end
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module CukeModeler
|
|
5
|
+
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# An adapter that can convert the output of version 14.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
+
# by this gem. Internal helper class.
|
|
10
|
+
class Gherkin14Adapter < Gherkin9Adapter; end
|
|
11
|
+
|
|
12
|
+
private_constant :Gherkin14Adapter
|
|
13
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative 'gherkin_9_adapter'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module CukeModeler
|
|
5
|
-
|
|
6
|
-
# @api private
|
|
7
|
-
#
|
|
8
|
-
# An adapter that can convert the output of version 15.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
-
# by this gem. Internal helper class.
|
|
10
|
-
class Gherkin15Adapter < Gherkin9Adapter; end
|
|
11
|
-
|
|
12
|
-
private_constant :Gherkin15Adapter
|
|
13
|
-
end
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module CukeModeler
|
|
5
|
+
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# An adapter that can convert the output of version 15.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
+
# by this gem. Internal helper class.
|
|
10
|
+
class Gherkin15Adapter < Gherkin9Adapter; end
|
|
11
|
+
|
|
12
|
+
private_constant :Gherkin15Adapter
|
|
13
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative 'gherkin_9_adapter'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module CukeModeler
|
|
5
|
-
|
|
6
|
-
# @api private
|
|
7
|
-
#
|
|
8
|
-
# An adapter that can convert the output of version 16.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
-
# by this gem. Internal helper class.
|
|
10
|
-
class Gherkin16Adapter < Gherkin9Adapter; end
|
|
11
|
-
|
|
12
|
-
private_constant :Gherkin16Adapter
|
|
13
|
-
end
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module CukeModeler
|
|
5
|
+
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# An adapter that can convert the output of version 16.x of the *cucumber-gherkin* gem into input that is consumable
|
|
9
|
+
# by this gem. Internal helper class.
|
|
10
|
+
class Gherkin16Adapter < Gherkin9Adapter; end
|
|
11
|
+
|
|
12
|
+
private_constant :Gherkin16Adapter
|
|
13
|
+
end
|