kosmas58-cucumber 0.1.16.6 → 0.1.99.21
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/History.txt +126 -2
- data/License.txt +1 -1
- data/Manifest.txt +0 -270
- data/Rakefile +1 -1
- data/bin/cucumber +2 -2
- data/config/hoe.rb +7 -2
- data/examples/cs/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/README.textile +1 -1
- data/examples/i18n/Rakefile +3 -3
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -6
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/de/features/addition.feature +6 -6
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/en/features/addition.feature +6 -6
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/es/features/adicion.feature +11 -12
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +7 -10
- data/examples/i18n/es/lib/calculador.rb +4 -1
- data/examples/i18n/et/features/liitmine.feature +7 -6
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -1
- data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +1 -1
- data/examples/i18n/fi/features/yhteenlasku.feature +2 -2
- data/examples/i18n/fr/features/addition.feature +2 -2
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
- data/examples/i18n/id/features/addition.feature +6 -6
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -3
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/features/addition.feature +7 -6
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +7 -7
- data/examples/i18n/no/features/summering.feature +1 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/java/src/cucumber/demo/Hello.java +16 -0
- data/examples/jbehave/README.textile +17 -0
- data/examples/jbehave/features/support/env.rb +7 -0
- data/examples/jbehave/features/trading.feature +24 -0
- data/examples/jbehave/pom.xml +48 -0
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +32 -0
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +42 -0
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +29 -0
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +22 -0
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +65 -0
- data/examples/self_test/README.textile +4 -1
- data/examples/{calculator_ruby_features → self_test}/Rakefile +3 -3
- data/examples/self_test/features/background/failing_background.feature +10 -0
- data/examples/self_test/features/background/failing_background_after_success.feature +11 -0
- data/examples/self_test/features/background/multiline_args_background.feature +32 -0
- data/examples/self_test/features/background/passing_background.feature +10 -0
- data/examples/self_test/features/background/pending_background.feature +10 -0
- data/examples/self_test/features/background/scenario_outline_failing_background.feature +16 -0
- data/examples/self_test/features/background/scenario_outline_passing_background.feature +16 -0
- data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
- data/examples/self_test/features/lots_of_undefined.feature +8 -0
- data/examples/self_test/features/outline_sample.feature +11 -5
- data/examples/self_test/features/sample.feature +8 -3
- data/examples/self_test/features/step_definitions/sample_steps.rb +53 -4
- data/examples/self_test/features/support/env.rb +1 -0
- data/examples/self_test/features/support/tag_count_formatter.rb +25 -0
- data/examples/tickets/features/172.feature +28 -0
- data/examples/tickets/features/177/1.feature +29 -0
- data/examples/tickets/features/177/2.feature +21 -0
- data/examples/tickets/features/177/3.feature +18 -0
- data/examples/tickets/features/180.feature +7 -0
- data/examples/tickets/features/scenario_outline.feature +6 -1
- data/examples/tickets/features/step_definitons/tickets_steps.rb +27 -3
- data/examples/tickets/features/tickets.feature +4 -0
- data/features/background.feature +223 -0
- data/features/cucumber_cli.feature +218 -98
- data/features/cucumber_cli_outlines.feature +54 -37
- data/features/custom_formatter.feature +11 -0
- data/features/report_called_undefined_steps.feature +32 -0
- data/features/step_definitions/cucumber_steps.rb +7 -3
- data/features/step_definitions/extra_steps.rb +1 -1
- data/features/support/env.rb +2 -1
- data/gem_tasks/flog.rake +1 -1
- data/gem_tasks/gemspec.rake +2 -2
- data/gem_tasks/jar.rake +67 -0
- data/lib/autotest/cucumber_mixin.rb +17 -23
- data/lib/cucumber.rb +63 -11
- data/lib/cucumber/ast.rb +29 -0
- data/lib/cucumber/ast/background.rb +88 -0
- data/lib/cucumber/ast/comment.rb +26 -0
- data/lib/cucumber/ast/examples.rb +26 -0
- data/lib/cucumber/ast/feature.rb +66 -0
- data/lib/cucumber/ast/features.rb +39 -0
- data/lib/cucumber/ast/filter.rb +22 -0
- data/lib/cucumber/ast/outline_table.rb +49 -0
- data/lib/cucumber/ast/py_string.rb +52 -0
- data/lib/cucumber/ast/scenario.rb +103 -0
- data/lib/cucumber/ast/scenario_outline.rb +92 -0
- data/lib/cucumber/ast/step.rb +161 -0
- data/lib/cucumber/ast/steps.rb +13 -0
- data/lib/cucumber/ast/table.rb +218 -0
- data/lib/cucumber/ast/tags.rb +40 -0
- data/lib/cucumber/ast/visitor.rb +109 -0
- data/lib/cucumber/broadcaster.rb +1 -6
- data/lib/cucumber/cli/configuration.rb +339 -0
- data/lib/cucumber/cli/language_help_formatter.rb +59 -0
- data/lib/cucumber/cli/main.rb +100 -0
- data/lib/cucumber/core_ext/exception.rb +41 -8
- data/lib/cucumber/core_ext/instance_exec.rb +54 -0
- data/lib/cucumber/core_ext/proc.rb +29 -65
- data/lib/cucumber/core_ext/string.rb +19 -0
- data/lib/cucumber/formatter.rb +1 -0
- data/lib/cucumber/{formatters → formatter}/ansicolor.rb +14 -16
- data/lib/cucumber/formatter/color_io.rb +17 -0
- data/lib/cucumber/formatter/console.rb +119 -0
- data/lib/cucumber/formatter/cucumber.css +55 -0
- data/lib/cucumber/formatter/cucumber.sass +49 -0
- data/lib/cucumber/formatter/html.rb +121 -0
- data/lib/cucumber/formatter/pretty.rb +167 -0
- data/lib/cucumber/formatter/profile.rb +77 -0
- data/lib/cucumber/formatter/progress.rb +68 -0
- data/lib/cucumber/formatter/rerun.rb +35 -0
- data/lib/cucumber/formatter/unicode.rb +35 -0
- data/lib/cucumber/formatters/unicode.rb +2 -35
- data/lib/cucumber/jbehave.rb +102 -0
- data/lib/cucumber/languages.yml +128 -75
- data/lib/cucumber/parser.rb +43 -0
- data/lib/cucumber/parser/basic.rb +0 -0
- data/lib/cucumber/parser/feature.rb +1490 -0
- data/lib/cucumber/parser/feature.tt +188 -0
- data/lib/cucumber/parser/i18n.tt +31 -0
- data/lib/cucumber/parser/table.rb +402 -0
- data/lib/cucumber/parser/table.tt +59 -0
- data/lib/cucumber/parser/treetop_ext.rb +75 -0
- data/lib/cucumber/platform.rb +3 -17
- data/lib/cucumber/rails/rspec.rb +5 -2
- data/lib/cucumber/step_definition.rb +87 -0
- data/lib/cucumber/step_mother.rb +151 -66
- data/lib/cucumber/version.rb +2 -2
- data/rails_generators/cucumber/USAGE +3 -2
- data/rails_generators/cucumber/cucumber_generator.rb +33 -23
- data/rails_generators/cucumber/templates/cucumber +2 -1
- data/rails_generators/cucumber/templates/cucumber.rake +6 -1
- data/rails_generators/cucumber/templates/env.rb +1 -1
- data/rails_generators/feature/USAGE +3 -0
- data/rails_generators/feature/feature_generator.rb +30 -6
- data/spec/cucumber/ast/background_spec.rb +58 -0
- data/spec/cucumber/ast/feature_factory.rb +54 -0
- data/spec/cucumber/ast/feature_spec.rb +60 -0
- data/spec/cucumber/ast/py_string_spec.rb +40 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
- data/spec/cucumber/ast/scenario_spec.rb +82 -0
- data/spec/cucumber/ast/step_spec.rb +45 -0
- data/spec/cucumber/ast/table_spec.rb +81 -0
- data/spec/cucumber/ast/tags_spec.rb +23 -0
- data/spec/cucumber/broadcaster_spec.rb +4 -17
- data/spec/cucumber/cli/configuration_spec.rb +239 -0
- data/spec/cucumber/cli/main_spec.rb +164 -0
- data/spec/cucumber/core_ext/proc_spec.rb +27 -35
- data/spec/cucumber/core_ext/string_spec.rb +8 -0
- data/spec/cucumber/{formatters → formatter}/ansicolor_spec.rb +2 -2
- data/spec/cucumber/formatter/html/cucumber.css +37 -0
- data/spec/cucumber/formatter/html/cucumber.js +13 -0
- data/spec/cucumber/formatter/html/index.html +45 -0
- data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
- data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
- data/spec/cucumber/formatters/profile_formatter_spec.rb +17 -16
- data/spec/cucumber/parser/feature_parser_spec.rb +281 -0
- data/spec/cucumber/parser/table_parser_spec.rb +48 -0
- data/spec/cucumber/step_definition_spec.rb +62 -0
- data/spec/cucumber/step_mother_spec.rb +50 -51
- data/spec/cucumber/treetop_parser/empty_feature.feature +1 -1
- data/spec/cucumber/treetop_parser/scenario_outline.feature +1 -1
- data/spec/cucumber/treetop_parser/spaces.feature +3 -1
- data/spec/cucumber/treetop_parser/with_comments.feature +1 -1
- data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
- data/spec/cucumber/world/pending_spec.rb +13 -12
- data/spec/spec_helper.rb +1 -1
- metadata +107 -79
- data/examples/calculator_ruby_features/features/addition.rb +0 -39
- data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +0 -43
- data/gem_tasks/treetop.rake +0 -41
- data/lib/cucumber/cli.rb +0 -355
- data/lib/cucumber/executor.rb +0 -205
- data/lib/cucumber/formatters.rb +0 -1
- data/lib/cucumber/formatters/autotest_formatter.rb +0 -23
- data/lib/cucumber/formatters/cucumber.css +0 -132
- data/lib/cucumber/formatters/cucumber.js +0 -11
- data/lib/cucumber/formatters/html_formatter.rb +0 -152
- data/lib/cucumber/formatters/jquery.js +0 -32
- data/lib/cucumber/formatters/pretty_formatter.rb +0 -285
- data/lib/cucumber/formatters/profile_formatter.rb +0 -92
- data/lib/cucumber/formatters/progress_formatter.rb +0 -61
- data/lib/cucumber/model.rb +0 -1
- data/lib/cucumber/model/table.rb +0 -32
- data/lib/cucumber/step_methods.rb +0 -49
- data/lib/cucumber/tree.rb +0 -16
- data/lib/cucumber/tree/feature.rb +0 -105
- data/lib/cucumber/tree/features.rb +0 -21
- data/lib/cucumber/tree/given_scenario.rb +0 -13
- data/lib/cucumber/tree/scenario.rb +0 -240
- data/lib/cucumber/tree/step.rb +0 -173
- data/lib/cucumber/tree/table.rb +0 -26
- data/lib/cucumber/tree/top_down_visitor.rb +0 -23
- data/lib/cucumber/treetop_parser/feature.treetop.erb +0 -254
- data/lib/cucumber/treetop_parser/feature_ar.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_cy.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_da.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_de.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en-lol.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_es.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_et.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_fi.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_fr.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_id.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_it.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ja.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ko.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_lt.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_nl.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_no.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_parser.rb +0 -36
- data/lib/cucumber/treetop_parser/feature_pl.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_pt.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ro.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ro2.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ru.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_se.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +0 -1951
- data/lib/cucumber/world.rb +0 -1
- data/lib/cucumber/world/pending.rb +0 -22
- data/setup.rb +0 -1585
- data/spec/cucumber/cli_spec.rb +0 -521
- data/spec/cucumber/executor_spec.rb +0 -382
- data/spec/cucumber/formatters/autotest_formatter_spec.rb +0 -26
- data/spec/cucumber/formatters/features.html +0 -269
- data/spec/cucumber/formatters/html_formatter_spec.rb +0 -110
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +0 -410
- data/spec/cucumber/formatters/progress_formatter_spec.rb +0 -81
- data/spec/cucumber/model/table_spec.rb +0 -32
- data/spec/cucumber/tree/feature_spec.rb +0 -122
- data/spec/cucumber/tree/row_scenario_outline_spec.rb +0 -73
- data/spec/cucumber/tree/row_scenario_spec.rb +0 -55
- data/spec/cucumber/tree/row_step_outline_spec.rb +0 -38
- data/spec/cucumber/tree/scenario_outline_spec.rb +0 -50
- data/spec/cucumber/tree/scenario_spec.rb +0 -134
- data/spec/cucumber/tree/step_outline_spec.rb +0 -17
- data/spec/cucumber/tree/step_spec.rb +0 -59
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +0 -120
@@ -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
|
@@ -1,35 +1,2 @@
|
|
1
|
-
#
|
2
|
-
require 'cucumber/
|
3
|
-
require 'cucumber/formatters/ansicolor'
|
4
|
-
|
5
|
-
$KCODE='u' unless Cucumber::RUBY_1_9
|
6
|
-
|
7
|
-
if Cucumber::WINDOWS_MRI && `chcp` =~ /Active code page: (\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
|
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
|
data/lib/cucumber/languages.yml
CHANGED
@@ -1,16 +1,20 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
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
|
+
#
|
7
9
|
"en":
|
10
|
+
name: English
|
11
|
+
native: English
|
12
|
+
encoding: UTF-8
|
8
13
|
feature: Feature
|
14
|
+
background: Background
|
9
15
|
scenario: Scenario
|
10
16
|
scenario_outline: Scenario Outline
|
11
|
-
examples: Examples
|
12
|
-
more_examples: More Examples
|
13
|
-
given_scenario: GivenScenario
|
17
|
+
examples: Examples|Scenarios
|
14
18
|
given: Given
|
15
19
|
when: When
|
16
20
|
then: Then
|
@@ -20,267 +24,316 @@
|
|
20
24
|
# that is missing a keyword will expect the English word until the missing word(s)
|
21
25
|
# are added.
|
22
26
|
#
|
23
|
-
# Please keep the grammars in alphabetical order from here and down.
|
27
|
+
# Please keep the grammars in alphabetical order by name from here and down.
|
24
28
|
|
25
|
-
# Arabic
|
26
29
|
"ar":
|
30
|
+
name: Arabic
|
31
|
+
native: العربية
|
32
|
+
encoding: UTF-8
|
27
33
|
feature: خاصية
|
28
34
|
scenario: سيناريو
|
29
|
-
more_examples: امثلة اكثر
|
30
|
-
given_scenario: بفرض سيناريو معين
|
31
35
|
given: بفرض
|
32
36
|
when: متى
|
33
37
|
then: اذاً
|
34
38
|
and: و
|
35
39
|
but: لكن
|
36
|
-
# Welsh
|
37
40
|
"cy":
|
41
|
+
name: Welsh
|
42
|
+
native: Cymraeg
|
43
|
+
encoding: UTF-8
|
38
44
|
feature: Arwedd
|
39
45
|
scenario: Scenario
|
40
|
-
|
41
|
-
given_scenario: Anrhegedig scenario
|
46
|
+
examples: Enghreifftiau
|
42
47
|
given: anrhegedig a
|
43
48
|
when: Pryd
|
44
49
|
then: Yna
|
45
50
|
and: A
|
46
51
|
but: Ond
|
47
|
-
|
52
|
+
"cz":
|
53
|
+
name: Czech
|
54
|
+
native: Česky
|
55
|
+
encoding: UTF-8
|
56
|
+
feature: Požadavek
|
57
|
+
background: Pozadí
|
58
|
+
scenario: Scénář
|
59
|
+
scenario_outline: Náčrt Scénáře
|
60
|
+
examples: Příklady
|
61
|
+
given: Pokud
|
62
|
+
when: Když
|
63
|
+
then: Pak
|
64
|
+
and: A
|
65
|
+
but: Ale
|
48
66
|
"da":
|
67
|
+
name: Danish
|
68
|
+
native: dansk
|
69
|
+
encoding: UTF-8
|
49
70
|
feature: Egenskab
|
71
|
+
background: Baggrund
|
50
72
|
scenario: Scenarie
|
51
|
-
|
73
|
+
scenario_outline: Abstrakt Scenario
|
74
|
+
examples: Eksempler
|
52
75
|
given: Givet
|
53
76
|
when: Når
|
54
77
|
then: Så
|
55
78
|
and: Og
|
56
79
|
but: Men
|
57
|
-
# German
|
58
80
|
"de":
|
81
|
+
name: German
|
82
|
+
native: Deutsch
|
83
|
+
encoding: UTF-8
|
59
84
|
feature: Funktionalität
|
85
|
+
background: Grundlage
|
60
86
|
scenario: Szenario
|
61
87
|
scenario_outline: Szenariogrundriss
|
62
88
|
examples: Beispiele
|
63
|
-
more_examples: Mehr Beispiele
|
64
|
-
given_scenario: Gegebenes Szenario
|
65
89
|
given: Gegeben sei
|
66
90
|
when: Wenn
|
67
91
|
then: Dann
|
68
92
|
and: Und
|
69
93
|
but: Aber
|
70
|
-
# LOLCAT
|
71
94
|
"en-lol":
|
95
|
+
name: LOLCAT
|
96
|
+
native: LOLCAT
|
97
|
+
encoding: UTF-8
|
72
98
|
feature: OH HAI
|
99
|
+
background: B4
|
73
100
|
scenario: MISHUN
|
74
|
-
|
75
|
-
|
101
|
+
scenario_outline: MISHUN SRSLY
|
102
|
+
examples: EXAMPLZ
|
76
103
|
given: GIVN
|
77
104
|
when: WEN
|
78
105
|
then: DEN
|
79
106
|
and: AN
|
80
107
|
but: BUT
|
81
|
-
# Texan
|
82
108
|
"en-tx":
|
109
|
+
name: Texan
|
110
|
+
native: Texan
|
111
|
+
encoding: UTF-8
|
83
112
|
feature: Feature
|
84
113
|
scenario: Scenario
|
85
|
-
|
86
|
-
|
114
|
+
scenario_outline: Scenario Outline
|
115
|
+
examples: Examples
|
87
116
|
given: Given y'all
|
88
117
|
when: When y'all
|
89
118
|
then: Then y'all
|
90
119
|
and: And y'all
|
91
120
|
but: But y'all
|
92
|
-
# Spanish
|
93
121
|
"es":
|
122
|
+
name: Spanish
|
123
|
+
native: español
|
124
|
+
encoding: UTF-8
|
125
|
+
background: Antecedentes
|
94
126
|
feature: Característica
|
95
127
|
scenario: Escenario
|
96
|
-
|
97
|
-
|
128
|
+
scenario_outline: Esquema del escenario
|
129
|
+
examples: Ejemplos
|
98
130
|
given: Dado
|
99
131
|
when: Cuando
|
100
132
|
then: Entonces
|
101
133
|
and: Y
|
102
134
|
but: Pero
|
103
|
-
# Estonian
|
104
135
|
"et":
|
136
|
+
name: Estonian
|
137
|
+
native: eesti keel
|
138
|
+
encoding: UTF-8
|
105
139
|
feature: Omadus
|
106
140
|
scenario: Stsenaarium
|
107
|
-
given_scenario: EeldadesStsenaariumit
|
108
141
|
given: Eeldades
|
109
142
|
when: Kui
|
110
143
|
then: Siis
|
111
144
|
and: Ja
|
112
145
|
but: Kuid
|
113
|
-
# Finnish
|
114
146
|
"fi":
|
147
|
+
name: Finnish
|
148
|
+
native: suomi
|
149
|
+
encoding: UTF-8
|
115
150
|
feature: Ominaisuus
|
116
151
|
scenario: Tapaus
|
117
152
|
scenario_outline: Tapausaihio
|
118
153
|
examples: Tapaukset
|
119
|
-
more_examples: Lisätapaukset
|
120
|
-
given_scenario: Oletetaan tapaus
|
121
154
|
given: Oletetaan
|
122
155
|
when: Kun
|
123
156
|
then: Niin
|
124
157
|
and: Ja
|
125
158
|
but: Mutta
|
126
|
-
# French
|
127
159
|
"fr":
|
160
|
+
name: French
|
161
|
+
native: français
|
162
|
+
encoding: UTF-8
|
128
163
|
feature: Fonctionnalité
|
129
164
|
scenario: Scénario
|
130
|
-
|
131
|
-
|
165
|
+
scenario_outline: Scénario esquisse
|
166
|
+
examples: Exemples
|
132
167
|
given: Etant donné
|
133
168
|
when: Lorsque
|
134
169
|
then: Alors
|
135
170
|
and: Et
|
136
171
|
but: Mais
|
137
|
-
# Malay
|
138
172
|
"id":
|
173
|
+
name: Indonesian
|
174
|
+
native: Bahasa Indonesia
|
175
|
+
encoding: UTF-8
|
139
176
|
feature: Fitur
|
140
177
|
scenario: Skenario
|
141
|
-
|
142
|
-
|
178
|
+
scenario_outline: Skenario konsep
|
179
|
+
examples: Contoh
|
143
180
|
given: Dengan
|
144
181
|
when: Ketika
|
145
182
|
then: Maka
|
146
183
|
and: Dan
|
147
184
|
but: Tapi
|
148
|
-
# Italian
|
149
185
|
"it":
|
186
|
+
name: Italian
|
187
|
+
native: italiano
|
188
|
+
encoding: UTF-8
|
150
189
|
feature: Funzionalità
|
151
190
|
scenario: Scenario
|
152
191
|
more_examples: Più esempi
|
153
|
-
given_scenario: DatoLoScenario
|
154
192
|
given: Dato
|
155
193
|
when: Quando
|
156
194
|
then: Allora
|
157
195
|
and: E
|
158
196
|
but: Ma
|
159
|
-
# Japanese
|
160
197
|
"ja":
|
198
|
+
name: Japanese
|
199
|
+
native: 日本語
|
200
|
+
encoding: Shift_JIS
|
161
201
|
feature: フィーチャ
|
162
202
|
scenario: シナリオ
|
163
203
|
more_examples: 他のサンプル
|
164
|
-
given_scenario: 前提シナリオ
|
165
204
|
given: 前提
|
166
205
|
when: もし
|
167
206
|
then: ならば
|
168
207
|
and: かつ
|
169
208
|
but: しかし
|
170
|
-
# Lithuanian
|
171
209
|
"lt":
|
210
|
+
name: Lithuanian
|
211
|
+
native: lietuvių kalba
|
212
|
+
encoding: UTF-8
|
172
213
|
feature: Sąvybė
|
173
214
|
scenario: Scenarijus
|
174
|
-
|
175
|
-
given_scenario: DuotasScenarijus
|
215
|
+
examples: Pavyzdžių
|
176
216
|
given: Duota
|
177
217
|
when: Kai
|
178
218
|
then: Tada
|
179
219
|
and: Ir
|
180
220
|
but: Bet
|
181
|
-
# Dutch
|
182
221
|
"nl":
|
222
|
+
name: Dutch
|
223
|
+
native: Nederlands
|
224
|
+
encoding: UTF-8
|
183
225
|
feature: Functionaliteit
|
184
226
|
scenario: Scenario
|
185
|
-
more_examples: Meer voorbeelden
|
186
|
-
given_scenario: GegevenScenario
|
187
227
|
given: Gegeven
|
188
228
|
when: Als
|
189
229
|
then: Dan
|
190
230
|
and: En
|
191
231
|
but: Maar
|
192
|
-
# Norwegian
|
193
232
|
"no":
|
233
|
+
name: Norwegian
|
234
|
+
native: norsk
|
235
|
+
encoding: UTF-8
|
194
236
|
feature: Egenskap
|
237
|
+
background: Bakgrunn
|
195
238
|
scenario: Scenario
|
196
|
-
|
197
|
-
|
239
|
+
scenario_outline: Abstrakt Scenario
|
240
|
+
examples: Eksempler
|
198
241
|
given: Gitt
|
199
242
|
when: Når
|
200
243
|
then: Så
|
201
244
|
and: Og
|
202
245
|
but: Men
|
203
|
-
# Polish
|
204
246
|
"pl":
|
247
|
+
name: Polish
|
248
|
+
native: polski
|
249
|
+
encoding: UTF-8
|
205
250
|
feature: Właściwość
|
206
251
|
scenario: Scenariusz
|
207
|
-
more_examples: WięcejPrzykładów
|
208
|
-
given_scenario: DanyScenariusz
|
209
252
|
given: Dane
|
210
253
|
when: Jeżeli
|
211
254
|
then: Wtedy
|
212
255
|
and: Oraz
|
213
256
|
but: Ale
|
214
|
-
# Portuguese
|
215
257
|
"pt":
|
258
|
+
name: Portuguese
|
259
|
+
native: português
|
260
|
+
encoding: UTF-8
|
261
|
+
background: Contexto
|
216
262
|
feature: Característica
|
217
263
|
scenario: Cenário
|
218
|
-
|
264
|
+
scenario_outline: Esquema do Cenário
|
265
|
+
examples: Exemplos
|
219
266
|
given: Dado
|
220
267
|
when: Quando
|
221
268
|
then: Então
|
222
269
|
and: E
|
223
270
|
but: Mas
|
224
|
-
# Romanian (without diacritics - the commonly used)
|
225
271
|
"ro":
|
272
|
+
name: Romanian
|
273
|
+
native: română
|
274
|
+
encoding: UTF-8
|
226
275
|
feature: Functionalitate
|
227
276
|
scenario: Scenariu
|
228
|
-
more_examples: Mai multe exemple
|
229
|
-
given_scenario: ScenariuDat
|
230
277
|
given: Daca
|
231
278
|
when: Cand
|
232
279
|
then: Atunci
|
233
280
|
and: Si
|
234
281
|
but: Dar
|
235
|
-
# Romanian (with diacritics - not commonly used)
|
236
282
|
"ro2":
|
283
|
+
name: Romanian (diacritical)
|
284
|
+
native: română (diacritical)
|
285
|
+
encoding: UTF-8
|
237
286
|
feature: Funcționalitate
|
238
287
|
scenario: Scenariu
|
239
|
-
more_examples: Mai multe exemple
|
240
|
-
given_scenario: ScenariuDat
|
241
288
|
given: Dacă
|
242
289
|
when: Când
|
243
290
|
then: Atunci
|
244
291
|
and: Și
|
245
292
|
but: Dar
|
246
|
-
# Russian
|
247
293
|
"ru":
|
294
|
+
name: Russian
|
295
|
+
native: русский язык
|
296
|
+
encoding: UTF-8
|
248
297
|
feature: Функционал
|
249
298
|
scenario: Сценарий
|
250
|
-
given_scenario: ДанныйСценарий
|
251
299
|
given: Сначала
|
252
300
|
when: Если
|
253
301
|
then: То
|
254
302
|
and: И
|
255
303
|
but: Но
|
256
|
-
# Swedish
|
257
304
|
"se":
|
305
|
+
name: Swedish
|
306
|
+
native: Svenska
|
307
|
+
encoding: UTF-8
|
258
308
|
feature: Egenskap
|
309
|
+
background: Bakgrund
|
259
310
|
scenario: Scenario
|
260
|
-
|
311
|
+
scenario_outline: Abstrakt Scenario
|
312
|
+
examples: Exempel
|
261
313
|
given: Givet
|
262
314
|
when: När
|
263
315
|
then: Så
|
264
316
|
and: Och
|
265
317
|
but: Men
|
266
|
-
# Chinese simplified
|
267
318
|
"zh-CN":
|
319
|
+
name: Chinese simplified
|
320
|
+
native: 中文
|
321
|
+
encoding: UTF-8
|
268
322
|
feature: 功能
|
269
323
|
scenario: 场景
|
270
|
-
given_scenario: 引用场景
|
271
324
|
given: 假如
|
272
325
|
when: 当
|
273
326
|
then: 那么
|
274
327
|
and: 而且
|
275
328
|
but: 但是
|
276
|
-
# Korean
|
277
329
|
"ko":
|
330
|
+
name: Korean
|
331
|
+
native: 한국어
|
332
|
+
encoding: UTF-8
|
278
333
|
feature: 기능
|
279
334
|
scenario: 예
|
280
|
-
more_examples: 다른 예
|
281
|
-
given_scenario: 주어진 예
|
282
335
|
given: 조건
|
283
336
|
when: 만일
|
284
337
|
then: 그러면
|
285
338
|
and: 그리고
|
286
|
-
but: 하지만
|
339
|
+
but: 하지만
|