cucumber_analytics 0.0.1 → 0.0.2
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.
- data/features/modeling/background_modeling.feature +17 -5
- data/features/modeling/feature_modeling.feature +30 -2
- data/features/modeling/outline_modeling.feature +24 -10
- data/features/modeling/scenario_modeling.feature +17 -5
- data/lib/cucumber_analytics/feature_element.rb +0 -10
- data/lib/cucumber_analytics/outline_example.rb +9 -0
- data/lib/cucumber_analytics/parsed_background.rb +9 -0
- data/lib/cucumber_analytics/parsed_feature.rb +9 -0
- data/lib/cucumber_analytics/parsed_file.rb +33 -4
- data/lib/cucumber_analytics/parsed_scenario.rb +9 -0
- data/lib/cucumber_analytics/parsed_scenario_outline.rb +9 -0
- data/lib/cucumber_analytics/version.rb +1 -1
- metadata +2 -2
@@ -15,11 +15,17 @@ Feature: Background elements can be modeled.
|
|
15
15
|
Some more feature description.
|
16
16
|
|
17
17
|
Background: Some general test setup stuff.
|
18
|
-
|
19
|
-
|
20
|
-
A little more information.
|
21
|
-
|
18
|
+
My big hunk of perfectly valid description:
|
19
|
+
|
|
22
20
|
|
21
|
+
Scenario Outline
|
22
|
+
Examples
|
23
|
+
\"\"\"
|
24
|
+
Background
|
25
|
+
this is still one big valid description
|
26
|
+
# Basically, if it's not a step keyword or tag then I will accept
|
27
|
+
# it as description here. Cucumber might not but but that's between
|
28
|
+
# you and its lexxer/parser. ;)
|
23
29
|
* this *parameterized* step takes a table:
|
24
30
|
| data |
|
25
31
|
| more data |
|
@@ -62,7 +68,13 @@ Feature: Background elements can be modeled.
|
|
62
68
|
|
63
69
|
Scenario: The background description is modeled.
|
64
70
|
Then the background's descriptive lines are as follows:
|
65
|
-
|
|
71
|
+
| My big hunk of perfectly valid description: |
|
72
|
+
| \| |
|
73
|
+
| Scenario Outline |
|
74
|
+
| Examples |
|
75
|
+
| """ |
|
76
|
+
| Background |
|
77
|
+
| this is still one big valid description |
|
66
78
|
|
67
79
|
Scenario: The background steps are modeled.
|
68
80
|
Then the background's steps are as follows:
|
@@ -26,6 +26,23 @@ Feature: Features can be modeled.
|
|
26
26
|
|
27
27
|
And some more.
|
28
28
|
|
29
|
+
Scenario but not really because I left out the magic ':'
|
30
|
+
Given some description that uses keywords
|
31
|
+
And more of it
|
32
|
+
When I chuck the kitchen sink at it:
|
33
|
+
*
|
34
|
+
|
|
35
|
+
|
36
|
+
Scenario Outline
|
37
|
+
Examples
|
38
|
+
\"\"\"
|
39
|
+
Background
|
40
|
+
Then this is still one big valid description
|
41
|
+
# Oddly enough, if this comment had come earlier in the description
|
42
|
+
# it would have broken Cucumber. Comments can't be mixed into the
|
43
|
+
# freeform text for some reason.
|
44
|
+
|
45
|
+
|
29
46
|
Background: Some general test setup stuff.
|
30
47
|
A little more information.
|
31
48
|
* some setup step
|
@@ -109,8 +126,19 @@ Feature: Features can be modeled.
|
|
109
126
|
|
110
127
|
Scenario: The feature's description is modeled.
|
111
128
|
Then the descriptive lines of feature "1" are as follows:
|
112
|
-
| Some more feature description.
|
113
|
-
| And some more.
|
129
|
+
| Some more feature description. |
|
130
|
+
| And some more. |
|
131
|
+
| Scenario but not really because I left out the magic ':' |
|
132
|
+
| Given some description that uses keywords |
|
133
|
+
| And more of it |
|
134
|
+
| When I chuck the kitchen sink at it: |
|
135
|
+
| * |
|
136
|
+
| \| |
|
137
|
+
| Scenario Outline |
|
138
|
+
| Examples |
|
139
|
+
| """ |
|
140
|
+
| Background |
|
141
|
+
| Then this is still one big valid description |
|
114
142
|
And feature "2" has no descriptive lines
|
115
143
|
And feature "3" has no descriptive lines
|
116
144
|
|
@@ -20,8 +20,18 @@ Feature: Scenario Outline elements can be modeled.
|
|
20
20
|
|
21
21
|
@outline_tag
|
22
22
|
Scenario Outline: The scenario outline's name.
|
23
|
-
|
24
|
-
|
23
|
+
My big hunk of perfectly valid description:
|
24
|
+
|
|
25
|
+
|
26
|
+
Scenario Outline
|
27
|
+
Examples
|
28
|
+
\"\"\"
|
29
|
+
Background
|
30
|
+
this is still one big valid description
|
31
|
+
# Basically, if it's not a step keyword or tag then I will accept
|
32
|
+
# it as description here. Cucumber might not but but that's between
|
33
|
+
# you and its lexxer/parser. ;)
|
34
|
+
|
25
35
|
Given this *parameterized* step takes a table:
|
26
36
|
| <param1> |
|
27
37
|
| <param2> |
|
@@ -49,9 +59,8 @@ Feature: Scenario Outline elements can be modeled.
|
|
49
59
|
Then *lots* *of* *parameters*
|
50
60
|
|
51
61
|
Examples: text describing the significance of the examples
|
52
|
-
|
53
|
-
|
54
|
-
And even more description if you really need it.
|
62
|
+
Anything besides the | that starts a row should be valid
|
63
|
+
description at this point in the test. YMMV
|
55
64
|
| param1 | param2 |
|
56
65
|
#A more random comment
|
57
66
|
| x | y |
|
@@ -80,8 +89,13 @@ Feature: Scenario Outline elements can be modeled.
|
|
80
89
|
|
81
90
|
Scenario: The outline description is modeled.
|
82
91
|
Then the test descriptive lines are as follows:
|
83
|
-
|
|
84
|
-
|
|
92
|
+
| My big hunk of perfectly valid description: |
|
93
|
+
| \| |
|
94
|
+
| Scenario Outline |
|
95
|
+
| Examples |
|
96
|
+
| """ |
|
97
|
+
| Background |
|
98
|
+
| this is still one big valid description |
|
85
99
|
|
86
100
|
Scenario: The outline steps are modeled.
|
87
101
|
Then the test steps are as follows:
|
@@ -181,6 +195,6 @@ Feature: Scenario Outline elements can be modeled.
|
|
181
195
|
| <row1> |
|
182
196
|
| <row2> |
|
183
197
|
Examples:
|
184
|
-
| outline | set | name | description1
|
185
|
-
| 1 | 1 | text describing the significance of the examples |
|
186
|
-
| 1 | 2 | some examples with different significance and a tag | Words, words, words, words,
|
198
|
+
| outline | set | name | description1 | description2 | tag1 | tag2 | row1 | row2 |
|
199
|
+
| 1 | 1 | text describing the significance of the examples | Anything besides the \| that starts a row should be valid | description at this point in the test. YMMV | | | \| param1 \| param2 \| | \| x \| y \| |
|
200
|
+
| 1 | 2 | some examples with different significance and a tag | Words, words, words, words, | why so many words? | @example_tag | @another_one | \| param1 \| param2 \| | \| a \| b \| |
|
@@ -21,10 +21,17 @@ Feature: Scenario elements can be modeled.
|
|
21
21
|
|
22
22
|
@another_tag@yet_another_tag
|
23
23
|
Scenario: The first scenario's name.
|
24
|
-
|
24
|
+
My big hunk of perfectly valid description:
|
25
|
+
|
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
Scenario Outline
|
28
|
+
Examples
|
29
|
+
\"\"\"
|
30
|
+
Background
|
31
|
+
this is still one big valid description
|
32
|
+
# Basically, if it's not a step keyword or tag then I will accept
|
33
|
+
# it as description here. Cucumber might not but but that's between
|
34
|
+
# you and its lexxer/parser. ;)
|
28
35
|
Given this *parameterized* step takes a table:
|
29
36
|
| data |
|
30
37
|
| more data |
|
@@ -62,8 +69,13 @@ Feature: Scenario elements can be modeled.
|
|
62
69
|
|
63
70
|
Scenario: The scenario description is modeled.
|
64
71
|
Then the test descriptive lines are as follows:
|
65
|
-
|
|
66
|
-
|
|
72
|
+
| My big hunk of perfectly valid description: |
|
73
|
+
| \| |
|
74
|
+
| Scenario Outline |
|
75
|
+
| Examples |
|
76
|
+
| """ |
|
77
|
+
| Background |
|
78
|
+
| this is still one big valid description |
|
67
79
|
|
68
80
|
Scenario: The scenario steps are modeled.
|
69
81
|
Then the test steps are as follows:
|
@@ -40,15 +40,5 @@ module CucumberAnalytics
|
|
40
40
|
source_lines.shift
|
41
41
|
end
|
42
42
|
|
43
|
-
def parse_feature_element_description(source_lines)
|
44
|
-
until source_lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:\* ))/ or
|
45
|
-
source_lines.first =~ /^\s*\|/ or
|
46
|
-
source_lines.empty?
|
47
|
-
|
48
|
-
@description << source_lines.first.strip
|
49
|
-
source_lines.shift
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
43
|
end
|
54
44
|
end
|
@@ -27,5 +27,14 @@ module CucumberAnalytics
|
|
27
27
|
rows.concat source_lines.collect { |line| line.strip }
|
28
28
|
end
|
29
29
|
|
30
|
+
def parse_feature_element_description(source_lines)
|
31
|
+
until source_lines.first =~ /^\s*\|/ or
|
32
|
+
source_lines.empty?
|
33
|
+
|
34
|
+
@description << source_lines.first.strip
|
35
|
+
source_lines.shift
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
30
39
|
end
|
31
40
|
end
|
@@ -19,5 +19,14 @@ module CucumberAnalytics
|
|
19
19
|
parse_test_element_steps(source_lines)
|
20
20
|
end
|
21
21
|
|
22
|
+
def parse_feature_element_description(source_lines)
|
23
|
+
until source_lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:And )|(?:\* ))/ or
|
24
|
+
source_lines.empty?
|
25
|
+
|
26
|
+
@description << source_lines.first.strip
|
27
|
+
source_lines.shift
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
end
|
23
32
|
end
|
@@ -66,5 +66,14 @@ module CucumberAnalytics
|
|
66
66
|
parse_feature_element(source_lines)
|
67
67
|
end
|
68
68
|
|
69
|
+
def parse_feature_element_description(source_lines)
|
70
|
+
until source_lines.first =~ /^\s*(?:(?:Scenario: )|(?:Scenario Outline: )|(?:Background: )|(?:@ ))/ or
|
71
|
+
source_lines.empty?
|
72
|
+
|
73
|
+
@description << source_lines.first.strip
|
74
|
+
source_lines.shift
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
69
78
|
end
|
70
79
|
end
|
@@ -38,6 +38,7 @@ module CucumberAnalytics
|
|
38
38
|
|
39
39
|
File.open(@file, 'r') { |file| file_lines = file.readlines }
|
40
40
|
|
41
|
+
# collect feature tag lines
|
41
42
|
until file_lines.first =~ /^s*Feature:/
|
42
43
|
unless ignored_line?(file_lines.first)
|
43
44
|
feature_lines << file_lines.first
|
@@ -45,6 +46,7 @@ module CucumberAnalytics
|
|
45
46
|
file_lines.shift
|
46
47
|
end
|
47
48
|
|
49
|
+
# collect everything else until the end of the feature section
|
48
50
|
until file_lines.first =~ /^\s*(?:@|Background:|Scenario:|(?:Scenario Outline:))/ or file_lines.empty?
|
49
51
|
unless ignored_line?(file_lines.first)
|
50
52
|
feature_lines << file_lines.first
|
@@ -52,15 +54,28 @@ module CucumberAnalytics
|
|
52
54
|
file_lines.shift
|
53
55
|
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
if file_lines.first =~ /^\s*Background:/
|
58
|
+
|
59
|
+
# collect the background description lines
|
60
|
+
until (file_lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:And )|(?:\* )|@|Scenario:|(?:Scenario Outline:))/) or file_lines.empty?
|
59
61
|
unless ignored_line?(file_lines.first)
|
60
62
|
background_lines << file_lines.first
|
61
63
|
end
|
62
64
|
file_lines.shift
|
63
65
|
end
|
66
|
+
|
67
|
+
# collect everything else up to the first test
|
68
|
+
until file_lines.first =~ /^\s*(?:@|Scenario:|(?:Scenario Outline:))/ or file_lines.empty?
|
69
|
+
if file_lines.first =~ /^\s*"""/
|
70
|
+
background_lines.concat(extract_doc_string!(file_lines))
|
71
|
+
else
|
72
|
+
unless ignored_line?(file_lines.first)
|
73
|
+
background_lines << file_lines.first
|
74
|
+
end
|
75
|
+
file_lines.shift
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
64
79
|
end
|
65
80
|
|
66
81
|
@feature = ParsedFeature.new(feature_lines)
|
@@ -76,8 +91,11 @@ module CucumberAnalytics
|
|
76
91
|
test_lines = []
|
77
92
|
|
78
93
|
until lines.empty?
|
94
|
+
# we'll need this in order to figure out whether we are dealing with a
|
95
|
+
# scenario or an outline
|
79
96
|
current_test_line = lines.index { |line| line =~ /^\s*(?:Scenario:|(?:Scenario Outline:))/ }
|
80
97
|
|
98
|
+
# collect the tag lines
|
81
99
|
until lines.first =~ /^\s*(?:Scenario:|(?:Scenario Outline:))/
|
82
100
|
unless ignored_line?(lines.first)
|
83
101
|
test_lines << lines.first
|
@@ -88,6 +106,15 @@ module CucumberAnalytics
|
|
88
106
|
test_lines << lines.first
|
89
107
|
lines.shift
|
90
108
|
|
109
|
+
# collect the description lines
|
110
|
+
until (lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:And )|(?:\* )|Scenario:|(?:Scenario Outline:))/) or lines.empty?
|
111
|
+
unless ignored_line?(lines.first)
|
112
|
+
test_lines << lines.first
|
113
|
+
end
|
114
|
+
lines.shift
|
115
|
+
end
|
116
|
+
|
117
|
+
# collect everything else up to the next test
|
91
118
|
until (lines.first =~ /^\s*(?:Scenario:|(?:Scenario Outline:))/) or lines.empty?
|
92
119
|
if (lines.first =~ /^\s*"""/)
|
93
120
|
test_lines.concat(extract_doc_string!(lines))
|
@@ -99,12 +126,14 @@ module CucumberAnalytics
|
|
99
126
|
end
|
100
127
|
end
|
101
128
|
|
129
|
+
# backtrack in order to not end up stealing the next test's tag lines
|
102
130
|
unless lines.empty?
|
103
131
|
while (test_lines.last =~ /^\s*@/)
|
104
132
|
lines = [test_lines.pop].concat(lines)
|
105
133
|
end
|
106
134
|
end
|
107
135
|
|
136
|
+
# use the collected lines to create a scenario or an outline accordingly
|
108
137
|
if test_lines[current_test_line] =~ /^\s*Scenario Outline:/
|
109
138
|
next_test = ParsedScenarioOutline.new(test_lines)
|
110
139
|
else
|
@@ -25,5 +25,14 @@ module CucumberAnalytics
|
|
25
25
|
parse_test_element_steps(source_lines)
|
26
26
|
end
|
27
27
|
|
28
|
+
def parse_feature_element_description(source_lines)
|
29
|
+
until source_lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:And )|(?:\* ))/ or
|
30
|
+
source_lines.empty?
|
31
|
+
|
32
|
+
@description << source_lines.first.strip
|
33
|
+
source_lines.shift
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
28
37
|
end
|
29
38
|
end
|
@@ -31,6 +31,15 @@ module CucumberAnalytics
|
|
31
31
|
parse_outline_examples(source_lines)
|
32
32
|
end
|
33
33
|
|
34
|
+
def parse_feature_element_description(source_lines)
|
35
|
+
until source_lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:And )|(?:\* )| (?:Examples: ))/ or
|
36
|
+
source_lines.empty?
|
37
|
+
|
38
|
+
@description << source_lines.first.strip
|
39
|
+
source_lines.shift
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
34
43
|
def parse_outline_examples(source_lines)
|
35
44
|
until source_lines.empty?
|
36
45
|
current_example_line = source_lines.index { |line| line =~ /^\s*Examples/ }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|