aslakhellesoy-cucumber 0.1.99.3 → 0.1.99.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +6 -0
- metadata +1 -1
- data/cucumber.yml +0 -1
- data/examples/cs/README.textile +0 -1
- data/examples/cs/Rakefile +0 -12
- data/examples/cs/compile.bat +0 -1
- data/examples/cs/features/addition.feature +0 -16
- data/examples/cs/features/step_definitons/calculator_steps.rb +0 -19
- data/examples/cs/src/demo/Calculator.cs +0 -20
- data/examples/dos_line_endings/Rakefile +0 -6
- data/examples/dos_line_endings/features/dos_line_endings.feature +0 -9
- data/examples/i18n/README.textile +0 -18
- data/examples/i18n/Rakefile +0 -32
- data/examples/i18n/ar/Rakefile +0 -6
- data/examples/i18n/ar/features/addition.feature +0 -17
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +0 -28
- data/examples/i18n/ar/lib/calculator.rb +0 -10
- data/examples/i18n/da/Rakefile +0 -6
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +0 -24
- data/examples/i18n/da/features/summering.feature +0 -17
- data/examples/i18n/da/lib/kalkulator.rb +0 -11
- data/examples/i18n/de/Rakefile +0 -6
- data/examples/i18n/de/features/addition.feature +0 -16
- data/examples/i18n/de/features/division.feature +0 -9
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +0 -24
- data/examples/i18n/de/lib/calculator.rb +0 -14
- data/examples/i18n/en/Rakefile +0 -6
- data/examples/i18n/en/features/addition.feature +0 -16
- data/examples/i18n/en/features/division.feature +0 -9
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +0 -24
- data/examples/i18n/en/lib/calculator.rb +0 -14
- data/examples/i18n/es/Rakefile +0 -6
- data/examples/i18n/es/features/adicion.feature +0 -17
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +0 -24
- data/examples/i18n/es/lib/calculador.rb +0 -11
- data/examples/i18n/et/Rakefile +0 -6
- data/examples/i18n/et/features/liitmine.feature +0 -17
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +0 -24
- data/examples/i18n/et/lib/kalkulaator.rb +0 -10
- data/examples/i18n/fi/Rakefile +0 -6
- data/examples/i18n/fi/features/jakolasku.feature +0 -9
- data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +0 -24
- data/examples/i18n/fi/features/yhteenlasku.feature +0 -16
- data/examples/i18n/fi/lib/laskin.rb +0 -14
- data/examples/i18n/fr/Rakefile +0 -6
- data/examples/i18n/fr/features/addition.feature +0 -15
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +0 -27
- data/examples/i18n/fr/lib/calculatrice.rb +0 -10
- data/examples/i18n/id/Rakefile +0 -6
- data/examples/i18n/id/features/addition.feature +0 -16
- data/examples/i18n/id/features/division.feature +0 -9
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +0 -24
- data/examples/i18n/id/lib/calculator.rb +0 -14
- data/examples/i18n/it/Rakefile +0 -6
- data/examples/i18n/it/features/somma.feature +0 -10
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +0 -24
- data/examples/i18n/it/lib/calcolatrice.rb +0 -11
- data/examples/i18n/ja/README.txt +0 -5
- data/examples/i18n/ja/Rakefile +0 -6
- data/examples/i18n/ja/features/addition.feature +0 -16
- data/examples/i18n/ja/features/division.feature +0 -9
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +0 -24
- data/examples/i18n/ja/lib/calculator.rb +0 -14
- data/examples/i18n/ko/Rakefile +0 -6
- data/examples/i18n/ko/features/addition.feature +0 -16
- data/examples/i18n/ko/features/division.feature +0 -10
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +0 -24
- data/examples/i18n/ko/lib/calculator.rb +0 -14
- data/examples/i18n/lt/Rakefile +0 -6
- data/examples/i18n/lt/features/addition.feature +0 -17
- data/examples/i18n/lt/features/division.feature +0 -9
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +0 -24
- data/examples/i18n/lt/lib/calculator.rb +0 -14
- data/examples/i18n/no/Rakefile +0 -6
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +0 -24
- data/examples/i18n/no/features/summering.feature +0 -18
- data/examples/i18n/no/lib/kalkulator.rb +0 -11
- data/examples/i18n/pt/Rakefile +0 -6
- data/examples/i18n/pt/features/adicao.feature +0 -10
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +0 -24
- data/examples/i18n/pt/lib/calculadora.rb +0 -10
- data/examples/i18n/ro/Rakefile +0 -6
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +0 -24
- data/examples/i18n/ro/features/suma.feature +0 -10
- data/examples/i18n/ro/lib/calculator.rb +0 -11
- data/examples/i18n/se/Rakefile +0 -6
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +0 -24
- data/examples/i18n/se/features/summering.feature +0 -17
- data/examples/i18n/se/lib/kalkulator.rb +0 -11
- data/examples/i18n/zh-CN/Rakefile +0 -6
- data/examples/i18n/zh-CN/features/addition.feature +0 -17
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +0 -26
- data/examples/i18n/zh-CN/lib/calculator.rb +0 -10
- data/examples/java/README.textile +0 -22
- data/examples/java/Rakefile +0 -12
- data/examples/java/features/hello.feature +0 -11
- data/examples/java/features/step_definitons/hello_steps.rb +0 -25
- data/examples/java/features/step_definitons/tree_steps.rb +0 -14
- data/examples/java/features/tree.feature +0 -9
- data/examples/jbehave/README.textile +0 -17
- data/examples/jbehave/features/support/env.rb +0 -7
- data/examples/jbehave/features/trading.feature +0 -24
- data/examples/jbehave/pom.xml +0 -48
- data/examples/selenium/Rakefile +0 -6
- data/examples/selenium/features/search.feature +0 -9
- data/examples/selenium/features/step_definitons/stories_steps.rb +0 -40
- data/examples/self_test/README.textile +0 -6
- data/examples/self_test/features/call_undefined_step_from_step_def.feature +0 -7
- data/examples/self_test/features/lots_of_undefined.feature +0 -8
- data/examples/self_test/features/outline_sample.feature +0 -12
- data/examples/self_test/features/sample.feature +0 -16
- data/examples/self_test/features/step_definitions/sample_steps.rb +0 -25
- data/examples/test_unit/Rakefile +0 -6
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +0 -26
- data/examples/test_unit/features/test_unit.feature +0 -9
- data/examples/tickets/Rakefile +0 -11
- data/examples/tickets/cucumber.yml +0 -2
- data/examples/tickets/features/lib/eatting_machine.rb +0 -18
- data/examples/tickets/features/lib/pantry.rb +0 -20
- data/examples/tickets/features/scenario_outline.feature +0 -90
- data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +0 -42
- data/examples/tickets/features/step_definitons/tickets_steps.rb +0 -61
- data/examples/tickets/features/tickets.feature +0 -28
- data/examples/watir/README.textile +0 -16
- data/examples/watir/Rakefile +0 -6
- data/examples/watir/features/search.feature +0 -9
- data/examples/watir/features/step_definitons/search_steps.rb +0 -24
- data/examples/watir/features/support/env.rb +0 -32
- data/features/cucumber_cli.feature +0 -327
- data/features/cucumber_cli_outlines.feature +0 -81
- data/features/report_called_undefined_steps.feature +0 -32
- data/features/step_definitions/cucumber_steps.rb +0 -31
- data/features/step_definitions/extra_steps.rb +0 -2
- data/features/support/env.rb +0 -7
- data/gem_tasks/deployment.rake +0 -11
- data/gem_tasks/environment.rake +0 -7
- data/gem_tasks/features.rake +0 -6
- data/gem_tasks/fix_cr_lf.rake +0 -10
- data/gem_tasks/flog.rake +0 -4
- data/gem_tasks/gemspec.rake +0 -10
- data/gem_tasks/rspec.rake +0 -35
- data/gem_tasks/yard.rake +0 -8
- data/lib/autotest/cucumber.rb +0 -6
- data/lib/autotest/cucumber_mixin.rb +0 -124
- data/lib/autotest/cucumber_rails.rb +0 -6
- data/lib/autotest/cucumber_rails_rspec.rb +0 -6
- data/lib/autotest/cucumber_rspec.rb +0 -6
- data/lib/autotest/discover.rb +0 -9
- data/lib/cucumber/ast/comment.rb +0 -26
- data/lib/cucumber/ast/examples.rb +0 -22
- data/lib/cucumber/ast/feature.rb +0 -60
- data/lib/cucumber/ast/features.rb +0 -39
- data/lib/cucumber/ast/filter.rb +0 -22
- data/lib/cucumber/ast/outline_table.rb +0 -49
- data/lib/cucumber/ast/py_string.rb +0 -52
- data/lib/cucumber/ast/scenario.rb +0 -95
- data/lib/cucumber/ast/scenario_outline.rb +0 -83
- data/lib/cucumber/ast/step.rb +0 -139
- data/lib/cucumber/ast/table.rb +0 -214
- data/lib/cucumber/ast/tags.rb +0 -33
- data/lib/cucumber/ast/visitor.rb +0 -93
- data/lib/cucumber/ast.rb +0 -27
- data/lib/cucumber/broadcaster.rb +0 -15
- data/lib/cucumber/cli.rb +0 -410
- data/lib/cucumber/core_ext/exception.rb +0 -53
- data/lib/cucumber/core_ext/instance_exec.rb +0 -54
- data/lib/cucumber/core_ext/proc.rb +0 -33
- data/lib/cucumber/core_ext/string.rb +0 -48
- data/lib/cucumber/formatter/ansicolor.rb +0 -106
- data/lib/cucumber/formatter/console.rb +0 -116
- data/lib/cucumber/formatter/pretty.rb +0 -158
- data/lib/cucumber/formatter/profile.rb +0 -77
- data/lib/cucumber/formatter/progress.rb +0 -68
- data/lib/cucumber/formatter/rerun.rb +0 -35
- data/lib/cucumber/formatter.rb +0 -1
- data/lib/cucumber/formatters/autotest_formatter.rb +0 -21
- 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/unicode.rb +0 -35
- data/lib/cucumber/jbehave.rb +0 -104
- data/lib/cucumber/languages.yml +0 -314
- data/lib/cucumber/parser/basic.rb +0 -0
- data/lib/cucumber/parser/feature.rb +0 -1315
- data/lib/cucumber/parser/feature.tt +0 -160
- data/lib/cucumber/parser/i18n.tt +0 -27
- data/lib/cucumber/parser/table.rb +0 -396
- data/lib/cucumber/parser/table.tt +0 -53
- data/lib/cucumber/parser/treetop_ext.rb +0 -67
- data/lib/cucumber/parser.rb +0 -24
- data/lib/cucumber/platform.rb +0 -18
- data/lib/cucumber/rails/rspec.rb +0 -5
- data/lib/cucumber/rails/world.rb +0 -73
- data/lib/cucumber/rake/task.rb +0 -106
- data/lib/cucumber/step_definition.rb +0 -87
- data/lib/cucumber/step_mother.rb +0 -164
- data/lib/cucumber/treetop_parser/feature_fi.rb +0 -1951
- data/lib/cucumber/version.rb +0 -10
- data/lib/cucumber.rb +0 -72
- data/pretty.txt +0 -486
- data/rails_generators/cucumber/USAGE +0 -11
- data/rails_generators/cucumber/cucumber_generator.rb +0 -31
- data/rails_generators/cucumber/templates/cucumber +0 -8
- data/rails_generators/cucumber/templates/cucumber.rake +0 -7
- data/rails_generators/cucumber/templates/env.rb +0 -16
- data/rails_generators/cucumber/templates/paths.rb +0 -12
- data/rails_generators/cucumber/templates/webrat_steps.rb +0 -99
- data/rails_generators/feature/USAGE +0 -12
- data/rails_generators/feature/feature_generator.rb +0 -36
- data/rails_generators/feature/templates/feature.erb +0 -31
- data/rails_generators/feature/templates/steps.erb +0 -24
- data/spec/cucumber/ast/feature_factory.rb +0 -54
- data/spec/cucumber/ast/feature_spec.rb +0 -60
- data/spec/cucumber/ast/py_string_spec.rb +0 -40
- data/spec/cucumber/ast/scenario_outline_spec.rb +0 -64
- data/spec/cucumber/ast/scenario_spec.rb +0 -82
- data/spec/cucumber/ast/step_spec.rb +0 -45
- data/spec/cucumber/ast/table_spec.rb +0 -81
- data/spec/cucumber/broadcaster_spec.rb +0 -14
- data/spec/cucumber/cli_spec.rb +0 -416
- data/spec/cucumber/core_ext/proc_spec.rb +0 -37
- data/spec/cucumber/core_ext/string_spec.rb +0 -42
- data/spec/cucumber/formatter/ansicolor_spec.rb +0 -35
- data/spec/cucumber/formatter/html/cucumber.css +0 -37
- data/spec/cucumber/formatter/html/cucumber.js +0 -11
- data/spec/cucumber/formatter/html/index.html +0 -45
- data/spec/cucumber/formatter/html/jquery-1.3.min.js +0 -19
- data/spec/cucumber/formatter/html/jquery.uitableedit.js +0 -100
- data/spec/cucumber/formatters/autotest_formatter_spec.rb +0 -27
- data/spec/cucumber/formatters/features.html +0 -269
- data/spec/cucumber/formatters/profile_formatter_spec.rb +0 -198
- data/spec/cucumber/parser/feature_parser_spec.rb +0 -247
- data/spec/cucumber/parser/table_parser_spec.rb +0 -48
- data/spec/cucumber/rails/stubs/mini_rails.rb +0 -18
- data/spec/cucumber/rails/stubs/test_help.rb +0 -1
- data/spec/cucumber/rails/world_spec.rb +0 -11
- data/spec/cucumber/sell_cucumbers.feature +0 -19
- data/spec/cucumber/step_definition_spec.rb +0 -62
- data/spec/cucumber/step_mom_spec.rb +0 -49
- data/spec/cucumber/treetop_parser/empty_feature.feature +0 -4
- data/spec/cucumber/treetop_parser/empty_scenario.feature +0 -9
- data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +0 -3
- data/spec/cucumber/treetop_parser/fit_scenario.feature +0 -8
- data/spec/cucumber/treetop_parser/given_scenario.feature +0 -9
- data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -7
- data/spec/cucumber/treetop_parser/multiline_steps.feature +0 -17
- data/spec/cucumber/treetop_parser/multiple_tables.feature +0 -27
- data/spec/cucumber/treetop_parser/scenario_outline.feature +0 -16
- data/spec/cucumber/treetop_parser/spaces.feature +0 -12
- data/spec/cucumber/treetop_parser/test_dos.feature +0 -25
- data/spec/cucumber/treetop_parser/with_comments.feature +0 -10
- data/spec/cucumber/treetop_parser/with_tags.feature +0 -18
- data/spec/cucumber/world/pending_spec.rb +0 -47
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -21
@@ -1,106 +0,0 @@
|
|
1
|
-
# Hack to work around Win32/Console, which bundles a licence-violating, outdated
|
2
|
-
# copy of term/ansicolor that doesn't implement Term::ANSIColor#coloring=.
|
3
|
-
# We want the official one!
|
4
|
-
gem 'term-ansicolor'
|
5
|
-
$LOAD_PATH.each{|path| $LOAD_PATH.unshift($LOAD_PATH.delete(path)) if path =~ /term-ansicolor/}
|
6
|
-
require 'term/ansicolor'
|
7
|
-
|
8
|
-
if Cucumber::WINDOWS_MRI
|
9
|
-
begin
|
10
|
-
require 'Win32/Console/ANSI'
|
11
|
-
rescue LoadError
|
12
|
-
STDERR.puts "You must gem install win32console to get coloured output on MRI/Windows"
|
13
|
-
Term::ANSIColor.coloring = false
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Term::ANSIColor.coloring = false if !STDOUT.tty? || (Cucumber::WINDOWS && !Cucumber::WINDOWS_MRI)
|
18
|
-
|
19
|
-
module Cucumber
|
20
|
-
module Formatter
|
21
|
-
# Defines aliases for coloured output. You can tweak the colours by defining
|
22
|
-
# a <tt>CUCUMBER_COLORS</tt> variable in your shell, very much like you can
|
23
|
-
# tweak the familiar POSIX command <tt>ls</tt> with
|
24
|
-
# <a href="http://mipsisrisc.com/rambling/2008/06/27/lscolorsls_colors-now-with-linux-support/">$LSCOLORS/$LS_COLORS</a>
|
25
|
-
#
|
26
|
-
# The colours that you can change are:
|
27
|
-
#
|
28
|
-
# * <tt>undefined</tt> - defaults to <tt>yellow</tt>
|
29
|
-
# * <tt>pending</tt> - defaults to <tt>yellow</tt>
|
30
|
-
# * <tt>pending_param</tt> - defaults to <tt>yellow,bold</tt>
|
31
|
-
# * <tt>failed</tt> - defaults to <tt>red</tt>
|
32
|
-
# * <tt>failed_param</tt> - defaults to <tt>red,bold</tt>
|
33
|
-
# * <tt>passed</tt> - defaults to <tt>green</tt>
|
34
|
-
# * <tt>passed_param</tt> - defaults to <tt>green,bold</tt>
|
35
|
-
# * <tt>outline</tt> - defaults to <tt>cyan</tt>
|
36
|
-
# * <tt>outline_param</tt> - defaults to <tt>cyan,bold</tt>
|
37
|
-
# * <tt>skipped</tt> - defaults to <tt>cyan</tt>
|
38
|
-
# * <tt>skipped_param</tt> - defaults to <tt>cyan,bold</tt>
|
39
|
-
# * <tt>comment</tt> - defaults to <tt>grey</tt>
|
40
|
-
# * <tt>tag</tt> - defaults to <tt>blue</tt>
|
41
|
-
#
|
42
|
-
# For instance, if your shell has a black background and a green font (like the
|
43
|
-
# "Homebrew" settings for OS X' Terminal.app), you may want to override passed
|
44
|
-
# steps to be white instead of green. Examples:
|
45
|
-
#
|
46
|
-
# export CUCUMBER_COLORS="passed=white"
|
47
|
-
# export CUCUMBER_COLORS="passed=white,bold:passed_param=white,bold,underline"
|
48
|
-
#
|
49
|
-
# (If you're on Windows, use SET instead of export).
|
50
|
-
# To see what colours and effects are available, just run this in your shell:
|
51
|
-
#
|
52
|
-
# ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Term::ANSIColor.attributes"
|
53
|
-
#
|
54
|
-
# Although not listed, you can also use <tt>grey</tt>
|
55
|
-
module ANSIColor
|
56
|
-
include Term::ANSIColor
|
57
|
-
|
58
|
-
# Not supported in Term::ANSIColor
|
59
|
-
def grey(m)
|
60
|
-
if ::Term::ANSIColor.coloring?
|
61
|
-
"\e[90m#{m}\e[0m"
|
62
|
-
else
|
63
|
-
m
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
ALIASES = Hash.new do |h,k|
|
68
|
-
if k.to_s =~ /(.*)_param/
|
69
|
-
h[$1] + ',bold'
|
70
|
-
end
|
71
|
-
end.merge({
|
72
|
-
'undefined' => 'yellow',
|
73
|
-
'pending' => 'yellow',
|
74
|
-
'failed' => 'red',
|
75
|
-
'passed' => 'green',
|
76
|
-
'thead' => 'cyan',
|
77
|
-
'outline' => 'cyan',
|
78
|
-
'skipped' => 'cyan',
|
79
|
-
'comment' => 'grey',
|
80
|
-
'tag' => 'blue'
|
81
|
-
})
|
82
|
-
|
83
|
-
if ENV['CUCUMBER_COLORS'] # Example: export CUCUMBER_COLORS="passed=red:failed=yellow"
|
84
|
-
ENV['CUCUMBER_COLORS'].split(':').each do |pair|
|
85
|
-
a = pair.split('=')
|
86
|
-
ALIASES[a[0]] = a[1]
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
ALIASES.each do |method, color|
|
91
|
-
unless method =~ /.*_param/
|
92
|
-
code = <<-EOF
|
93
|
-
def #{method}(string=nil, &proc)
|
94
|
-
#{ALIASES[method].split(",").join("(") + "(string, &proc" + ")" * ALIASES[method].split(",").length}
|
95
|
-
end
|
96
|
-
# This resets the colour to the non-param colour
|
97
|
-
def #{method}_param(string=nil, &proc)
|
98
|
-
#{ALIASES[method+'_param'].split(",").join("(") + "(string, &proc" + ")" * ALIASES[method+'_param'].split(",").length} + #{ALIASES[method].split(",").join(' + ')}
|
99
|
-
end
|
100
|
-
EOF
|
101
|
-
eval(code)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,116 +0,0 @@
|
|
1
|
-
require 'cucumber/formatter/ansicolor'
|
2
|
-
|
3
|
-
module Cucumber
|
4
|
-
module Formatter
|
5
|
-
module Console
|
6
|
-
extend ANSIColor
|
7
|
-
FORMATS = Hash.new{|hash, format| hash[format] = method(format).to_proc}
|
8
|
-
|
9
|
-
def format_step(keyword, step_name, status, step_definition, source_indent)
|
10
|
-
line = if step_definition # nil for :outline
|
11
|
-
comment = if source_indent
|
12
|
-
c = (' # ' + step_definition.file_colon_line).indent(source_indent)
|
13
|
-
format_string(c, :comment)
|
14
|
-
else
|
15
|
-
''
|
16
|
-
end
|
17
|
-
keyword + " " + step_definition.format_args(step_name, format_for(status, :param)) + comment
|
18
|
-
else
|
19
|
-
keyword + " " + step_name
|
20
|
-
end
|
21
|
-
format_string(line, status)
|
22
|
-
end
|
23
|
-
|
24
|
-
def format_string(string, status)
|
25
|
-
fmt = format_for(status)
|
26
|
-
if Proc === fmt
|
27
|
-
fmt.call(string)
|
28
|
-
else
|
29
|
-
fmt % string
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def print_undefined_scenarios(features)
|
34
|
-
elements = features.scenarios.select{|scenario| scenario.undefined?}
|
35
|
-
print_elements(elements, :undefined, 'scenarios')
|
36
|
-
end
|
37
|
-
|
38
|
-
def print_steps(features, status)
|
39
|
-
print_elements(features.steps[status], status, 'steps')
|
40
|
-
end
|
41
|
-
|
42
|
-
def print_elements(elements, status, kind)
|
43
|
-
if elements.any?
|
44
|
-
@io.puts(format_string("(::) #{status} #{kind} (::)", status))
|
45
|
-
@io.puts
|
46
|
-
@io.flush
|
47
|
-
end
|
48
|
-
|
49
|
-
elements.each_with_index do |element, i|
|
50
|
-
if status == :failed
|
51
|
-
print_exception(element.exception, 0)
|
52
|
-
else
|
53
|
-
@io.puts(format_string(element.backtrace_line, status))
|
54
|
-
end
|
55
|
-
@io.puts
|
56
|
-
@io.flush
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def print_counts(features)
|
61
|
-
@io.puts dump_count(features.scenarios.length, "scenario")
|
62
|
-
|
63
|
-
[:failed, :skipped, :undefined, :pending, :passed].each do |status|
|
64
|
-
if features.steps[status].any?
|
65
|
-
count_string = dump_count(features.steps[status].length, "step", status.to_s)
|
66
|
-
@io.puts format_string(count_string, status)
|
67
|
-
@io.flush
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def print_exception(e, indent)
|
73
|
-
status = Cucumber::EXCEPTION_STATUS[e.class]
|
74
|
-
@io.puts(format_string("#{e.message} (#{e.class})\n#{e.backtrace.join("\n")}".indent(indent), status))
|
75
|
-
end
|
76
|
-
|
77
|
-
def print_snippets(features, options)
|
78
|
-
return unless options[:snippets]
|
79
|
-
undefined = features.steps[:undefined]
|
80
|
-
return if undefined.empty?
|
81
|
-
snippets = undefined.map do |step|
|
82
|
-
step_name = StepMother::Undefined === step.exception ? step.exception.step_name : step.name
|
83
|
-
snippet = @step_mother.snippet_text(step.actual_keyword, step_name)
|
84
|
-
snippet
|
85
|
-
end.compact.uniq
|
86
|
-
|
87
|
-
text = "\nYou can implement step definitions for missing steps with these snippets:\n\n"
|
88
|
-
text += snippets.join("\n\n")
|
89
|
-
|
90
|
-
@io.puts format_string(text, :undefined)
|
91
|
-
@io.puts
|
92
|
-
@io.flush
|
93
|
-
end
|
94
|
-
|
95
|
-
private
|
96
|
-
|
97
|
-
def with_color
|
98
|
-
c = Term::ANSIColor.coloring?
|
99
|
-
Term::ANSIColor.coloring = @io.tty?
|
100
|
-
yield
|
101
|
-
Term::ANSIColor.coloring = c
|
102
|
-
end
|
103
|
-
|
104
|
-
def dump_count(count, what, state=nil)
|
105
|
-
[count, state, "#{what}#{count == 1 ? '' : 's'}"].compact.join(" ")
|
106
|
-
end
|
107
|
-
|
108
|
-
def format_for(*keys)
|
109
|
-
key = keys.join('_').to_sym
|
110
|
-
fmt = FORMATS[key]
|
111
|
-
raise "No format for #{key.inspect}: #{FORMATS.inspect}" if fmt.nil?
|
112
|
-
fmt
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
@@ -1,158 +0,0 @@
|
|
1
|
-
require 'cucumber/formatter/console'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Formatter
|
6
|
-
# This formatter prints features to plain text - exactly how they were parsed,
|
7
|
-
# just prettier. That means with proper indentation and alignment of table columns.
|
8
|
-
#
|
9
|
-
# If the output is STDOUT (and not a file), there are bright colours to watch too.
|
10
|
-
#
|
11
|
-
class Pretty < Ast::Visitor
|
12
|
-
include FileUtils
|
13
|
-
include Console
|
14
|
-
attr_writer :indent
|
15
|
-
|
16
|
-
def initialize(step_mother, io, options, delim='|')
|
17
|
-
super(step_mother)
|
18
|
-
@io = io
|
19
|
-
@options = options
|
20
|
-
@delim = delim
|
21
|
-
end
|
22
|
-
|
23
|
-
def visit_features(features)
|
24
|
-
super
|
25
|
-
print_summary(features) unless @options[:autoformat]
|
26
|
-
end
|
27
|
-
|
28
|
-
def visit_feature(feature)
|
29
|
-
@indent = 0
|
30
|
-
if @options[:autoformat]
|
31
|
-
file = File.join(@options[:autoformat], feature.file)
|
32
|
-
dir = File.dirname(file)
|
33
|
-
mkdir_p(dir) unless File.directory?(dir)
|
34
|
-
File.open(file, Cucumber.file_mode('w')) do |io|
|
35
|
-
@io = io
|
36
|
-
with_color do
|
37
|
-
feature.accept(self)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
else
|
41
|
-
with_color do
|
42
|
-
feature.accept(self)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def visit_comment(comment)
|
48
|
-
comment.accept(self)
|
49
|
-
end
|
50
|
-
|
51
|
-
def visit_comment_line(comment_line)
|
52
|
-
unless comment_line.blank?
|
53
|
-
@io.puts(comment_line.indent(@indent))
|
54
|
-
@io.flush
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def visit_tags(tags)
|
59
|
-
tags.accept(self)
|
60
|
-
if @indent == 1
|
61
|
-
@io.puts
|
62
|
-
@io.flush
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def visit_tag_name(tag_name)
|
67
|
-
tag = format_string("@#{tag_name}", :tag).indent(@indent)
|
68
|
-
@io.print(tag)
|
69
|
-
@io.flush
|
70
|
-
@indent = 1
|
71
|
-
end
|
72
|
-
|
73
|
-
def visit_feature_name(name)
|
74
|
-
@io.puts(name)
|
75
|
-
@io.puts
|
76
|
-
@io.flush
|
77
|
-
end
|
78
|
-
|
79
|
-
def visit_feature_element(feature_element)
|
80
|
-
@indent = 2
|
81
|
-
@last_undefined = feature_element.undefined?
|
82
|
-
feature_element.accept(self)
|
83
|
-
@io.puts
|
84
|
-
@io.flush
|
85
|
-
end
|
86
|
-
|
87
|
-
def visit_examples(examples)
|
88
|
-
examples.accept(self)
|
89
|
-
end
|
90
|
-
|
91
|
-
def visit_examples_name(keyword, name)
|
92
|
-
@io.puts("\n #{keyword} #{name}")
|
93
|
-
@io.flush
|
94
|
-
@indent = 4
|
95
|
-
end
|
96
|
-
|
97
|
-
def visit_scenario_name(keyword, name, file_line, source_indent)
|
98
|
-
line = " #{keyword} #{name}"
|
99
|
-
line = format_string(line, :undefined) if @last_undefined
|
100
|
-
@io.print(line)
|
101
|
-
if @options[:source]
|
102
|
-
line_comment = " # #{file_line}".indent(source_indent)
|
103
|
-
@io.print(format_string(line_comment, :comment))
|
104
|
-
end
|
105
|
-
@io.puts
|
106
|
-
@io.flush
|
107
|
-
end
|
108
|
-
|
109
|
-
def visit_step(step)
|
110
|
-
@indent = 6
|
111
|
-
exception = step.accept(self)
|
112
|
-
print_exception(exception, @indent) if exception
|
113
|
-
end
|
114
|
-
|
115
|
-
def visit_step_name(keyword, step_name, status, step_definition, source_indent)
|
116
|
-
source_indent = nil unless @options[:source]
|
117
|
-
formatted_step_name = format_step(keyword, step_name, status, step_definition, source_indent)
|
118
|
-
@io.puts(" " + formatted_step_name)
|
119
|
-
@io.flush
|
120
|
-
end
|
121
|
-
|
122
|
-
def visit_multiline_arg(multiline_arg, status)
|
123
|
-
multiline_arg.accept(self, status)
|
124
|
-
end
|
125
|
-
|
126
|
-
def visit_table_row(table_row, status)
|
127
|
-
@io.print @delim.indent(@indent)
|
128
|
-
exception = table_row.accept(self, status)
|
129
|
-
@io.puts
|
130
|
-
print_exception(exception, 6) if exception
|
131
|
-
end
|
132
|
-
|
133
|
-
def visit_py_string(string, status)
|
134
|
-
s = "\"\"\"\n#{string}\n\"\"\"".indent(@indent)
|
135
|
-
s = s.split("\n").map{|l| l =~ /^\s+$/ ? '' : l}.join("\n")
|
136
|
-
@io.puts(format_string(s, status))
|
137
|
-
@io.flush
|
138
|
-
end
|
139
|
-
|
140
|
-
def visit_table_cell(table_cell, status)
|
141
|
-
table_cell.accept(self, status)
|
142
|
-
end
|
143
|
-
|
144
|
-
def visit_table_cell_value(value, width, status)
|
145
|
-
@io.print(' ' + format_string((value || '').ljust(width), status) + " #{@delim}")
|
146
|
-
@io.flush
|
147
|
-
end
|
148
|
-
|
149
|
-
private
|
150
|
-
|
151
|
-
def print_summary(features)
|
152
|
-
print_counts(features)
|
153
|
-
print_snippets(features, @options)
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
@@ -1,77 +0,0 @@
|
|
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
|
@@ -1,68 +0,0 @@
|
|
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
|
@@ -1,35 +0,0 @@
|
|
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
|
data/lib/cucumber/formatter.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
%w{pretty progress profile rerun}.each{|n| require "cucumber/formatter/#{n}"}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Cucumber
|
2
|
-
module Formatters
|
3
|
-
class AutotestFormatter
|
4
|
-
def initialize(io)
|
5
|
-
@io = io
|
6
|
-
@failed_scenarios = []
|
7
|
-
end
|
8
|
-
|
9
|
-
def step_didnt_pass(step, regexp, args)
|
10
|
-
unless @failed_scenarios.include? step.scenario.name
|
11
|
-
@failed_scenarios << step.scenario.name
|
12
|
-
@io.puts step.scenario.name
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
alias step_failed step_didnt_pass
|
17
|
-
alias step_pending step_didnt_pass
|
18
|
-
alias step_skipped step_didnt_pass
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|