cucumber_analytics 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.rdoc +76 -0
  5. data/Rakefile +2 -0
  6. data/cucumber_analytics.gemspec +22 -0
  7. data/features/analysis/feature_collection.feature +39 -0
  8. data/features/analysis/feature_file_collection.feature +36 -0
  9. data/features/analysis/step_collection.feature +137 -0
  10. data/features/analysis/tag_collection.feature +91 -0
  11. data/features/analysis/test_collection.feature +69 -0
  12. data/features/analysis/test_comparison.feature +123 -0
  13. data/features/modeling/background_modeling.feature +147 -0
  14. data/features/modeling/directory_modeling.feature +86 -0
  15. data/features/modeling/feature_file_modeling.feature +37 -0
  16. data/features/modeling/feature_modeling.feature +163 -0
  17. data/features/modeling/outline_modeling.feature +186 -0
  18. data/features/modeling/scenario_modeling.feature +154 -0
  19. data/features/step_definitions/background_steps.rb +55 -0
  20. data/features/step_definitions/directory_steps.rb +20 -0
  21. data/features/step_definitions/feature_steps.rb +62 -0
  22. data/features/step_definitions/file_steps.rb +18 -0
  23. data/features/step_definitions/outline_steps.rb +26 -0
  24. data/features/step_definitions/setup_steps.rb +50 -0
  25. data/features/step_definitions/test_steps.rb +82 -0
  26. data/features/step_definitions/world_steps.rb +158 -0
  27. data/features/support/env.rb +29 -0
  28. data/features/support/transforms.rb +3 -0
  29. data/lib/cucumber_analytics/feature_element.rb +54 -0
  30. data/lib/cucumber_analytics/outline_example.rb +31 -0
  31. data/lib/cucumber_analytics/parsed_background.rb +23 -0
  32. data/lib/cucumber_analytics/parsed_directory.rb +56 -0
  33. data/lib/cucumber_analytics/parsed_feature.rb +70 -0
  34. data/lib/cucumber_analytics/parsed_file.rb +140 -0
  35. data/lib/cucumber_analytics/parsed_scenario.rb +29 -0
  36. data/lib/cucumber_analytics/parsed_scenario_outline.rb +57 -0
  37. data/lib/cucumber_analytics/step.rb +81 -0
  38. data/lib/cucumber_analytics/test_element.rb +93 -0
  39. data/lib/cucumber_analytics/version.rb +3 -0
  40. data/lib/cucumber_analytics/world.rb +182 -0
  41. data/lib/cucumber_analytics.rb +12 -0
  42. metadata +174 -0
@@ -0,0 +1,147 @@
1
+ Feature: Background elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ All conceptual pieces of a Background can be modeled:
7
+ 1. the background's name
8
+ 2. the background's description
9
+ 3. the background's steps
10
+
11
+ Background: Test file setup.
12
+ Given the following feature file:
13
+ """
14
+ Feature: The test feature name.
15
+ Some more feature description.
16
+
17
+ Background: Some general test setup stuff.
18
+ #unimportant text
19
+ # more of the same
20
+ A little more information.
21
+
22
+
23
+ * this *parameterized* step takes a table:
24
+ | data |
25
+ | more data |
26
+ * some setup step
27
+ #
28
+ * a step with a *parameter*
29
+ * some big setup step:
30
+ #random comment
31
+ \"\"\"
32
+ some text
33
+
34
+ #some comments
35
+ Scenario:
36
+ Scenario Outline:
37
+ Examples:
38
+ @
39
+ Feature:
40
+ |
41
+ Given
42
+ When
43
+ Then
44
+ *
45
+ some more text
46
+ \"\"\"
47
+ * *lots* *of* *parameters*
48
+
49
+
50
+ Scenario: The first scenario's name.
51
+ Given the first step
52
+ When the second step
53
+ Then the third step
54
+ """
55
+ And parameter delimiters of "*" and "*"
56
+ When the file is read
57
+
58
+
59
+ Scenario: The background name is modeled.
60
+ Then the background is found to have the following properties:
61
+ | name | Some general test setup stuff. |
62
+
63
+ Scenario: The background description is modeled.
64
+ Then the background's descriptive lines are as follows:
65
+ | A little more information. |
66
+
67
+ Scenario: The background steps are modeled.
68
+ Then the background's steps are as follows:
69
+ | * this *parameterized* step takes a table: |
70
+ | \| data \| |
71
+ | \| more data \| |
72
+ | * some setup step |
73
+ | * a step with a *parameter* |
74
+ | * some big setup step: |
75
+ | """ |
76
+ | 'some text' |
77
+ | '' |
78
+ | '#some comments' |
79
+ | 'Scenario:' |
80
+ | 'Scenario Outline:' |
81
+ | 'Examples:' |
82
+ | '@' |
83
+ | 'Feature:' |
84
+ | '\|' |
85
+ | 'Given' |
86
+ | 'When' |
87
+ | 'Then' |
88
+ | '*' |
89
+ | ' some more text' |
90
+ | """ |
91
+ | * *lots* *of* *parameters* |
92
+ And the background's steps "without" arguments are as follows:
93
+ | * this ** step takes a table: |
94
+ | * some setup step |
95
+ | * a step with a ** |
96
+ | * some big setup step: |
97
+ | * ** ** ** |
98
+ And the background's steps "without" keywords are as follows:
99
+ | this *parameterized* step takes a table: |
100
+ | \| data \| |
101
+ | \| more data \| |
102
+ | some setup step |
103
+ | a step with a *parameter* |
104
+ | some big setup step: |
105
+ | """ |
106
+ | 'some text' |
107
+ | '' |
108
+ | '#some comments' |
109
+ | 'Scenario:' |
110
+ | 'Scenario Outline:' |
111
+ | 'Examples:' |
112
+ | '@' |
113
+ | 'Feature:' |
114
+ | '\|' |
115
+ | 'Given' |
116
+ | 'When' |
117
+ | 'Then' |
118
+ | '*' |
119
+ | ' some more text' |
120
+ | """ |
121
+ | *lots* *of* *parameters* |
122
+ And the background's steps "without" arguments "without" keywords are as follows:
123
+ | this ** step takes a table: |
124
+ | some setup step |
125
+ | a step with a ** |
126
+ | some big setup step: |
127
+ | ** ** ** |
128
+ And step "1" of the background has the following block:
129
+ | \| data \| |
130
+ | \| more data \| |
131
+ And step "4" of the background has the following block:
132
+ | """ |
133
+ | 'some text' |
134
+ | '' |
135
+ | '#some comments' |
136
+ | 'Scenario:' |
137
+ | 'Scenario Outline:' |
138
+ | 'Examples:' |
139
+ | '@' |
140
+ | 'Feature:' |
141
+ | '\|' |
142
+ | 'Given' |
143
+ | 'When' |
144
+ | 'Then' |
145
+ | '*' |
146
+ | ' some more text' |
147
+ | """ |
@@ -0,0 +1,86 @@
1
+ Feature: Directories can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ Directories containing feature files can be modeled:
7
+ 1. the directory's name
8
+ 2. the directory's full path
9
+ 3. all feature files contained
10
+
11
+
12
+ Background: Setup test directories
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: The first scenario's name.
19
+ Given the first step
20
+ When the second step
21
+ Then the third step
22
+ """
23
+ And the following feature file "test_file_2.feature":
24
+ """
25
+ Feature: The test feature 2.
26
+
27
+ Scenario: The first scenario's name.
28
+ Given the first step
29
+ When the second step
30
+ Then the third step
31
+ """
32
+ And the following feature file "test_file_3.feature":
33
+ """
34
+ Feature: The test feature 3.
35
+
36
+ Scenario: The first scenario's name.
37
+ Given the first step
38
+ When the second step
39
+ Then the third step
40
+ """
41
+ And the following file "random.file":
42
+ """
43
+ Not a .feature file.
44
+ """
45
+ Given a directory "feature_directory/nested_directory"
46
+ And the following feature file "test_file_4.feature":
47
+ """
48
+ Feature: The test feature 1.
49
+
50
+ Scenario: The first scenario's name.
51
+ Given the first step
52
+ When the second step
53
+ Then the third step
54
+ """
55
+ And the following feature file "test_file_5.feature":
56
+ """
57
+ Feature: The test feature 2.
58
+
59
+ Scenario: The first scenario's name.
60
+ Given the first step
61
+ When the second step
62
+ Then the third step
63
+ """
64
+ And the following file "another_random.file":
65
+ """
66
+ Not a .feature file.
67
+ """
68
+ When the directory "feature_directory" is read
69
+ And the directory "feature_directory/nested_directory" is read
70
+
71
+ Scenario: The directory's feature files are modeled.
72
+ Then directory "1" is found to have the following properties:
73
+ | name | feature_directory |
74
+ | path | path_to/feature_directory |
75
+ | feature_file_count | 3 |
76
+ And directory "1" feature files are as follows:
77
+ | test_file_1.feature |
78
+ | test_file_2.feature |
79
+ | test_file_3.feature |
80
+ Then directory "2" is found to have the following properties:
81
+ | name | nested_directory |
82
+ | path | path_to/feature_directory/nested_directory |
83
+ | feature_file_count | 2 |
84
+ And directory "2" feature files are as follows:
85
+ | test_file_4.feature |
86
+ | test_file_5.feature |
@@ -0,0 +1,37 @@
1
+ Feature: Feature files can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ All conceptual pieces of a .feature file can be modeled:
7
+ 1. the files's name
8
+ 2. the file's full path
9
+ 3. the file's features (only one per file)
10
+
11
+
12
+ Background: Test file setup.
13
+ Given the following feature file "test_file_1.feature":
14
+ """
15
+ Feature: The first test feature
16
+ Just a dummy feature.
17
+ """
18
+ And the following feature file "test_file_2.feature":
19
+ """
20
+ Feature: The second test feature
21
+ Just a dummy feature.
22
+ """
23
+ When the file "test_file_1.feature" is read
24
+ And the file "test_file_2.feature" is read
25
+
26
+
27
+ Scenario: The file's feature is modeled.
28
+ Then file "1" is found to have the following properties:
29
+ | name | test_file_1.feature |
30
+ | path | path_to/test_file_1.feature |
31
+ And file "1" features are as follows:
32
+ | The first test feature |
33
+ Then file "2" is found to have the following properties:
34
+ | name | test_file_2.feature |
35
+ | path | path_to/test_file_2.feature |
36
+ And file "2" features are as follows:
37
+ | The second test feature |
@@ -0,0 +1,163 @@
1
+ Feature: Features can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ All conceptual pieces of a Feature can be modeled:
7
+ 1. the feature's name
8
+ 2. the feature's description
9
+ 3. the feature's tags
10
+ 4. the feature's scenarios
11
+ 5. the feature's outlines
12
+ 6. the feature's background
13
+ 7. the feature's total number of tests
14
+ 8. the feature's total number of test cases
15
+
16
+
17
+ Background: Test file setup.
18
+ Given the following feature file "much_stuff.feature":
19
+ """
20
+ #Don't mind me.
21
+ #Or any line that is a comment, really.
22
+ @a_feature_level_tag @and_another@and_another
23
+
24
+ Feature: The test feature name.
25
+ Some more feature description.
26
+
27
+ And some more.
28
+
29
+ Background: Some general test setup stuff.
30
+ A little more information.
31
+ * some setup step
32
+
33
+ @a_tag
34
+
35
+ @another_tag@yet_another_tag
36
+ Scenario: The first scenario's name.
37
+ Some text describing the scenario.
38
+ More text.
39
+ Given the first step
40
+ And this step takes a table:
41
+ | data |
42
+ | more data |
43
+ When the second step
44
+ Then the third step
45
+ #Random comment
46
+ @outline_tag
47
+ Scenario Outline: The scenario outline's name.
48
+ Some text describing the scenario.
49
+ More text.
50
+ Given the first "<param1>"
51
+ And this step takes a table:
52
+ | data |
53
+ | more data |
54
+ When the second "<param2>"
55
+ Then the third step
56
+ Examples: text describing the significance of the examples
57
+ | param1 | param2 |
58
+ | x | y |
59
+
60
+ @example_tag
61
+
62
+ Examples: some examples with different significance and a tag
63
+ | param1 | param2 |
64
+ | a | b |
65
+
66
+
67
+ Scenario: The second scenario's name.
68
+ Some text describing the scenario.
69
+ More text.
70
+ Given the first step
71
+ When the second step
72
+ Then the third step
73
+
74
+ """
75
+ And the following feature file "barely_any_stuff.feature":
76
+ """
77
+ Feature:
78
+
79
+ Background:
80
+
81
+ Scenario:
82
+
83
+ Scenario Outline:
84
+ Examples:
85
+ """
86
+ And the following feature file "as_empty_as_it_gets.feature":
87
+ """
88
+ Feature:
89
+ """
90
+ When the file "much_stuff.feature" is read
91
+ And the file "barely_any_stuff.feature" is read
92
+ And the file "as_empty_as_it_gets.feature" is read
93
+
94
+
95
+ Scenario: The feature's properties are modeled.
96
+ Then feature "1" is found to have the following properties:
97
+ | name | The test feature name. |
98
+ | test_count | 3 |
99
+ | test_case_count | 4 |
100
+ And feature "2" is found to have the following properties:
101
+ | name | |
102
+ | test_count | 2 |
103
+ | test_case_count | 1 |
104
+
105
+ And feature "3" is found to have the following properties:
106
+ | name | |
107
+ | test_count | 0 |
108
+ | test_case_count | 0 |
109
+
110
+ Scenario: The feature's description is modeled.
111
+ Then the descriptive lines of feature "1" are as follows:
112
+ | Some more feature description. |
113
+ | And some more. |
114
+ And feature "2" has no descriptive lines
115
+ And feature "3" has no descriptive lines
116
+
117
+ Scenario: The feature's tags are modeled.
118
+ Then feature "1" is found to have the following tags:
119
+ | @a_feature_level_tag |
120
+ | @and_another |
121
+ | @and_another |
122
+ And feature "2" has no tags
123
+ And feature "3" has no tags
124
+
125
+ Scenario: The feature's scenarios are modeled.
126
+ Then feature "1" is found to have the following properties:
127
+ | scenario_count | 2 |
128
+ And feature "1" scenarios are as follows:
129
+ | The first scenario's name. |
130
+ | The second scenario's name. |
131
+ And feature "2" is found to have the following properties:
132
+ | scenario_count | 1 |
133
+ And feature "2" scenarios are as follows:
134
+ | |
135
+ And feature "3" is found to have the following properties:
136
+ | scenario_count | 0 |
137
+ And feature "3" has no scenarios
138
+
139
+ Scenario: The feature's outlines are modeled.
140
+ Then feature "1" is found to have the following properties:
141
+ | outline_count | 1 |
142
+ And feature "1" outlines are as follows:
143
+ | The scenario outline's name. |
144
+ And feature "2" is found to have the following properties:
145
+ | outline_count | 1 |
146
+ And feature "2" outlines are as follows:
147
+ | |
148
+ And feature "3" is found to have the following properties:
149
+ | outline_count | 0 |
150
+ And feature "3" has no outlines
151
+
152
+ Scenario: The feature's background is modeled.
153
+ Then feature "1" is found to have the following properties:
154
+ | has_background? | true |
155
+ And feature "1" background is as follows:
156
+ | Some general test setup stuff. |
157
+ And feature "2" is found to have the following properties:
158
+ | has_background? | true |
159
+ And feature "2" background is as follows:
160
+ | |
161
+ And feature "3" is found to have the following properties:
162
+ | has_background? | false |
163
+ And feature "3" has no background
@@ -0,0 +1,186 @@
1
+ Feature: Scenario Outline elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ All conceptual pieces of a Scenario Outline can be modeled:
7
+ 1. the outline's name
8
+ 2. the outline's description
9
+ 3. the outline's steps
10
+ 4. the outline's tags
11
+ 5. the outline's example rows
12
+
13
+
14
+ Background: Test file setup.
15
+ Given the following feature file:
16
+ """
17
+ @a_feature_level_tag
18
+ Feature: The test feature name.
19
+ Some more feature description.
20
+
21
+ @outline_tag
22
+ Scenario Outline: The scenario outline's name.
23
+ Some text describing the scenario.
24
+ More text.
25
+ Given this *parameterized* step takes a table:
26
+ | <param1> |
27
+ | <param2> |
28
+ And some setup step
29
+ #
30
+ When a step with a *parameter*
31
+ And a big step:
32
+ #random comment
33
+ \"\"\"
34
+ some text
35
+
36
+ #some comments
37
+ Scenario:
38
+ Scenario Outline:
39
+ Examples:
40
+ @
41
+ Feature:
42
+ |
43
+ Given
44
+ When
45
+ Then
46
+ *
47
+ some more text
48
+ \"\"\"
49
+ Then *lots* *of* *parameters*
50
+
51
+ Examples: text describing the significance of the examples
52
+ #
53
+ #
54
+ And even more description if you really need it.
55
+ | param1 | param2 |
56
+ #A more random comment
57
+ | x | y |
58
+ @example_tag @another_one
59
+ Examples: some examples with different significance and a tag
60
+
61
+ Words, words, words, words,
62
+
63
+ why so many words?
64
+ #
65
+
66
+ | param1 | param2 |
67
+ #
68
+
69
+ #
70
+ | a | b |
71
+
72
+ """
73
+ And parameter delimiters of "*" and "*"
74
+ When the file is read
75
+
76
+
77
+ Scenario: The outline name is modeled.
78
+ Then the test is found to have the following properties:
79
+ | name | The scenario outline's name. |
80
+
81
+ Scenario: The outline description is modeled.
82
+ Then the test descriptive lines are as follows:
83
+ | Some text describing the scenario. |
84
+ | More text. |
85
+
86
+ Scenario: The outline steps are modeled.
87
+ Then the test steps are as follows:
88
+ | Given this *parameterized* step takes a table: |
89
+ | \| <param1> \| |
90
+ | \| <param2> \| |
91
+ | And some setup step |
92
+ | When a step with a *parameter* |
93
+ | And a big step: |
94
+ | """ |
95
+ | 'some text' |
96
+ | '' |
97
+ | '#some comments' |
98
+ | 'Scenario:' |
99
+ | 'Scenario Outline:' |
100
+ | 'Examples:' |
101
+ | '@' |
102
+ | 'Feature:' |
103
+ | '\|' |
104
+ | 'Given' |
105
+ | 'When' |
106
+ | 'Then' |
107
+ | '*' |
108
+ | ' some more text' |
109
+ | """ |
110
+ | Then *lots* *of* *parameters* |
111
+ And the test steps "without" arguments are as follows:
112
+ | Given this ** step takes a table: |
113
+ | And some setup step |
114
+ | When a step with a ** |
115
+ | And a big step: |
116
+ | Then ** ** ** |
117
+ And the test steps "without" keywords are as follows:
118
+ | this *parameterized* step takes a table: |
119
+ | \| <param1> \| |
120
+ | \| <param2> \| |
121
+ | some setup step |
122
+ | a step with a *parameter* |
123
+ | a big step: |
124
+ | """ |
125
+ | 'some text' |
126
+ | '' |
127
+ | '#some comments' |
128
+ | 'Scenario:' |
129
+ | 'Scenario Outline:' |
130
+ | 'Examples:' |
131
+ | '@' |
132
+ | 'Feature:' |
133
+ | '\|' |
134
+ | 'Given' |
135
+ | 'When' |
136
+ | 'Then' |
137
+ | '*' |
138
+ | ' some more text' |
139
+ | """ |
140
+ | *lots* *of* *parameters* |
141
+ And the test steps "without" arguments "without" keywords are as follows:
142
+ | this ** step takes a table: |
143
+ | some setup step |
144
+ | a step with a ** |
145
+ | a big step: |
146
+ | ** ** ** |
147
+ And the test step "1" has the following block:
148
+ | \| <param1> \| |
149
+ | \| <param2> \| |
150
+ And the test step "4" has the following block:
151
+ | """ |
152
+ | 'some text' |
153
+ | '' |
154
+ | '#some comments' |
155
+ | 'Scenario:' |
156
+ | 'Scenario Outline:' |
157
+ | 'Examples:' |
158
+ | '@' |
159
+ | 'Feature:' |
160
+ | '\|' |
161
+ | 'Given' |
162
+ | 'When' |
163
+ | 'Then' |
164
+ | '*' |
165
+ | ' some more text' |
166
+ | """ |
167
+
168
+ Scenario: The outline tags are modeled.
169
+ Then the test is found to have the following tags:
170
+ | @outline_tag |
171
+
172
+ Scenario Outline: The outline examples are modeled.
173
+ Then "<outline>" example "<set>" has a "<name>"
174
+ And "<outline>" example "<set>" descriptive lines are as follows:
175
+ | <description1> |
176
+ | <description2> |
177
+ And "<outline>" example "<set>" tags are as follows:
178
+ | <tag1> |
179
+ | <tag2> |
180
+ And "<outline>" example "<set>" rows are as follows:
181
+ | <row1> |
182
+ | <row2> |
183
+ Examples:
184
+ | outline | set | name | description1 | description2 | tag1 | tag2 | row1 | row2 |
185
+ | 1 | 1 | text describing the significance of the examples | And even more description if you really need it. | | | | \| param1 \| param2 \| | \| x \| y \| |
186
+ | 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 \| |