kosmas58-cucumber 0.1.99.22 → 0.1.99.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (312) hide show
  1. data/History.txt +525 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +322 -0
  4. data/README.txt +25 -0
  5. data/Rakefile +8 -0
  6. data/bin/cucumber +6 -0
  7. data/config/hoe.rb +76 -0
  8. data/config/requirements.rb +15 -0
  9. data/cucumber.yml +1 -0
  10. data/examples/cs/README.textile +1 -0
  11. data/examples/cs/Rakefile +12 -0
  12. data/examples/cs/compile.bat +1 -0
  13. data/examples/cs/features/addition.feature +16 -0
  14. data/examples/cs/features/step_definitons/calculator_steps.rb +19 -0
  15. data/examples/cs/src/demo/Calculator.cs +20 -0
  16. data/examples/dos_line_endings/Rakefile +6 -0
  17. data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
  18. data/examples/i18n/README.textile +18 -0
  19. data/examples/i18n/Rakefile +32 -0
  20. data/examples/i18n/ar/Rakefile +6 -0
  21. data/examples/i18n/ar/features/addition.feature +16 -0
  22. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +24 -0
  23. data/examples/i18n/ar/lib/calculator.rb +10 -0
  24. data/examples/i18n/da/Rakefile +6 -0
  25. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +24 -0
  26. data/examples/i18n/da/features/summering.feature +17 -0
  27. data/examples/i18n/da/lib/kalkulator.rb +11 -0
  28. data/examples/i18n/de/Rakefile +6 -0
  29. data/examples/i18n/de/features/addition.feature +16 -0
  30. data/examples/i18n/de/features/division.feature +9 -0
  31. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +24 -0
  32. data/examples/i18n/de/lib/calculator.rb +14 -0
  33. data/examples/i18n/en/Rakefile +6 -0
  34. data/examples/i18n/en/features/addition.feature +16 -0
  35. data/examples/i18n/en/features/division.feature +9 -0
  36. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +24 -0
  37. data/examples/i18n/en/lib/calculator.rb +14 -0
  38. data/examples/i18n/es/Rakefile +6 -0
  39. data/examples/i18n/es/features/adicion.feature +16 -0
  40. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +21 -0
  41. data/examples/i18n/es/lib/calculador.rb +14 -0
  42. data/examples/i18n/et/Rakefile +6 -0
  43. data/examples/i18n/et/features/liitmine.feature +16 -0
  44. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +24 -0
  45. data/examples/i18n/et/lib/kalkulaator.rb +14 -0
  46. data/examples/i18n/fi/Rakefile +6 -0
  47. data/examples/i18n/fi/features/jakolasku.feature +9 -0
  48. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +24 -0
  49. data/examples/i18n/fi/features/yhteenlasku.feature +16 -0
  50. data/examples/i18n/fi/lib/laskin.rb +14 -0
  51. data/examples/i18n/fr/Rakefile +6 -0
  52. data/examples/i18n/fr/features/addition.feature +17 -0
  53. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +25 -0
  54. data/examples/i18n/fr/lib/calculatrice.rb +10 -0
  55. data/examples/i18n/id/Rakefile +6 -0
  56. data/examples/i18n/id/features/addition.feature +16 -0
  57. data/examples/i18n/id/features/division.feature +9 -0
  58. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +24 -0
  59. data/examples/i18n/id/lib/calculator.rb +14 -0
  60. data/examples/i18n/it/Rakefile +6 -0
  61. data/examples/i18n/it/features/somma.feature +10 -0
  62. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +24 -0
  63. data/examples/i18n/it/lib/calcolatrice.rb +11 -0
  64. data/examples/i18n/ja/Rakefile +6 -0
  65. data/examples/i18n/ja/features/addition.feature +16 -0
  66. data/examples/i18n/ja/features/division.feature +9 -0
  67. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +24 -0
  68. data/examples/i18n/ja/lib/calculator.rb +14 -0
  69. data/examples/i18n/ko/Rakefile +6 -0
  70. data/examples/i18n/ko/features/addition.feature +16 -0
  71. data/examples/i18n/ko/features/division.feature +10 -0
  72. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +24 -0
  73. data/examples/i18n/ko/lib/calculator.rb +14 -0
  74. data/examples/i18n/lt/Rakefile +6 -0
  75. data/examples/i18n/lt/features/addition.feature +17 -0
  76. data/examples/i18n/lt/features/division.feature +9 -0
  77. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +24 -0
  78. data/examples/i18n/lt/lib/calculator.rb +14 -0
  79. data/examples/i18n/no/Rakefile +6 -0
  80. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +17 -0
  81. data/examples/i18n/no/features/summering.feature +18 -0
  82. data/examples/i18n/no/features/support/env.rb +6 -0
  83. data/examples/i18n/no/lib/kalkulator.rb +11 -0
  84. data/examples/i18n/pt/Rakefile +6 -0
  85. data/examples/i18n/pt/features/adicao.feature +10 -0
  86. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +24 -0
  87. data/examples/i18n/pt/lib/calculadora.rb +10 -0
  88. data/examples/i18n/ro/Rakefile +6 -0
  89. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +24 -0
  90. data/examples/i18n/ro/features/suma.feature +10 -0
  91. data/examples/i18n/ro/lib/calculator.rb +11 -0
  92. data/examples/i18n/ru/Rakefile +6 -0
  93. data/examples/i18n/ru/features/addition.feature +10 -0
  94. data/examples/i18n/ru/features/consecutive_calculations.feature +16 -0
  95. data/examples/i18n/ru/features/division.feature +15 -0
  96. data/examples/i18n/ru/features/step_definitons/calculator_steps.rb +19 -0
  97. data/examples/i18n/ru/features/support/env.rb +6 -0
  98. data/examples/i18n/ru/features/support/world.rb +7 -0
  99. data/examples/i18n/ru/lib/calculator.rb +24 -0
  100. data/examples/i18n/se/Rakefile +6 -0
  101. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +24 -0
  102. data/examples/i18n/se/features/summering.feature +17 -0
  103. data/examples/i18n/se/lib/kalkulator.rb +11 -0
  104. data/examples/i18n/zh-CN/Rakefile +6 -0
  105. data/examples/i18n/zh-CN/features/addition.feature +17 -0
  106. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +26 -0
  107. data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
  108. data/examples/i18n/zh-TW/Rakefile +6 -0
  109. data/examples/i18n/zh-TW/features/addition.feature +16 -0
  110. data/examples/i18n/zh-TW/features/division.feature +10 -0
  111. data/examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb +24 -0
  112. data/examples/i18n/zh-TW/lib/calculator.rb +14 -0
  113. data/examples/java/README.textile +22 -0
  114. data/examples/java/Rakefile +12 -0
  115. data/examples/java/features/hello.feature +11 -0
  116. data/examples/java/features/step_definitons/hello_steps.rb +25 -0
  117. data/examples/java/features/step_definitons/tree_steps.rb +14 -0
  118. data/examples/java/features/tree.feature +9 -0
  119. data/examples/java/src/cucumber/demo/Hello.java +16 -0
  120. data/examples/jbehave/README.textile +17 -0
  121. data/examples/jbehave/features/support/env.rb +7 -0
  122. data/examples/jbehave/features/trading.feature +24 -0
  123. data/examples/jbehave/pom.xml +48 -0
  124. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +32 -0
  125. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +42 -0
  126. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +29 -0
  127. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +22 -0
  128. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +65 -0
  129. data/examples/selenium/Rakefile +6 -0
  130. data/examples/selenium/features/search.feature +9 -0
  131. data/examples/self_test/README.textile +6 -0
  132. data/examples/self_test/Rakefile +6 -0
  133. data/examples/self_test/features/background/failing_background.feature +10 -0
  134. data/examples/self_test/features/background/failing_background_after_success.feature +11 -0
  135. data/examples/self_test/features/background/multiline_args_background.feature +32 -0
  136. data/examples/self_test/features/background/passing_background.feature +10 -0
  137. data/examples/self_test/features/background/pending_background.feature +10 -0
  138. data/examples/self_test/features/background/scenario_outline_failing_background.feature +16 -0
  139. data/examples/self_test/features/background/scenario_outline_passing_background.feature +16 -0
  140. data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
  141. data/examples/self_test/features/failing_expectation.feature +4 -0
  142. data/examples/self_test/features/lots_of_undefined.feature +8 -0
  143. data/examples/self_test/features/outline_sample.feature +15 -0
  144. data/examples/self_test/features/sample.feature +19 -0
  145. data/examples/self_test/features/step_definitions/sample_steps.rb +64 -0
  146. data/examples/self_test/features/support/env.rb +1 -0
  147. data/examples/self_test/features/support/tag_count_formatter.rb +25 -0
  148. data/examples/sinatra/Rakefile +6 -0
  149. data/examples/sinatra/app.rb +14 -0
  150. data/examples/sinatra/features/add.feature +11 -0
  151. data/examples/sinatra/features/step_definitions/add_steps.rb +15 -0
  152. data/examples/sinatra/features/support/env.rb +20 -0
  153. data/examples/sinatra/views/add.erb +5 -0
  154. data/examples/sinatra/views/layout.erb +8 -0
  155. data/examples/test_unit/Rakefile +6 -0
  156. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +26 -0
  157. data/examples/test_unit/features/test_unit.feature +9 -0
  158. data/examples/tickets/Rakefile +11 -0
  159. data/examples/tickets/cucumber.yml +2 -0
  160. data/examples/tickets/features/172.feature +28 -0
  161. data/examples/tickets/features/177/1.feature +29 -0
  162. data/examples/tickets/features/177/2.feature +21 -0
  163. data/examples/tickets/features/177/3.feature +18 -0
  164. data/examples/tickets/features/180.feature +7 -0
  165. data/examples/tickets/features/lib/eatting_machine.rb +18 -0
  166. data/examples/tickets/features/lib/pantry.rb +20 -0
  167. data/examples/tickets/features/scenario_outline.feature +95 -0
  168. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +42 -0
  169. data/examples/tickets/features/step_definitons/tickets_steps.rb +60 -0
  170. data/examples/tickets/features/tickets.feature +28 -0
  171. data/examples/watir/README.textile +16 -0
  172. data/examples/watir/Rakefile +6 -0
  173. data/examples/watir/features/search.feature +9 -0
  174. data/examples/watir/features/step_definitons/search_steps.rb +24 -0
  175. data/examples/watir/features/support/env.rb +32 -0
  176. data/features/background.feature +223 -0
  177. data/features/cucumber_cli.feature +366 -0
  178. data/features/cucumber_cli_diff_disabled.feature +45 -0
  179. data/features/cucumber_cli_outlines.feature +90 -0
  180. data/features/custom_formatter.feature +11 -0
  181. data/features/report_called_undefined_steps.feature +32 -0
  182. data/features/step_definitions/cucumber_steps.rb +30 -0
  183. data/features/step_definitions/extra_steps.rb +2 -0
  184. data/features/support/env.rb +8 -0
  185. data/gem_tasks/deployment.rake +11 -0
  186. data/gem_tasks/environment.rake +7 -0
  187. data/gem_tasks/features.rake +9 -0
  188. data/gem_tasks/fix_cr_lf.rake +10 -0
  189. data/gem_tasks/flog.rake +4 -0
  190. data/gem_tasks/gemspec.rake +10 -0
  191. data/gem_tasks/jar.rake +67 -0
  192. data/gem_tasks/rspec.rake +38 -0
  193. data/gem_tasks/yard.rake +8 -0
  194. data/lib/autotest/cucumber.rb +6 -0
  195. data/lib/autotest/cucumber_mixin.rb +125 -0
  196. data/lib/autotest/cucumber_rails.rb +6 -0
  197. data/lib/autotest/cucumber_rails_rspec.rb +6 -0
  198. data/lib/autotest/cucumber_rspec.rb +6 -0
  199. data/lib/autotest/discover.rb +9 -0
  200. data/lib/cucumber.rb +71 -0
  201. data/lib/cucumber/ast.rb +29 -0
  202. data/lib/cucumber/ast/background.rb +88 -0
  203. data/lib/cucumber/ast/comment.rb +26 -0
  204. data/lib/cucumber/ast/examples.rb +26 -0
  205. data/lib/cucumber/ast/feature.rb +66 -0
  206. data/lib/cucumber/ast/features.rb +39 -0
  207. data/lib/cucumber/ast/filter.rb +22 -0
  208. data/lib/cucumber/ast/outline_table.rb +49 -0
  209. data/lib/cucumber/ast/py_string.rb +52 -0
  210. data/lib/cucumber/ast/scenario.rb +103 -0
  211. data/lib/cucumber/ast/scenario_outline.rb +92 -0
  212. data/lib/cucumber/ast/step.rb +161 -0
  213. data/lib/cucumber/ast/steps.rb +13 -0
  214. data/lib/cucumber/ast/table.rb +290 -0
  215. data/lib/cucumber/ast/tags.rb +40 -0
  216. data/lib/cucumber/ast/visitor.rb +109 -0
  217. data/lib/cucumber/broadcaster.rb +15 -0
  218. data/lib/cucumber/cli/configuration.rb +356 -0
  219. data/lib/cucumber/cli/language_help_formatter.rb +59 -0
  220. data/lib/cucumber/cli/main.rb +107 -0
  221. data/lib/cucumber/core_ext/exception.rb +53 -0
  222. data/lib/cucumber/core_ext/instance_exec.rb +54 -0
  223. data/lib/cucumber/core_ext/proc.rb +33 -0
  224. data/lib/cucumber/core_ext/string.rb +48 -0
  225. data/lib/cucumber/formatter.rb +1 -0
  226. data/lib/cucumber/formatter/ansicolor.rb +103 -0
  227. data/lib/cucumber/formatter/color_io.rb +23 -0
  228. data/lib/cucumber/formatter/console.rb +119 -0
  229. data/lib/cucumber/formatter/cucumber.css +55 -0
  230. data/lib/cucumber/formatter/cucumber.sass +49 -0
  231. data/lib/cucumber/formatter/html.rb +126 -0
  232. data/lib/cucumber/formatter/pretty.rb +167 -0
  233. data/lib/cucumber/formatter/profile.rb +77 -0
  234. data/lib/cucumber/formatter/progress.rb +68 -0
  235. data/lib/cucumber/formatter/rerun.rb +35 -0
  236. data/lib/cucumber/formatter/unicode.rb +35 -0
  237. data/lib/cucumber/formatters/unicode.rb +2 -0
  238. data/lib/cucumber/jbehave.rb +102 -0
  239. data/lib/cucumber/languages.yml +374 -0
  240. data/lib/cucumber/parser.rb +43 -0
  241. data/lib/cucumber/parser/basic.rb +0 -0
  242. data/lib/cucumber/parser/feature.rb +1490 -0
  243. data/lib/cucumber/parser/feature.tt +188 -0
  244. data/lib/cucumber/parser/i18n.tt +31 -0
  245. data/lib/cucumber/parser/table.rb +402 -0
  246. data/lib/cucumber/parser/table.tt +59 -0
  247. data/lib/cucumber/parser/treetop_ext.rb +75 -0
  248. data/lib/cucumber/platform.rb +18 -0
  249. data/lib/cucumber/rails/rspec.rb +8 -0
  250. data/lib/cucumber/rails/world.rb +73 -0
  251. data/lib/cucumber/rake/task.rb +146 -0
  252. data/lib/cucumber/step_definition.rb +94 -0
  253. data/lib/cucumber/step_mother.rb +194 -0
  254. data/lib/cucumber/version.rb +10 -0
  255. data/rails_generators/cucumber/USAGE +14 -0
  256. data/rails_generators/cucumber/cucumber_generator.rb +75 -0
  257. data/rails_generators/cucumber/templates/cucumber +8 -0
  258. data/rails_generators/cucumber/templates/cucumber.rake +20 -0
  259. data/rails_generators/cucumber/templates/env.rb +17 -0
  260. data/rails_generators/cucumber/templates/paths.rb +19 -0
  261. data/rails_generators/cucumber/templates/webrat_steps.rb +115 -0
  262. data/rails_generators/feature/USAGE +15 -0
  263. data/rails_generators/feature/feature_generator.rb +60 -0
  264. data/rails_generators/feature/templates/feature.erb +31 -0
  265. data/rails_generators/feature/templates/steps.erb +24 -0
  266. data/spec/cucumber/ast/background_spec.rb +58 -0
  267. data/spec/cucumber/ast/feature_factory.rb +54 -0
  268. data/spec/cucumber/ast/feature_spec.rb +60 -0
  269. data/spec/cucumber/ast/py_string_spec.rb +40 -0
  270. data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
  271. data/spec/cucumber/ast/scenario_spec.rb +82 -0
  272. data/spec/cucumber/ast/step_spec.rb +45 -0
  273. data/spec/cucumber/ast/table_spec.rb +139 -0
  274. data/spec/cucumber/ast/tags_spec.rb +35 -0
  275. data/spec/cucumber/broadcaster_spec.rb +14 -0
  276. data/spec/cucumber/cli/configuration_spec.rb +268 -0
  277. data/spec/cucumber/cli/main_spec.rb +204 -0
  278. data/spec/cucumber/core_ext/proc_spec.rb +37 -0
  279. data/spec/cucumber/core_ext/string_spec.rb +42 -0
  280. data/spec/cucumber/formatter/ansicolor_spec.rb +35 -0
  281. data/spec/cucumber/formatter/color_io_spec.rb +26 -0
  282. data/spec/cucumber/formatter/html/cucumber.css +37 -0
  283. data/spec/cucumber/formatter/html/cucumber.js +13 -0
  284. data/spec/cucumber/formatter/html/index.html +45 -0
  285. data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
  286. data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
  287. data/spec/cucumber/formatters/profile_formatter_spec.rb +198 -0
  288. data/spec/cucumber/parser/feature_parser_spec.rb +281 -0
  289. data/spec/cucumber/parser/table_parser_spec.rb +48 -0
  290. data/spec/cucumber/rails/stubs/mini_rails.rb +18 -0
  291. data/spec/cucumber/rails/stubs/test_help.rb +1 -0
  292. data/spec/cucumber/rails/world_spec.rb +11 -0
  293. data/spec/cucumber/sell_cucumbers.feature +19 -0
  294. data/spec/cucumber/step_definition_spec.rb +70 -0
  295. data/spec/cucumber/step_mother_spec.rb +73 -0
  296. data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
  297. data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
  298. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
  299. data/spec/cucumber/treetop_parser/fit_scenario.feature +8 -0
  300. data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
  301. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
  302. data/spec/cucumber/treetop_parser/multiline_steps.feature +17 -0
  303. data/spec/cucumber/treetop_parser/multiple_tables.feature +27 -0
  304. data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
  305. data/spec/cucumber/treetop_parser/spaces.feature +12 -0
  306. data/spec/cucumber/treetop_parser/test_dos.feature +25 -0
  307. data/spec/cucumber/treetop_parser/with_comments.feature +10 -0
  308. data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
  309. data/spec/cucumber/world/pending_spec.rb +47 -0
  310. data/spec/spec.opts +2 -0
  311. data/spec/spec_helper.rb +21 -0
  312. metadata +329 -9
@@ -0,0 +1,77 @@
1
+ require 'cucumber/formatter/progress'
2
+
3
+ module Cucumber
4
+ module Formatter
5
+ class Profile < Progress
6
+ NUMBER_OF_STEP_DEFINITONS_TO_SHOW = 10
7
+ NUMBER_OF_STEP_INVOCATIONS_TO_SHOW = 5
8
+
9
+ def initialize(step_mother, io, options)
10
+ super
11
+ @step_definition_durations = Hash.new { |h,step_definition| h[step_definition] = [] }
12
+ end
13
+
14
+ def visit_step(step)
15
+ @step_duration = Time.now
16
+ @step = step
17
+ super
18
+ end
19
+
20
+ def visit_step_name(keyword, step_name, status, step_definition, source_indent)
21
+ duration = Time.now - @step_duration
22
+ super
23
+
24
+ if step_definition # nil for outline steps
25
+ description = format_step(keyword, step_name, status, step_definition, nil)
26
+ @step_definition_durations[step_definition] << [duration, description, @step.file_line]
27
+ end
28
+ end
29
+
30
+ def print_summary(features)
31
+ super
32
+ @io.puts "\n\nTop #{NUMBER_OF_STEP_DEFINITONS_TO_SHOW} average slowest steps with #{NUMBER_OF_STEP_INVOCATIONS_TO_SHOW} slowest matches:\n"
33
+
34
+ mean_durations = map_to_mean_durations(@step_definition_durations)
35
+ mean_durations = mean_durations.sort_by do |duration_description_location, step_definition, mean_duration|
36
+ mean_duration
37
+ end.reverse
38
+
39
+ mean_durations[0...NUMBER_OF_STEP_DEFINITONS_TO_SHOW].each do |duration_description_location, step_definition, mean_duration|
40
+ print_step_definition(step_definition, mean_duration)
41
+ duration_description_location = duration_description_location.sort_by do |duration, description, location|
42
+ duration
43
+ end.reverse
44
+ print_step_definitions(duration_description_location, step_definition)
45
+ end
46
+ end
47
+
48
+ private
49
+
50
+ def map_to_mean_durations(step_definition_durations)
51
+ mean_durations = []
52
+ step_definition_durations.each do |step_definition, duration_description_location|
53
+ total_duration = duration_description_location.inject(0) { |sum, step_details| step_details[0] + sum }
54
+ mean_duration = total_duration / duration_description_location.length
55
+
56
+ mean_durations << [duration_description_location, step_definition, mean_duration]
57
+ end
58
+ mean_durations
59
+ end
60
+
61
+ def print_step_definition(step_definition, mean_duration)
62
+ duration = sprintf("%.7f", mean_duration)
63
+ @io.puts format_string("#{duration} #{step_definition.to_backtrace_line}", :failed)
64
+ end
65
+
66
+ def print_step_definitions(duration_description_location, step_definition)
67
+ max_length = duration_description_location[0...NUMBER_OF_STEP_INVOCATIONS_TO_SHOW].map{|_, d, _| d.jlength}.max
68
+ duration_description_location[0...NUMBER_OF_STEP_INVOCATIONS_TO_SHOW].each do |duration, description, location|
69
+ @io.print format_string(" #{sprintf("%.7f", duration)}", :pending)
70
+ @io.print " #{description}"
71
+ @io.print format_string(" # #{location}".indent(max_length - description.jlength), :comment)
72
+ @io.puts
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,68 @@
1
+ require 'cucumber/formatter/console'
2
+
3
+ module Cucumber
4
+ module Formatter
5
+ class Progress < Ast::Visitor
6
+ include Console
7
+
8
+ def initialize(step_mother, io, options)
9
+ super(step_mother)
10
+ @io = io
11
+ @options = options
12
+ end
13
+
14
+ def visit_features(features)
15
+ with_color do
16
+ super
17
+ @io.puts
18
+ @io.puts
19
+ print_summary(features)
20
+ end
21
+ end
22
+
23
+ def visit_multiline_arg(multiline_arg, status)
24
+ @multiline_arg = true
25
+ super
26
+ @multiline_arg = false
27
+ end
28
+
29
+ def visit_feature_element(feature_element)
30
+ progress(:undefined) if feature_element.undefined?
31
+ super
32
+ end
33
+
34
+ def visit_step_name(keyword, step_name, status, step_definition, source_indent)
35
+ progress(status) unless status == :outline
36
+ end
37
+
38
+ def visit_table_cell_value(value, width, status)
39
+ progress(status) if (status != :thead) && !@multiline_arg
40
+ end
41
+
42
+ private
43
+
44
+ def print_summary(features)
45
+ print_undefined_scenarios(features)
46
+ print_steps(features, :pending)
47
+ print_steps(features, :failed)
48
+ print_counts(features)
49
+ print_snippets(features, @options)
50
+ end
51
+
52
+ CHARS = {
53
+ :passed => '.',
54
+ :failed => 'F',
55
+ :undefined => 'U',
56
+ :pending => 'P',
57
+ :skipped => 'S'
58
+ }
59
+
60
+ def progress(status)
61
+ char = CHARS[status]
62
+ @io.print(format_string(char, status))
63
+ @io.flush
64
+ end
65
+
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,35 @@
1
+ module Cucumber
2
+ module Formatter
3
+ class Rerun < Ast::Visitor
4
+ def initialize(step_mother, io, options)
5
+ super(step_mother)
6
+ @io = io
7
+ @file_names = []
8
+ @file_lines = Hash.new{|h,k| h[k] = []}
9
+ end
10
+
11
+ def visit_features(features)
12
+ super
13
+ files = @file_names.uniq.map do |file|
14
+ lines = @file_lines[file]
15
+ "#{file}:#{lines.join(':')}"
16
+ end
17
+ @io.puts files.join(' ')
18
+ end
19
+
20
+ def visit_feature_element(feature_element)
21
+ @rerun = false
22
+ super
23
+ if @rerun
24
+ file, line = *feature_element.file_line.split(':')
25
+ @file_lines[file] << line
26
+ @file_names << file
27
+ end
28
+ end
29
+
30
+ def visit_step_name(keyword, step_name, status, step_definition, source_indent)
31
+ @rerun = true if [:failed].index(status)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # Require this file if you need Unicode support.
2
+ require 'cucumber/platform'
3
+ require 'cucumber/formatter/ansicolor'
4
+
5
+ $KCODE='u' unless Cucumber::RUBY_1_9
6
+
7
+ if Cucumber::WINDOWS_MRI && `chcp` =~ /(\d+)/
8
+ codepage = $1.to_i
9
+ codepages = (1251..1252)
10
+
11
+ if codepages.include?(codepage)
12
+ Cucumber::CODEPAGE = "cp#{codepage}"
13
+
14
+ require 'iconv'
15
+ module Kernel
16
+ alias cucumber_print print
17
+ def print(*a)
18
+ begin
19
+ cucumber_print(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a))
20
+ rescue Iconv::IllegalSequence
21
+ cucumber_print(*a)
22
+ end
23
+ end
24
+
25
+ alias cucumber_puts puts
26
+ def puts(*a)
27
+ begin
28
+ cucumber_puts(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a))
29
+ rescue Iconv::IllegalSequence
30
+ cucumber_puts(*a)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,2 @@
1
+ # This is for backwards compatibility
2
+ require 'cucumber/formatter/unicode'
@@ -0,0 +1,102 @@
1
+ if defined?(JRUBY_VERSION)
2
+ require 'java'
3
+
4
+ Exception::CUCUMBER_FILTER_PATTERNS.unshift(/^org\/jruby|^org\/jbehave|^org\/junit|^java\/|^sun\/|^\$_dot_dot_/)
5
+
6
+ module Cucumber
7
+ module JBehave
8
+ # Register an instance of org.jbehave.scenario.steps.Steps
9
+ def JBehave(jbehave_steps)
10
+ jbehave_steps.getSteps.each do |jbehave_candidate_step|
11
+ step_definitions << JBehaveStepDefinition.new(jbehave_steps, jbehave_candidate_step)
12
+ end
13
+ end
14
+
15
+ # Open up so we can get the pattern....
16
+ JBehaveCandidateStep = org.jbehave.scenario.steps.CandidateStep
17
+ class JBehaveCandidateStep
18
+ field_reader :pattern
19
+ end
20
+
21
+ # Adapter for JBehave org.jbehave.scenario.steps.CandidateStep
22
+ class JBehaveStepDefinition
23
+ def initialize(jbehave_steps, jbehave_candidate_step)
24
+ @jbehave_steps = jbehave_steps
25
+ @jbehave_candidate_step = jbehave_candidate_step
26
+ end
27
+
28
+ def match(step_name)
29
+ full_text = "Given #{step_name}" # JBehave doesn't distinguish GWT internally :-)
30
+ @jbehave_candidate_step.matches(full_text)
31
+ end
32
+
33
+ def file_colon_line
34
+ @jbehave_steps.java_class.name
35
+ end
36
+
37
+ def format_args(step_name, format)
38
+ java_pattern = @jbehave_candidate_step.pattern.pattern
39
+ regexp = Regexp.new(java_pattern)
40
+ step_name.gzub(regexp, format)
41
+ end
42
+
43
+ def matched_args(step_name)
44
+ java_pattern = @jbehave_candidate_step.pattern.pattern
45
+ regexp = Regexp.new(java_pattern)
46
+ step_name.match(regexp).captures
47
+ end
48
+
49
+ def execute(step_name, world, *args)
50
+ step = @jbehave_candidate_step.createFrom("Given #{step_name}")
51
+ result = step.perform
52
+ result.describeTo(JBehave::REPORTER)
53
+ end
54
+ end
55
+
56
+ class JBehaveException < Exception
57
+ end
58
+
59
+ # Implements the org.jbehave.scenario.reporters.ScenarioReporter methods
60
+ class Reporter
61
+ def successful(step_text)
62
+ # noop
63
+ end
64
+
65
+ def failed(step, java_exception)
66
+ raise java_exception_to_ruby_exception(java_exception)
67
+ end
68
+
69
+ private
70
+
71
+ def java_exception_to_ruby_exception(java_exception)
72
+ # OK, this is a little funky - JRuby weirdness
73
+ ruby_exception = org.jruby.NativeException.new(JRuby.runtime, JBehaveException, java_exception)
74
+ ruby_exception.set_backtrace([]) # work around backtrace bug in jruby
75
+
76
+ exception = JBehaveException.new(java_exception.getMessage)
77
+ bt = ruby_exception.backtrace
78
+ Exception.cucumber_strip_backtrace!(bt, nil, nil)
79
+ exception.set_backtrace(bt)
80
+ exception
81
+ end
82
+ end
83
+
84
+ REPORTER = Reporter.new
85
+
86
+ def self.snippet_text(step_keyword, step_name)
87
+ camel = step_name.gsub(/(\s.)/) {$1.upcase.strip}
88
+ method = camel[0..0].downcase + camel[1..-1]
89
+ snippet = %{ @#{step_keyword}("#{step_name}")
90
+ public void #{method}() {
91
+ throw new RuntimeException("pending");
92
+ }}
93
+ end
94
+ end
95
+ end
96
+
97
+ self.extend(Cucumber::JBehave)
98
+ self.snippet_generator = Cucumber::JBehave
99
+ else
100
+ STDERR.puts "ERROR: cucumber/jbehave only works with JRuby"
101
+ Kernel.exit(1)
102
+ end
@@ -0,0 +1,374 @@
1
+ # encoding: UTF-8
2
+ # We use the codes here (prefer 2 letters when possible)
3
+ # http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
4
+ #
5
+ # If you want several aliases for a keyword, just separate them
6
+ # with a | character. Make sure there are no ambiguities in the
7
+ # keywords.
8
+ #
9
+ "en":
10
+ name: English
11
+ native: English
12
+ encoding: UTF-8
13
+ feature: Feature
14
+ background: Background
15
+ scenario: Scenario
16
+ scenario_outline: Scenario Outline
17
+ examples: Examples|Scenarios
18
+ given: Given
19
+ when: When
20
+ then: Then
21
+ and: And
22
+ but: But
23
+ # Please help us keeping the languages below uptodate. The parsers for a language
24
+ # that is missing a keyword will expect the English word until the missing word(s)
25
+ # are added.
26
+ #
27
+ # Please keep the grammars in alphabetical order by name from here and down.
28
+
29
+ "ar":
30
+ name: Arabic
31
+ native: العربية
32
+ encoding: UTF-8
33
+ feature: خاصية
34
+ background: الخلفية
35
+ scenario: سيناريو
36
+ scenario_outline: سيناريو مخطط
37
+ examples: امثلة
38
+ given: بفرض
39
+ when: متى|عندما
40
+ then: اذاً|ثم
41
+ and: و
42
+ but: لكن
43
+ "cy":
44
+ name: Welsh
45
+ native: Cymraeg
46
+ encoding: UTF-8
47
+ feature: Arwedd
48
+ scenario: Scenario
49
+ examples: Enghreifftiau
50
+ given: anrhegedig a
51
+ when: Pryd
52
+ then: Yna
53
+ and: A
54
+ but: Ond
55
+ "cz":
56
+ name: Czech
57
+ native: Česky
58
+ encoding: UTF-8
59
+ feature: Požadavek
60
+ background: Pozadí
61
+ scenario: Scénář
62
+ scenario_outline: Náčrt Scénáře
63
+ examples: Příklady
64
+ given: Pokud
65
+ when: Když
66
+ then: Pak
67
+ and: A
68
+ but: Ale
69
+ "da":
70
+ name: Danish
71
+ native: dansk
72
+ encoding: UTF-8
73
+ feature: Egenskab
74
+ background: Baggrund
75
+ scenario: Scenarie
76
+ scenario_outline: Abstrakt Scenario
77
+ examples: Eksempler
78
+ given: Givet
79
+ when: Når
80
+ then: Så
81
+ and: Og
82
+ but: Men
83
+ "de":
84
+ name: German
85
+ native: Deutsch
86
+ encoding: UTF-8
87
+ feature: Funktionalität
88
+ background: Grundlage
89
+ scenario: Szenario
90
+ scenario_outline: Szenariogrundriss
91
+ examples: Beispiele
92
+ given: Gegeben sei
93
+ when: Wenn
94
+ then: Dann
95
+ and: Und
96
+ but: Aber
97
+ "en-lol":
98
+ name: LOLCAT
99
+ native: LOLCAT
100
+ encoding: UTF-8
101
+ feature: OH HAI
102
+ background: B4
103
+ scenario: MISHUN
104
+ scenario_outline: MISHUN SRSLY
105
+ examples: EXAMPLZ
106
+ given: GIVN
107
+ when: WEN
108
+ then: DEN
109
+ and: AN
110
+ but: BUT
111
+ "en-tx":
112
+ name: Texan
113
+ native: Texan
114
+ encoding: UTF-8
115
+ feature: Feature
116
+ background: Background
117
+ scenario: Scenario
118
+ scenario_outline: Scenario Outline
119
+ examples: Examples
120
+ given: Given y'all
121
+ when: When y'all
122
+ then: Then y'all
123
+ and: And y'all
124
+ but: But y'all
125
+ "es":
126
+ name: Spanish
127
+ native: español
128
+ encoding: UTF-8
129
+ background: Antecedentes
130
+ feature: Característica
131
+ scenario: Escenario
132
+ scenario_outline: Esquema del escenario
133
+ examples: Ejemplos
134
+ given: Dado
135
+ when: Cuando
136
+ then: Entonces
137
+ and: Y
138
+ but: Pero
139
+ "et":
140
+ name: Estonian
141
+ native: eesti keel
142
+ encoding: UTF-8
143
+ feature: Omadus
144
+ background: Taust
145
+ scenario: Stsenaarium
146
+ scenario_outline: Raamstsenaarium
147
+ examples: Juhtumid
148
+ given: Eeldades
149
+ when: Kui
150
+ then: Siis
151
+ and: Ja
152
+ but: Kuid
153
+ "fi":
154
+ name: Finnish
155
+ native: suomi
156
+ encoding: UTF-8
157
+ feature: Ominaisuus
158
+ background: Tausta
159
+ scenario: Tapaus
160
+ scenario_outline: Tapausaihio
161
+ examples: Tapaukset
162
+ given: Oletetaan
163
+ when: Kun
164
+ then: Niin
165
+ and: Ja
166
+ but: Mutta
167
+ "fr":
168
+ name: French
169
+ native: français
170
+ encoding: UTF-8
171
+ feature: Fonctionnalité
172
+ background: Contexte
173
+ scenario: Scénario
174
+ scenario_outline: Plan du Scénario
175
+ examples: Exemples
176
+ given: Soit
177
+ when: Lorsque
178
+ then: Alors
179
+ and: Et
180
+ but: Mais
181
+ "id":
182
+ name: Indonesian
183
+ native: Bahasa Indonesia
184
+ encoding: UTF-8
185
+ feature: Fitur
186
+ scenario: Skenario
187
+ scenario_outline: Skenario konsep
188
+ examples: Contoh
189
+ given: Dengan
190
+ when: Ketika
191
+ then: Maka
192
+ and: Dan
193
+ but: Tapi
194
+ "it":
195
+ name: Italian
196
+ native: italiano
197
+ encoding: UTF-8
198
+ feature: Funzionalità
199
+ scenario: Scenario
200
+ more_examples: Più esempi
201
+ given: Dato
202
+ when: Quando
203
+ then: Allora
204
+ and: E
205
+ but: Ma
206
+ "ja":
207
+ name: Japanese
208
+ native: 日本語
209
+ encoding: UTF-8
210
+ feature: フィーチャ
211
+ background: 背景
212
+ scenario: シナリオ
213
+ scenario_outline: シナリオテンプレート|テンプレ|シナリオテンプレ
214
+ examples: 例|サンプル
215
+ given: 前提
216
+ when: もし
217
+ then: ならば
218
+ and: かつ
219
+ but: しかし
220
+ "lt":
221
+ name: Lithuanian
222
+ native: lietuvių kalba
223
+ encoding: UTF-8
224
+ feature: Sąvybė
225
+ scenario: Scenarijus
226
+ examples: Pavyzdžių
227
+ given: Duota
228
+ when: Kai
229
+ then: Tada
230
+ and: Ir
231
+ but: Bet
232
+ "nl":
233
+ name: Dutch
234
+ native: Nederlands
235
+ encoding: UTF-8
236
+ feature: Functionaliteit
237
+ scenario: Scenario
238
+ given: Gegeven
239
+ when: Als
240
+ then: Dan
241
+ and: En
242
+ but: Maar
243
+ "no":
244
+ name: Norwegian
245
+ native: norsk
246
+ encoding: UTF-8
247
+ feature: Egenskap
248
+ background: Bakgrunn
249
+ scenario: Scenario
250
+ scenario_outline: Abstrakt Scenario
251
+ examples: Eksempler
252
+ given: Gitt
253
+ when: Når
254
+ then: Så
255
+ and: Og
256
+ but: Men
257
+ "pl":
258
+ name: Polish
259
+ native: polski
260
+ encoding: UTF-8
261
+ feature: Właściwość
262
+ scenario: Scenariusz
263
+ given: Dane
264
+ when: Jeżeli
265
+ then: Wtedy
266
+ and: Oraz
267
+ but: Ale
268
+ "pt":
269
+ name: Portuguese
270
+ native: português
271
+ encoding: UTF-8
272
+ background: Contexto
273
+ feature: Característica
274
+ scenario: Cenário
275
+ scenario_outline: Esquema do Cenário
276
+ examples: Exemplos
277
+ given: Dado
278
+ when: Quando
279
+ then: Então
280
+ and: E
281
+ but: Mas
282
+ "ro":
283
+ name: Romanian
284
+ native: română
285
+ encoding: UTF-8
286
+ feature: Functionalitate
287
+ scenario: Scenariu
288
+ given: Daca
289
+ when: Cand
290
+ then: Atunci
291
+ and: Si
292
+ but: Dar
293
+ "ro2":
294
+ name: Romanian (diacritical)
295
+ native: română (diacritical)
296
+ encoding: UTF-8
297
+ feature: Funcționalitate
298
+ scenario: Scenariu
299
+ given: Dacă
300
+ when: Când
301
+ then: Atunci
302
+ and: Și
303
+ but: Dar
304
+ "ru":
305
+ name: Russian
306
+ native: русский
307
+ encoding: UTF-8
308
+ feature: Функционал
309
+ background: Предыстория
310
+ scenario: Сценарий
311
+ scenario_outline: Структура сценария
312
+ examples: Значения
313
+ given: Допустим
314
+ when: Если
315
+ then: То
316
+ and: И|К тому же
317
+ but: Но|А
318
+ "se":
319
+ name: Swedish
320
+ native: Svenska
321
+ encoding: UTF-8
322
+ feature: Egenskap
323
+ background: Bakgrund
324
+ scenario: Scenario
325
+ scenario_outline: Abstrakt Scenario
326
+ examples: Exempel
327
+ given: Givet
328
+ when: När
329
+ then: Så
330
+ and: Och
331
+ but: Men
332
+ "zh-CN":
333
+ name: Chinese simplified
334
+ native: 简体中文
335
+ encoding: UTF-8
336
+ feature: 功能
337
+ background: 背景
338
+ scenario: 场景
339
+ scenario_outline: 场景大纲
340
+ examples: 例子
341
+ given: 假如
342
+ when: 当
343
+ then: 那么
344
+ and: 而且
345
+ but: 但是
346
+ "zh-TW":
347
+ name: Chinese traditional
348
+ native: 繁體中文
349
+ encoding: UTF-8
350
+ feature: 功能
351
+ background: 背景
352
+ scenario: 場景|劇本
353
+ scenario_outline: 場景大綱|劇本大綱
354
+ examples: 例子
355
+ given: 假設
356
+ when: 當
357
+ then: 那麼
358
+ and: 而且|並且
359
+ but: 但是
360
+ "ko":
361
+ name: Korean
362
+ native: 한국어
363
+ encoding: UTF-8
364
+ background: 배경
365
+ feature: 기능
366
+ scenario: 시나리오
367
+ scenario_outline: 시나리오 개요
368
+ examples: 예
369
+ more_examples: 다른 예
370
+ given: 조건
371
+ when: 만일
372
+ then: 그러면
373
+ and: 그리고
374
+ but: 하지만