cuke_modeler 0.2.0 → 0.3.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 +7 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -1
- data/History.rdoc +9 -2
- data/Rakefile +10 -1
- data/cuke_modeler.gemspec +1 -1
- data/features/modeling/gherkin4/background_modeling.feature +64 -0
- data/features/modeling/gherkin4/background_output.feature +131 -0
- data/features/modeling/gherkin4/directory_modeling.feature +110 -0
- data/features/modeling/gherkin4/directory_output.feature +14 -0
- data/features/modeling/gherkin4/doc_string_modeling.feature +53 -0
- data/features/modeling/gherkin4/doc_string_output.feature +72 -0
- data/features/modeling/gherkin4/example_modeling.feature +100 -0
- data/features/modeling/gherkin4/example_output.feature +193 -0
- data/features/modeling/gherkin4/feature_file_modeling.feature +54 -0
- data/features/modeling/gherkin4/feature_file_output.feature +14 -0
- data/features/modeling/gherkin4/feature_modeling.feature +153 -0
- data/features/modeling/gherkin4/feature_output.feature +245 -0
- data/features/modeling/gherkin4/outline_modeling.feature +89 -0
- data/features/modeling/gherkin4/outline_output.feature +198 -0
- data/features/modeling/gherkin4/row_modeling.feature +68 -0
- data/features/modeling/gherkin4/row_output.feature +28 -0
- data/features/modeling/gherkin4/scenario_modeling.feature +78 -0
- data/features/modeling/gherkin4/scenario_output.feature +148 -0
- data/features/modeling/gherkin4/step_modeling.feature +75 -0
- data/features/modeling/gherkin4/step_output.feature +53 -0
- data/features/modeling/gherkin4/table_modeling.feature +42 -0
- data/features/modeling/gherkin4/table_output.feature +43 -0
- data/features/modeling/gherkin4/table_row_modeling.feature +57 -0
- data/features/modeling/gherkin4/table_row_output.feature +28 -0
- data/features/modeling/gherkin4/tag_modeling.feature +48 -0
- data/features/modeling/gherkin4/tag_output.feature +17 -0
- data/features/step_definitions/background_steps.rb +1 -1
- data/features/step_definitions/doc_string_steps.rb +1 -1
- data/features/step_definitions/feature_steps.rb +7 -4
- data/features/step_definitions/outline_steps.rb +2 -2
- data/features/step_definitions/step_steps.rb +2 -2
- data/features/step_definitions/table_steps.rb +1 -1
- data/features/step_definitions/tag_steps.rb +3 -3
- data/features/step_definitions/test_steps.rb +1 -1
- data/gemfiles/gherkin.gemfile +1 -0
- data/gemfiles/gherkin3.gemfile +2 -1
- data/gemfiles/gherkin4.gemfile +16 -0
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +220 -0
- data/lib/cuke_modeler/example.rb +1 -1
- data/lib/cuke_modeler/parsing.rb +73 -44
- data/lib/cuke_modeler/version.rb +1 -1
- data/spec/spec_helper.rb +10 -4
- data/spec/unit/background_unit_spec.rb +17 -9
- data/spec/unit/bare_bones_unit_specs.rb +3 -1
- data/spec/unit/containing_element_unit_specs.rb +3 -1
- data/spec/unit/directory_unit_spec.rb +5 -5
- data/spec/unit/doc_string_unit_spec.rb +13 -5
- data/spec/unit/example_unit_spec.rb +44 -9
- data/spec/unit/feature_element_unit_spec.rb +5 -5
- data/spec/unit/feature_element_unit_specs.rb +3 -1
- data/spec/unit/feature_file_unit_spec.rb +5 -5
- data/spec/unit/feature_unit_spec.rb +17 -9
- data/spec/unit/nested_element_unit_specs.rb +3 -1
- data/spec/unit/outline_unit_spec.rb +18 -10
- data/spec/unit/parsing_unit_spec.rb +2 -2
- data/spec/unit/prepopulated_unit_specs.rb +3 -1
- data/spec/unit/raw_element_unit_specs.rb +3 -1
- data/spec/unit/row_unit_spec.rb +15 -8
- data/spec/unit/scenario_unit_spec.rb +19 -11
- data/spec/unit/sourced_element_unit_specs.rb +3 -1
- data/spec/unit/step_unit_spec.rb +14 -6
- data/spec/unit/table_row_unit_spec.rb +15 -8
- data/spec/unit/table_unit_spec.rb +13 -5
- data/spec/unit/tag_unit_spec.rb +14 -6
- data/spec/unit/tagged_element_unit_specs.rb +3 -1
- data/spec/unit/test_element_unit_spec.rb +6 -6
- data/spec/unit/test_element_unit_specs.rb +3 -1
- metadata +86 -55
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@gherkin4
|
|
2
|
+
Feature: Row elements can be modeled.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Acceptance criteria
|
|
6
|
+
|
|
7
|
+
1. All conceptual pieces of a Row can be modeled:
|
|
8
|
+
- the row's source line
|
|
9
|
+
- the row's cells
|
|
10
|
+
- the row's raw element
|
|
11
|
+
|
|
12
|
+
2. Rows can be outputted in a convenient form
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Background: Test file setup.
|
|
16
|
+
Given the following feature file:
|
|
17
|
+
"""
|
|
18
|
+
Feature:
|
|
19
|
+
|
|
20
|
+
Scenario Outline:
|
|
21
|
+
* a step
|
|
22
|
+
Examples:
|
|
23
|
+
| param1 | param2 | extra param |
|
|
24
|
+
| x | y | ? |
|
|
25
|
+
| 1 | 2 | 3 |
|
|
26
|
+
Examples:
|
|
27
|
+
| param1 |
|
|
28
|
+
| a |
|
|
29
|
+
"""
|
|
30
|
+
And parameter delimiters of "*" and "*"
|
|
31
|
+
When the file is read
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Scenario: The raw row element is modeled.
|
|
35
|
+
Then the test example block row correctly stores its underlying implementation
|
|
36
|
+
|
|
37
|
+
Scenario: The row's source line is modeled.
|
|
38
|
+
Then the test example block "1" row "1" is found to have the following properties:
|
|
39
|
+
| source_line | 6 |
|
|
40
|
+
And the test example block "1" row "2" is found to have the following properties:
|
|
41
|
+
| source_line | 7 |
|
|
42
|
+
And the test example block "1" row "3" is found to have the following properties:
|
|
43
|
+
| source_line | 8 |
|
|
44
|
+
And the test example block "2" row "1" is found to have the following properties:
|
|
45
|
+
| source_line | 10 |
|
|
46
|
+
And the test example block "2" row "2" is found to have the following properties:
|
|
47
|
+
| source_line | 11 |
|
|
48
|
+
|
|
49
|
+
Scenario: The row's cells are modeled.
|
|
50
|
+
Then the test example block "1" row "1" cells are as follows:
|
|
51
|
+
| param1 |
|
|
52
|
+
| param2 |
|
|
53
|
+
| extra param |
|
|
54
|
+
And the test example block "1" row "2" cells are as follows:
|
|
55
|
+
| x |
|
|
56
|
+
| y |
|
|
57
|
+
| ? |
|
|
58
|
+
And the test example block "1" row "3" cells are as follows:
|
|
59
|
+
| 1 |
|
|
60
|
+
| 2 |
|
|
61
|
+
| 3 |
|
|
62
|
+
And the test example block "2" row "1" cells are as follows:
|
|
63
|
+
| param1 |
|
|
64
|
+
And the test example block "2" row "2" cells are as follows:
|
|
65
|
+
| a |
|
|
66
|
+
|
|
67
|
+
Scenario: Convenient output of a row
|
|
68
|
+
Then the row has convenient output
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@gherkin4
|
|
2
|
+
Feature: Outputting row elements
|
|
3
|
+
|
|
4
|
+
The output of an element model is a representation of the element as it would
|
|
5
|
+
appear in gherkin.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Output of a row that has one cell
|
|
9
|
+
Given a row element based on the following gherkin:
|
|
10
|
+
"""
|
|
11
|
+
|value|
|
|
12
|
+
"""
|
|
13
|
+
When it is outputted
|
|
14
|
+
Then the following text is provided:
|
|
15
|
+
"""
|
|
16
|
+
| value |
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
Scenario: Output of a row that has multiple cells
|
|
20
|
+
Given a row element based on the following gherkin:
|
|
21
|
+
"""
|
|
22
|
+
|value|another_value|
|
|
23
|
+
"""
|
|
24
|
+
When it is outputted
|
|
25
|
+
Then the following text is provided:
|
|
26
|
+
"""
|
|
27
|
+
| value | another_value |
|
|
28
|
+
"""
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
@gherkin4
|
|
2
|
+
Feature: Scenario elements can be modeled.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Acceptance criteria
|
|
6
|
+
|
|
7
|
+
1. All conceptual pieces of a scenario can be modeled:
|
|
8
|
+
- the scenario's name
|
|
9
|
+
- the scenario's description
|
|
10
|
+
- the scenario's steps
|
|
11
|
+
- the scenario's tags
|
|
12
|
+
- the scenario's applied tags
|
|
13
|
+
- the scenario's source line
|
|
14
|
+
- the scenario's raw element
|
|
15
|
+
|
|
16
|
+
2. Scenarios can be outputted in a convenient form
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Background: Test file setup.
|
|
20
|
+
Given the following feature file:
|
|
21
|
+
"""
|
|
22
|
+
@a_feature_level_tag
|
|
23
|
+
Feature:
|
|
24
|
+
|
|
25
|
+
@a_tag
|
|
26
|
+
@another_tag
|
|
27
|
+
Scenario:The first scenario's name.
|
|
28
|
+
|
|
29
|
+
Some scenario description.
|
|
30
|
+
|
|
31
|
+
Some more.
|
|
32
|
+
Even more.
|
|
33
|
+
|
|
34
|
+
Given a setup step
|
|
35
|
+
When an action step
|
|
36
|
+
Then a verification step
|
|
37
|
+
"""
|
|
38
|
+
And parameter delimiters of "*" and "*"
|
|
39
|
+
When the file is read
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Scenario: The raw scenario element is modeled.
|
|
43
|
+
Then the test correctly stores its underlying implementation
|
|
44
|
+
|
|
45
|
+
Scenario: The scenario source line is modeled.
|
|
46
|
+
Then the test is found to have the following properties:
|
|
47
|
+
| source_line | 6 |
|
|
48
|
+
|
|
49
|
+
Scenario: The scenario name is modeled.
|
|
50
|
+
Then the test is found to have the following properties:
|
|
51
|
+
| name | The first scenario's name. |
|
|
52
|
+
|
|
53
|
+
Scenario: The scenario description is modeled.
|
|
54
|
+
Then the test has the following description:
|
|
55
|
+
"""
|
|
56
|
+
Some scenario description.
|
|
57
|
+
|
|
58
|
+
Some more.
|
|
59
|
+
Even more.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
Scenario: The scenario steps are modeled.
|
|
63
|
+
Then the test steps are as follows:
|
|
64
|
+
| a setup step |
|
|
65
|
+
| an action step |
|
|
66
|
+
| a verification step |
|
|
67
|
+
|
|
68
|
+
Scenario: The scenario tags are modeled.
|
|
69
|
+
Then the test is found to have the following tags:
|
|
70
|
+
| @a_tag |
|
|
71
|
+
| @another_tag |
|
|
72
|
+
|
|
73
|
+
Scenario: The scenario applied tags are modeled.
|
|
74
|
+
Then the test is found to have the following applied tags:
|
|
75
|
+
| @a_feature_level_tag |
|
|
76
|
+
|
|
77
|
+
Scenario: Convenient output of a scenario
|
|
78
|
+
Then the scenario has convenient output
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
@gherkin4
|
|
2
|
+
Feature: Outputting scenario elements
|
|
3
|
+
|
|
4
|
+
The output of an element model is a representation of the element as it would
|
|
5
|
+
appear in gherkin.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Output of a scenario that does not have a name
|
|
9
|
+
Given a scenario element based on the following gherkin:
|
|
10
|
+
"""
|
|
11
|
+
Scenario:
|
|
12
|
+
"""
|
|
13
|
+
When it is outputted
|
|
14
|
+
Then the following text is provided:
|
|
15
|
+
"""
|
|
16
|
+
Scenario:
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
Scenario: Output of a scenario that does have a name
|
|
20
|
+
Given a scenario element based on the following gherkin:
|
|
21
|
+
"""
|
|
22
|
+
Scenario: with a name
|
|
23
|
+
"""
|
|
24
|
+
When it is outputted
|
|
25
|
+
Then the following text is provided:
|
|
26
|
+
"""
|
|
27
|
+
Scenario: with a name
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
Scenario: Output of a scenario that has tags
|
|
31
|
+
Given a scenario element based on the following gherkin:
|
|
32
|
+
"""
|
|
33
|
+
@tag1@tag2
|
|
34
|
+
@tag3
|
|
35
|
+
Scenario:
|
|
36
|
+
"""
|
|
37
|
+
When it is outputted
|
|
38
|
+
Then the following text is provided:
|
|
39
|
+
"""
|
|
40
|
+
@tag1 @tag2 @tag3
|
|
41
|
+
Scenario:
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
Scenario: Output of a scenario that has a description, no first line buffer
|
|
45
|
+
Given a scenario element based on the following gherkin:
|
|
46
|
+
"""
|
|
47
|
+
Scenario:
|
|
48
|
+
Some description.
|
|
49
|
+
Some more description.
|
|
50
|
+
"""
|
|
51
|
+
When it is outputted
|
|
52
|
+
Then the following text is provided:
|
|
53
|
+
"""
|
|
54
|
+
Scenario:
|
|
55
|
+
|
|
56
|
+
Some description.
|
|
57
|
+
Some more description.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
Scenario: Output of a scenario that has a description, first line is blank
|
|
61
|
+
Given a scenario element based on the following gherkin:
|
|
62
|
+
"""
|
|
63
|
+
Scenario:
|
|
64
|
+
|
|
65
|
+
Some description.
|
|
66
|
+
Some more description.
|
|
67
|
+
"""
|
|
68
|
+
When it is outputted
|
|
69
|
+
Then the following text is provided:
|
|
70
|
+
"""
|
|
71
|
+
Scenario:
|
|
72
|
+
|
|
73
|
+
Some description.
|
|
74
|
+
Some more description.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
Scenario: Output of a scenario that has a description, first line is only whitespace
|
|
78
|
+
Given a scenario element based on the following gherkin:
|
|
79
|
+
"""
|
|
80
|
+
Scenario:
|
|
81
|
+
|
|
82
|
+
Some description.
|
|
83
|
+
Some more description.
|
|
84
|
+
"""
|
|
85
|
+
When it is outputted
|
|
86
|
+
Then the following text is provided:
|
|
87
|
+
"""
|
|
88
|
+
Scenario:
|
|
89
|
+
|
|
90
|
+
Some description.
|
|
91
|
+
Some more description.
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
Scenario: Output of a scenario that has steps
|
|
95
|
+
Given a scenario element based on the following gherkin:
|
|
96
|
+
"""
|
|
97
|
+
Scenario:
|
|
98
|
+
* a step
|
|
99
|
+
|value|
|
|
100
|
+
* another step
|
|
101
|
+
\"\"\"
|
|
102
|
+
some string
|
|
103
|
+
\"\"\"
|
|
104
|
+
"""
|
|
105
|
+
When it is outputted
|
|
106
|
+
Then the following text is provided:
|
|
107
|
+
"""
|
|
108
|
+
Scenario:
|
|
109
|
+
* a step
|
|
110
|
+
| value |
|
|
111
|
+
* another step
|
|
112
|
+
\"\"\"
|
|
113
|
+
some string
|
|
114
|
+
\"\"\"
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
Scenario: Output of a scenario that contains all possible parts
|
|
118
|
+
Given a scenario element based on the following gherkin:
|
|
119
|
+
"""
|
|
120
|
+
@tag1@tag2
|
|
121
|
+
@tag3
|
|
122
|
+
Scenario: A scenario with everything it could have
|
|
123
|
+
Including a description
|
|
124
|
+
and then some.
|
|
125
|
+
|
|
126
|
+
* a step
|
|
127
|
+
|value|
|
|
128
|
+
* another step
|
|
129
|
+
\"\"\"
|
|
130
|
+
some string
|
|
131
|
+
\"\"\"
|
|
132
|
+
"""
|
|
133
|
+
When it is outputted
|
|
134
|
+
Then the following text is provided:
|
|
135
|
+
"""
|
|
136
|
+
@tag1 @tag2 @tag3
|
|
137
|
+
Scenario: A scenario with everything it could have
|
|
138
|
+
|
|
139
|
+
Including a description
|
|
140
|
+
and then some.
|
|
141
|
+
|
|
142
|
+
* a step
|
|
143
|
+
| value |
|
|
144
|
+
* another step
|
|
145
|
+
\"\"\"
|
|
146
|
+
some string
|
|
147
|
+
\"\"\"
|
|
148
|
+
"""
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@gherkin4
|
|
2
|
+
Feature: Step elements can be modeled.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Acceptance criteria
|
|
6
|
+
|
|
7
|
+
1. All conceptual pieces of a step can be modeled:
|
|
8
|
+
- the step's keyword
|
|
9
|
+
- the text of the step
|
|
10
|
+
- the step's arguments, if any
|
|
11
|
+
- the step's associated block, if any
|
|
12
|
+
- the step's source line
|
|
13
|
+
- the step's raw element
|
|
14
|
+
|
|
15
|
+
2. Steps can be outputted in a convenient form
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Background: Test file setup.
|
|
19
|
+
Given the following feature file:
|
|
20
|
+
"""
|
|
21
|
+
Feature:
|
|
22
|
+
|
|
23
|
+
Scenario:
|
|
24
|
+
Given some setup step
|
|
25
|
+
And some big setup step:
|
|
26
|
+
\"\"\" content_type
|
|
27
|
+
some text
|
|
28
|
+
some more text
|
|
29
|
+
\"\"\"
|
|
30
|
+
When this *parameterized* step takes a table:
|
|
31
|
+
| data | a header |
|
|
32
|
+
| more data | a value |
|
|
33
|
+
Then a step with a *parameter*
|
|
34
|
+
"""
|
|
35
|
+
And parameter delimiters of "*" and "*"
|
|
36
|
+
When the file is read
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Scenario: The raw step element is modeled.
|
|
40
|
+
Then the test step correctly stores its underlying implementation
|
|
41
|
+
|
|
42
|
+
Scenario: The step's source line is modeled.
|
|
43
|
+
Then the test step "1" source line is "4"
|
|
44
|
+
And the test step "2" source line is "5"
|
|
45
|
+
And the test step "3" source line is "10"
|
|
46
|
+
And the test step "4" source line is "13"
|
|
47
|
+
|
|
48
|
+
Scenario: The step's keyword is modeled.
|
|
49
|
+
Then the test step "1" keyword is "Given"
|
|
50
|
+
And the test step "2" keyword is "And"
|
|
51
|
+
And the test step "3" keyword is "When"
|
|
52
|
+
And the test step "4" keyword is "Then"
|
|
53
|
+
|
|
54
|
+
Scenario: The text of the step is modeled.
|
|
55
|
+
Then test step "1" text is "some setup step"
|
|
56
|
+
And test step "2" text is "some big setup step:"
|
|
57
|
+
And test step "3" text is "this *parameterized* step takes a table:"
|
|
58
|
+
And test step "4" text is "a step with a *parameter*"
|
|
59
|
+
|
|
60
|
+
Scenario: The step's arguments are modeled.
|
|
61
|
+
Then test step "1" has no arguments
|
|
62
|
+
And test step "2" has no arguments
|
|
63
|
+
And test step "3" arguments are:
|
|
64
|
+
| parameterized |
|
|
65
|
+
And test step "4" arguments are:
|
|
66
|
+
| parameter |
|
|
67
|
+
|
|
68
|
+
Scenario: The steps's block is modeled.
|
|
69
|
+
Then step "1" has no block
|
|
70
|
+
Then step "2" has a "doc string"
|
|
71
|
+
And step "3" has a "table"
|
|
72
|
+
And step "4" has no block
|
|
73
|
+
|
|
74
|
+
Scenario: Convenient output of a step
|
|
75
|
+
Then the step has convenient output
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@gherkin4
|
|
2
|
+
Feature: Outputting step elements
|
|
3
|
+
|
|
4
|
+
The output of an element model is a representation of the element as it would
|
|
5
|
+
appear in gherkin.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Output of a step without a block
|
|
9
|
+
Given a step element based on the following gherkin:
|
|
10
|
+
"""
|
|
11
|
+
* a step
|
|
12
|
+
"""
|
|
13
|
+
When it is outputted
|
|
14
|
+
Then the following text is provided:
|
|
15
|
+
"""
|
|
16
|
+
* a step
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
Scenario: Output of a step with a doc string
|
|
20
|
+
Given a step element based on the following gherkin:
|
|
21
|
+
"""
|
|
22
|
+
* a step
|
|
23
|
+
\"\"\"
|
|
24
|
+
Some text
|
|
25
|
+
|
|
26
|
+
some more text
|
|
27
|
+
\"\"\"
|
|
28
|
+
"""
|
|
29
|
+
When it is outputted
|
|
30
|
+
Then the following text is provided:
|
|
31
|
+
"""
|
|
32
|
+
* a step
|
|
33
|
+
\"\"\"
|
|
34
|
+
Some text
|
|
35
|
+
|
|
36
|
+
some more text
|
|
37
|
+
\"\"\"
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
Scenario: Output of a step with a table
|
|
41
|
+
Given a step element based on the following gherkin:
|
|
42
|
+
"""
|
|
43
|
+
* a step
|
|
44
|
+
|value1|
|
|
45
|
+
|value2|
|
|
46
|
+
"""
|
|
47
|
+
When it is outputted
|
|
48
|
+
Then the following text is provided:
|
|
49
|
+
"""
|
|
50
|
+
* a step
|
|
51
|
+
| value1 |
|
|
52
|
+
| value2 |
|
|
53
|
+
"""
|