cucumber_analytics 1.4.2 → 1.5.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.
Files changed (84) hide show
  1. data/History.rdoc +7 -0
  2. data/README.rdoc +4 -0
  3. data/Rakefile +1 -1
  4. data/cucumber_analytics.gemspec +3 -1
  5. data/features/modeling/background_modeling.feature +27 -13
  6. data/features/modeling/background_output.feature +130 -0
  7. data/features/modeling/directory_modeling.feature +11 -6
  8. data/features/modeling/directory_output.feature +13 -0
  9. data/features/modeling/doc_string_modeling.feature +18 -11
  10. data/features/modeling/doc_string_output.feature +71 -0
  11. data/features/modeling/example_modeling.feature +30 -19
  12. data/features/modeling/example_output.feature +192 -0
  13. data/features/modeling/feature_file_modeling.feature +9 -4
  14. data/features/modeling/feature_file_output.feature +13 -0
  15. data/features/modeling/feature_modeling.feature +33 -20
  16. data/features/modeling/feature_output.feature +244 -0
  17. data/features/modeling/outline_modeling.feature +29 -16
  18. data/features/modeling/outline_output.feature +197 -0
  19. data/features/modeling/row_modeling.feature +9 -4
  20. data/features/modeling/row_output.feature +27 -0
  21. data/features/modeling/scenario_modeling.feature +27 -14
  22. data/features/modeling/scenario_output.feature +147 -0
  23. data/features/modeling/step_modeling.feature +13 -8
  24. data/features/modeling/step_output.feature +52 -0
  25. data/features/modeling/table_modeling.feature +9 -4
  26. data/features/modeling/table_output.feature +42 -0
  27. data/features/modeling/table_row_modeling.feature +9 -4
  28. data/features/modeling/table_row_output.feature +27 -0
  29. data/features/modeling/tag_modeling.feature +10 -5
  30. data/features/modeling/tag_output.feature +16 -0
  31. data/features/step_definitions/action_steps.rb +3 -0
  32. data/features/step_definitions/background_steps.rb +17 -4
  33. data/features/step_definitions/directory_steps.rb +11 -0
  34. data/features/step_definitions/doc_string_steps.rb +18 -15
  35. data/features/step_definitions/feature_file_steps.rb +12 -1
  36. data/features/step_definitions/feature_steps.rb +23 -6
  37. data/features/step_definitions/outline_steps.rb +70 -9
  38. data/features/step_definitions/step_steps.rb +9 -1
  39. data/features/step_definitions/table_steps.rb +35 -2
  40. data/features/step_definitions/tag_steps.rb +8 -0
  41. data/features/step_definitions/test_steps.rb +14 -3
  42. data/features/step_definitions/verification_steps.rb +9 -0
  43. data/features/support/env.rb +1 -0
  44. data/lib/cucumber_analytics/background.rb +12 -0
  45. data/lib/cucumber_analytics/directory.rb +5 -0
  46. data/lib/cucumber_analytics/doc_string.rb +22 -0
  47. data/lib/cucumber_analytics/example.rb +55 -0
  48. data/lib/cucumber_analytics/feature.rb +26 -0
  49. data/lib/cucumber_analytics/feature_element.rb +25 -1
  50. data/lib/cucumber_analytics/feature_file.rb +5 -0
  51. data/lib/cucumber_analytics/outline.rb +18 -0
  52. data/lib/cucumber_analytics/parsing.rb +3 -1
  53. data/lib/cucumber_analytics/row.rb +5 -0
  54. data/lib/cucumber_analytics/scenario.rb +13 -0
  55. data/lib/cucumber_analytics/step.rb +8 -0
  56. data/lib/cucumber_analytics/table.rb +21 -0
  57. data/lib/cucumber_analytics/table_row.rb +5 -0
  58. data/lib/cucumber_analytics/tag.rb +5 -0
  59. data/lib/cucumber_analytics/taggable.rb +4 -0
  60. data/lib/cucumber_analytics/test_element.rb +8 -0
  61. data/lib/cucumber_analytics/version.rb +1 -1
  62. data/spec/integration/background_integration_spec.rb +12 -0
  63. data/spec/integration/example_integration_spec.rb +21 -0
  64. data/spec/integration/feature_integration_spec.rb +29 -0
  65. data/spec/integration/outline_integration_spec.rb +22 -0
  66. data/spec/integration/scenario_integration_spec.rb +16 -0
  67. data/spec/integration/step_integration_spec.rb +20 -0
  68. data/spec/integration/table_integration_spec.rb +11 -0
  69. data/spec/unit/background_unit_spec.rb +28 -0
  70. data/spec/unit/directory_unit_spec.rb +12 -0
  71. data/spec/unit/doc_string_unit_spec.rb +43 -3
  72. data/spec/unit/example_unit_spec.rb +53 -0
  73. data/spec/unit/feature_element_unit_specs.rb +9 -2
  74. data/spec/unit/feature_file_unit_spec.rb +12 -0
  75. data/spec/unit/feature_unit_spec.rb +30 -0
  76. data/spec/unit/outline_unit_spec.rb +30 -0
  77. data/spec/unit/row_unit_spec.rb +19 -7
  78. data/spec/unit/scenario_unit_spec.rb +30 -0
  79. data/spec/unit/step_unit_spec.rb +25 -1
  80. data/spec/unit/table_row_unit_spec.rb +12 -0
  81. data/spec/unit/table_unit_spec.rb +25 -0
  82. data/spec/unit/tag_unit_spec.rb +12 -0
  83. metadata +165 -86
  84. checksums.yaml +0 -15
@@ -1,3 +1,10 @@
1
+ === Version 1.5.0 / 2014-02-04
2
+
3
+ * Version ranges have been added for gem dependencies.
4
+ * #to_s has been overridden for elements so that it returns text suitable for
5
+ use as gherkin source code.
6
+
7
+
1
8
  === Version 1.4.2 / 2014-01-26
2
9
 
3
10
  * Bug fix: Example#add_row no longer assumes that the key/value pairs in a
@@ -1,5 +1,9 @@
1
1
  = CucumberAnalytics
2
2
 
3
+ {<img src="https://badge.fury.io/rb/cucumber_analytics.png" alt="Gem Version" />}[http://badge.fury.io/rb/cucumber_analytics]
4
+ {<img src="https://gemnasium.com/enkessler/cucumber_analytics.png" alt="Dependency Status" />}[https://gemnasium.com/enkessler/cucumber_analytics]
5
+ {<img src="https://codeclimate.com/github/enkessler/cucumber_analytics.png" />}[https://codeclimate.com/github/enkessler/cucumber_analytics]
6
+
3
7
  The intention of this gem is to provide a useful mechanism by which to answer
4
8
  all of the burning questions that one might have about their Cucumber test base.
5
9
 
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  desc 'Run all acceptance tests for the gem'
13
13
  Cucumber::Rake::Task.new(:tests) do |t|
14
- t.cucumber_opts = "-t ~@wip -t ~@off"
14
+ t.cucumber_opts = "-t ~@wip -t ~@off -f progress"
15
15
  end
16
16
 
17
17
  desc 'Run all API specifications for the gem'
@@ -17,7 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ['lib']
18
18
  gem.version = CucumberAnalytics::VERSION
19
19
 
20
- gem.add_runtime_dependency('gherkin')
20
+ gem.add_runtime_dependency('gherkin', '~> 2.11.0')
21
+ gem.add_runtime_dependency('json', '~> 1.0')
22
+ gem.add_runtime_dependency('multi_json', '~> 1.0')
21
23
 
22
24
  gem.add_development_dependency('rake')
23
25
  gem.add_development_dependency('cucumber')
@@ -3,21 +3,27 @@ Feature: Background elements can be modeled.
3
3
 
4
4
  Acceptance criteria
5
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
- 4. the background's source line
11
- 5. the background's raw element
6
+ 1. All conceptual pieces of a background can be modeled:
7
+ - the background's name
8
+ - the background's description
9
+ - the background's steps
10
+ - the background's source line
11
+ - the background's raw element
12
12
 
13
+ 2. Backgrounds can be outputted in a convenient form
14
+
15
+
13
16
  Background: Test file setup.
14
17
  Given the following feature file:
15
18
  """
16
19
  Feature:
17
20
 
18
- Background:Some general test setup stuff.
19
- Some background description
20
- Some more description
21
+ Background: Some general test setup stuff.
22
+
23
+ Some background description.
24
+
25
+ Some more.
26
+ Even more.
21
27
 
22
28
  Given a setup step
23
29
  And another setup step
@@ -39,9 +45,14 @@ Feature: Background elements can be modeled.
39
45
  | name | Some general test setup stuff. |
40
46
 
41
47
  Scenario: The background description is modeled.
42
- Then the background's descriptive lines are as follows:
43
- | Some background description |
44
- | Some more description |
48
+ Then the background has the following description:
49
+ """
50
+
51
+ Some background description.
52
+
53
+ Some more.
54
+ Even more.
55
+ """
45
56
 
46
57
  Scenario: The background steps are modeled.
47
58
  Then the background's steps are as follows:
@@ -49,8 +60,11 @@ Feature: Background elements can be modeled.
49
60
  | another setup step |
50
61
  | an action step |
51
62
 
63
+ Scenario: Convenient output of a background
64
+ Then the background has convenient output
65
+
52
66
  Scenario Outline: Background models pass all other specifications
53
- Exact specifications detailing the API for Background models.
67
+ Exact specifications detailing the API for background models.
54
68
  Given that there are "<additional specifications>" detailing models
55
69
  When the corresponding specifications are run
56
70
  Then all of those specifications are met
@@ -0,0 +1,130 @@
1
+ Feature: Outputting background elements
2
+
3
+ The output of an element model is a representation of the element as it would
4
+ appear in gherkin.
5
+
6
+
7
+ Scenario: Output of a background that does not have a name
8
+ Given a background element based on the following gherkin:
9
+ """
10
+ Background:
11
+ """
12
+ When it is outputted
13
+ Then the following text is provided:
14
+ """
15
+ Background:
16
+ """
17
+
18
+ Scenario: Output of a background that does have a name
19
+ Given a background element based on the following gherkin:
20
+ """
21
+ Background: with a name
22
+ """
23
+ When it is outputted
24
+ Then the following text is provided:
25
+ """
26
+ Background: with a name
27
+ """
28
+
29
+ Scenario: Output of a background that has a description, no first line buffer
30
+ Given a background element based on the following gherkin:
31
+ """
32
+ Background:
33
+ Some description.
34
+ Some more description.
35
+ """
36
+ When it is outputted
37
+ Then the following text is provided:
38
+ """
39
+ Background:
40
+
41
+ Some description.
42
+ Some more description.
43
+ """
44
+
45
+ Scenario: Output of a background that has a description, first line is blank
46
+ Given a background element based on the following gherkin:
47
+ """
48
+ Background:
49
+
50
+ Some description.
51
+ Some more description.
52
+ """
53
+ When it is outputted
54
+ Then the following text is provided:
55
+ """
56
+ Background:
57
+
58
+ Some description.
59
+ Some more description.
60
+ """
61
+
62
+ Scenario: Output of a background that has a description, first line is only whitespace
63
+ Given a background element based on the following gherkin:
64
+ """
65
+ Background:
66
+
67
+ Some description.
68
+ Some more description.
69
+ """
70
+ When it is outputted
71
+ Then the following text is provided:
72
+ """
73
+ Background:
74
+
75
+ Some description.
76
+ Some more description.
77
+ """
78
+
79
+ Scenario: Output of a background that has steps
80
+ Given a background element based on the following gherkin:
81
+ """
82
+ Background:
83
+ * a step
84
+ |value|
85
+ * another step
86
+ \"\"\"
87
+ some string
88
+ \"\"\"
89
+ """
90
+ When it is outputted
91
+ Then the following text is provided:
92
+ """
93
+ Background:
94
+ * a step
95
+ | value |
96
+ * another step
97
+ \"\"\"
98
+ some string
99
+ \"\"\"
100
+ """
101
+
102
+ Scenario: Output of a background that contains all possible parts
103
+ Given a background element based on the following gherkin:
104
+ """
105
+ Background: A background with everything it could have
106
+ Including a description
107
+ and then some.
108
+
109
+ * a step
110
+ |value|
111
+ * another step
112
+ \"\"\"
113
+ some string
114
+ \"\"\"
115
+ """
116
+ When it is outputted
117
+ Then the following text is provided:
118
+ """
119
+ Background: A background with everything it could have
120
+
121
+ Including a description
122
+ and then some.
123
+
124
+ * a step
125
+ | value |
126
+ * another step
127
+ \"\"\"
128
+ some string
129
+ \"\"\"
130
+ """
@@ -3,11 +3,13 @@ Feature: Directories can be modeled.
3
3
 
4
4
  Acceptance criteria
5
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
- 4. all directories contained
6
+ 1. Directories containing feature files can be modeled:
7
+ - the directory's name
8
+ - the directory's full path
9
+ - all feature files contained
10
+ - all directories contained
11
+
12
+ 2. Directories can be outputted in a convenient form
11
13
 
12
14
 
13
15
  Background: Setup test directories
@@ -69,7 +71,7 @@ Feature: Directories can be modeled.
69
71
  When the directory "feature_directory" is read
70
72
  And the directory "feature_directory/nested_directory" is read
71
73
 
72
- Scenario: The directory's name is modeled.
74
+ Scenario: The directory's name is modeled.
73
75
  Then directory "1" is found to have the following properties:
74
76
  | name | feature_directory |
75
77
  And directory "2" is found to have the following properties:
@@ -103,6 +105,9 @@ Feature: Directories can be modeled.
103
105
  | directory_count | 0 |
104
106
  And directory "2" has no directories
105
107
 
108
+ Scenario: Convenient output of a directory
109
+ Then the directory has convenient output
110
+
106
111
  Scenario Outline: Directory models pass all other specifications
107
112
  Exact specifications detailing the API for directory models.
108
113
  Given that there are "<additional specifications>" detailing models
@@ -0,0 +1,13 @@
1
+ Feature: Outputting directory elements
2
+
3
+ The output of an element model is a representation of the element as it would
4
+ appear in gherkin.
5
+
6
+
7
+ Scenario: Output of a directory
8
+ Given a directory element based on "some_directory"
9
+ When it is outputted
10
+ Then the following text is provided:
11
+ """
12
+ path_to/some_directory
13
+ """
@@ -1,12 +1,14 @@
1
- Feature: Doc String elements can be modeled.
1
+ Feature: Doc string elements can be modeled.
2
2
 
3
3
 
4
4
  Acceptance criteria
5
5
 
6
- All conceptual pieces of a Doc String can be modeled:
7
- 1. the doc string's content type
8
- 2. the doc string's contents
9
- 3. the doc string's raw element
6
+ 1. All conceptual pieces of a doc string can be modeled:
7
+ - the doc string's content type
8
+ - the doc string's contents
9
+ - the doc string's raw element
10
+
11
+ 2. Doc string can be outputted in a convenient form
10
12
 
11
13
 
12
14
  Background: Test file setup.
@@ -38,14 +40,19 @@ Feature: Doc String elements can be modeled.
38
40
 
39
41
  Scenario: The doc string's contents are modeled.
40
42
  Then the step "1" doc string has the following contents:
41
- | 'some text' |
42
- | ' ' |
43
- | ' some more text' |
44
- | '' |
43
+ """
44
+ some text
45
+
46
+ some more text
47
+
48
+ """
45
49
  And the step "2" doc string contents are empty
46
50
 
47
- Scenario Outline: Doc String models pass all other specifications
48
- Exact specifications detailing the API for Doc String models.
51
+ Scenario: Convenient output of an a doc string
52
+ Then the doc string has convenient output
53
+
54
+ Scenario Outline: Doc string models pass all other specifications
55
+ Exact specifications detailing the API for doc string models.
49
56
  Given that there are "<additional specifications>" detailing models
50
57
  When the corresponding specifications are run
51
58
  Then all of those specifications are met
@@ -0,0 +1,71 @@
1
+ Feature: Outputting doc string elements
2
+
3
+ The output of an element model is a representation of the element as it would
4
+ appear in gherkin.
5
+
6
+
7
+ Scenario: Output of an empty doc string
8
+ Given a doc string element based on the following gherkin:
9
+ """
10
+ \"\"\"
11
+ \"\"\"
12
+ """
13
+ When it is outputted
14
+ Then the following text is provided:
15
+ """
16
+ \"\"\"
17
+ \"\"\"
18
+ """
19
+
20
+ Scenario: Output of a doc string without a content type
21
+ Given a doc string element based on the following gherkin:
22
+ """
23
+ \"\"\"
24
+ Some text
25
+
26
+ some more text
27
+
28
+ \"\"\"
29
+ """
30
+ When it is outputted
31
+ Then the following text is provided:
32
+ """
33
+ \"\"\"
34
+ Some text
35
+
36
+ some more text
37
+
38
+ \"\"\"
39
+ """
40
+
41
+ Scenario: Output of a doc string with a content type
42
+ Given a doc string element based on the following gherkin:
43
+ """
44
+ \"\"\" the type
45
+ Some text
46
+
47
+ some more text
48
+
49
+ \"\"\"
50
+ """
51
+ When it is outputted
52
+ Then the following text is provided:
53
+ """
54
+ \"\"\" the type
55
+ Some text
56
+
57
+ some more text
58
+
59
+ \"\"\"
60
+ """
61
+
62
+ Scenario: Output of a doc string with a triple quotes in its contents
63
+
64
+ Since triple quotes mark the beginning and end of a doc string, any triple
65
+ quotes inside of the doc string (which would have had to have been escaped
66
+ to get inside in the first place) will be escaped when outputted so as to
67
+ retain the quality of being able to use the output directly as gherkin.
68
+
69
+ Given a doc string element based on the string """" the type\n* a step\n \"\"\"\n that also has a doc string\n \"\"\"\n""""
70
+ When it is outputted
71
+ Then the text provided is """" the type\n* a step\n \"\"\"\n that also has a doc string\n \"\"\"\n""""
@@ -3,15 +3,17 @@ Feature: Example elements can be modeled.
3
3
 
4
4
  Acceptance criteria
5
5
 
6
- All conceptual pieces of an Examples block can be modeled:
7
- 1. the example's name
8
- 2. the example's description
9
- 3. the example's parameters
10
- 4. the example's rows
11
- 5. the example's tags
12
- 6. the example's applied tags
13
- 7. the example's source line
14
- 8. the example's raw element
6
+ 1. All conceptual pieces of an example block can be modeled:
7
+ - the example's name
8
+ - the example's description
9
+ - the example's parameters
10
+ - the example's rows
11
+ - the example's tags
12
+ - the example's applied tags
13
+ - the example's source line
14
+ - the example's raw element
15
+
16
+ 2. Example blocks can be outputted in a convenient form
15
17
 
16
18
 
17
19
  Background: Test file setup.
@@ -25,14 +27,16 @@ Feature: Example elements can be modeled.
25
27
  * a step
26
28
 
27
29
  Examples: text describing the significance of the examples
28
- Example description
29
- more description
30
+
31
+ Some example description.
32
+
33
+ Some more.
34
+ Even more.
30
35
  |param1| param2 | extra param |
31
36
  |x | y | ? |
32
37
  |1 | 2 | 3 |
33
38
  @example_tag @another_one
34
39
  Examples: some examples with different significance and a tag
35
- Description
36
40
  | param1 |
37
41
  | a |
38
42
  """
@@ -47,7 +51,7 @@ Feature: Example elements can be modeled.
47
51
  Then the test example block "1" is found to have the following properties:
48
52
  | source_line | 8 |
49
53
  And the test example block "2" is found to have the following properties:
50
- | source_line | 15 |
54
+ | source_line | 18 |
51
55
 
52
56
  Scenario: The examples' name is modeled.
53
57
  Then the test example block "1" is found to have the following properties:
@@ -56,11 +60,15 @@ Feature: Example elements can be modeled.
56
60
  | name | some examples with different significance and a tag |
57
61
 
58
62
  Scenario: The examples' description is modeled.
59
- Then the test example block "1" descriptive lines are as follows:
60
- | Example description |
61
- | more description |
62
- And the test example block "2" descriptive lines are as follows:
63
- | Description |
63
+ Then the test example block "1" has the following description:
64
+ """
65
+
66
+ Some example description.
67
+
68
+ Some more.
69
+ Even more.
70
+ """
71
+ And the test example block "2" has no description
64
72
 
65
73
  Scenario: The examples' tags are modeled.
66
74
  Then the test example block "1" has no tags
@@ -88,8 +96,11 @@ Feature: Example elements can be modeled.
88
96
  And the test example block "2" rows are as follows:
89
97
  | a |
90
98
 
99
+ Scenario: Convenient output of an example block
100
+ Then the example block has convenient output
101
+
91
102
  Scenario Outline: Example models pass all other specifications
92
- Exact specifications detailing the API for Examples models.
103
+ Exact specifications detailing the API for example block models.
93
104
  Given that there are "<additional specifications>" detailing models
94
105
  When the corresponding specifications are run
95
106
  Then all of those specifications are met