aslakhellesoy-cucumber 0.3.93.1 → 0.3.94
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 +63 -39
- data/Manifest.txt +7 -0
- data/Rakefile +1 -1
- data/cucumber.yml +2 -2
- data/features/cucumber_cli.feature +85 -3
- data/features/custom_formatter.feature +2 -2
- data/features/html_formatter/a.html +5 -5
- data/features/junit_formatter.feature +19 -12
- data/features/step_definitions/cucumber_steps.rb +8 -15
- data/features/support/env.rb +4 -5
- data/lib/cucumber/ast/feature.rb +13 -0
- data/lib/cucumber/ast/feature_element.rb +8 -4
- data/lib/cucumber/ast/features.rb +6 -1
- data/lib/cucumber/ast/table.rb +13 -6
- data/lib/cucumber/ast/tags.rb +9 -1
- data/lib/cucumber/cli/configuration.rb +1 -1
- data/lib/cucumber/cli/main.rb +25 -8
- data/lib/cucumber/cli/options.rb +30 -12
- data/lib/cucumber/filter.rb +4 -3
- data/lib/cucumber/formatter/ansicolor.rb +42 -9
- data/lib/cucumber/formatter/console.rb +38 -6
- data/lib/cucumber/formatter/html.rb +2 -8
- data/lib/cucumber/formatter/junit.rb +65 -24
- data/lib/cucumber/formatter/pretty.rb +9 -4
- data/lib/cucumber/formatter/progress.rb +7 -1
- data/lib/cucumber/rake/task.rb +3 -3
- data/lib/cucumber/step_mother.rb +3 -1
- data/lib/cucumber/version.rb +2 -2
- data/rails_generators/cucumber/templates/cucumber.rake +18 -6
- data/spec/cucumber/ast/scenario_outline_spec.rb +2 -2
- data/spec/cucumber/ast/table_spec.rb +5 -0
- data/spec/cucumber/cli/configuration_spec.rb +2 -1
- data/spec/cucumber/cli/options_spec.rb +11 -6
- metadata +2 -2
@@ -1,10 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
begin
|
3
|
-
require 'builder'
|
4
|
-
rescue LoadError
|
5
|
-
gem 'builder'
|
6
|
-
require 'builder'
|
7
|
-
end
|
1
|
+
require 'cucumber/formatter/ordered_xml_markup'
|
8
2
|
require 'cucumber/formatter/duration'
|
9
3
|
|
10
4
|
module Cucumber
|
@@ -20,7 +14,7 @@ module Cucumber
|
|
20
14
|
end
|
21
15
|
|
22
16
|
def create_builder(io)
|
23
|
-
|
17
|
+
OrderedXmlMarkup.new(:target => io, :indent => 0)
|
24
18
|
end
|
25
19
|
|
26
20
|
def visit_features(features)
|
@@ -1,9 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'builder'
|
3
|
-
rescue LoadError
|
4
|
-
gem 'builder'
|
5
|
-
require 'builder'
|
6
|
-
end
|
1
|
+
require 'cucumber/formatter/ordered_xml_markup'
|
7
2
|
|
8
3
|
module Cucumber
|
9
4
|
module Formatter
|
@@ -18,16 +13,18 @@ module Cucumber
|
|
18
13
|
|
19
14
|
def visit_feature(feature)
|
20
15
|
@failures = @errors = @tests = 0
|
21
|
-
@builder =
|
16
|
+
@builder = OrderedXmlMarkup.new( :indent => 2 )
|
17
|
+
@time = 0
|
22
18
|
super
|
23
19
|
|
24
|
-
@testsuite =
|
20
|
+
@testsuite = OrderedXmlMarkup.new( :indent => 2 )
|
25
21
|
@testsuite.instruct!
|
26
22
|
@testsuite.testsuite(
|
27
23
|
:failures => @failures,
|
28
24
|
:errors => @errors,
|
29
25
|
:tests => @tests,
|
30
|
-
:
|
26
|
+
:time => "%.6f" % @time,
|
27
|
+
:name => @feature_name ) do
|
31
28
|
@testsuite << @builder.target!
|
32
29
|
end
|
33
30
|
|
@@ -36,40 +33,84 @@ module Cucumber
|
|
36
33
|
File.open(feature_filename, 'w') { |file| file.write(@testsuite.target!) }
|
37
34
|
end
|
38
35
|
|
36
|
+
def visit_background(name)
|
37
|
+
@in_background = true
|
38
|
+
super
|
39
|
+
@in_background = false
|
40
|
+
end
|
41
|
+
|
39
42
|
def visit_feature_name(name)
|
40
43
|
lines = name.split(/\r?\n/)
|
41
44
|
@feature_name = lines[0].sub(/Feature\:/, '').strip
|
42
45
|
end
|
43
46
|
|
44
47
|
def visit_scenario_name(keyword, name, file_colon_line, source_indent)
|
45
|
-
|
48
|
+
scenario_name = name.strip
|
49
|
+
scenario_name = "Unnamed scenario" if name == ""
|
50
|
+
@scenario = scenario_name
|
51
|
+
@outline = keyword.include?('Scenario Outline')
|
52
|
+
@output = "Scenario#{ " outline" if @outline}: #{@scenario}\n\n"
|
46
53
|
end
|
47
54
|
|
48
55
|
def visit_steps(steps)
|
49
|
-
|
56
|
+
return if @in_background
|
57
|
+
start = Time.now
|
50
58
|
super
|
51
|
-
|
52
|
-
@
|
59
|
+
duration = Time.now - start
|
60
|
+
unless @outline
|
61
|
+
if steps.failed?
|
62
|
+
steps.each { |step| @output += "#{step.keyword} #{step.name}\n" }
|
63
|
+
@output += "\nMessage:\n"
|
64
|
+
end
|
65
|
+
build_testcase(duration, steps.status, steps.exception)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def visit_outline_table(outline_table)
|
70
|
+
@header_row = true
|
71
|
+
super(outline_table)
|
53
72
|
end
|
54
73
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
74
|
+
def visit_table_row(table_row)
|
75
|
+
if @outline
|
76
|
+
start = Time.now
|
77
|
+
super(table_row)
|
78
|
+
duration = Time.now - start
|
79
|
+
unless @header_row
|
80
|
+
name_suffix = " (outline example : #{table_row.name})"
|
81
|
+
if table_row.failed?
|
82
|
+
@output += "Example row: #{table_row.name}\n"
|
83
|
+
@output += "\nMessage:\n"
|
61
84
|
end
|
62
|
-
|
85
|
+
build_testcase(duration, table_row.status, table_row.exception, name_suffix)
|
63
86
|
end
|
87
|
+
else
|
88
|
+
super(table_row)
|
64
89
|
end
|
90
|
+
@header_row = false
|
65
91
|
end
|
66
92
|
|
67
93
|
private
|
68
94
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
95
|
+
def build_testcase(duration, status, exception = nil, suffix = "")
|
96
|
+
@time += duration
|
97
|
+
classname = "#{@feature_name}.#{@scenario}"
|
98
|
+
name = "#{@scenario}#{suffix}"
|
99
|
+
@builder.testcase(:classname => classname, :name => name, :time => "%.6f" % duration) do
|
100
|
+
if status != :passed
|
101
|
+
@builder.failure(:message => "#{status.to_s} #{name}", :type => status.to_s) do
|
102
|
+
@builder.text! @output
|
103
|
+
@builder.text!(format_exception(exception)) if exception
|
104
|
+
end
|
105
|
+
@failures += 1
|
106
|
+
end
|
107
|
+
end
|
108
|
+
@tests += 1
|
109
|
+
end
|
73
110
|
|
111
|
+
def format_exception(exception)
|
112
|
+
(["#{exception.message} (#{exception.class})"] + exception.backtrace).join("\n")
|
113
|
+
end
|
114
|
+
end
|
74
115
|
end
|
75
116
|
end
|
@@ -48,14 +48,14 @@ module Cucumber
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def visit_comment_line(comment_line)
|
51
|
-
@io.puts(comment_line.indent(@indent))
|
51
|
+
@io.puts(comment_line.indent(@indent))
|
52
52
|
@io.flush
|
53
53
|
end
|
54
54
|
|
55
55
|
def visit_tags(tags)
|
56
56
|
tags.accept(self)
|
57
57
|
if @indent == 1
|
58
|
-
@io.puts
|
58
|
+
@io.puts
|
59
59
|
@io.flush
|
60
60
|
end
|
61
61
|
end
|
@@ -74,6 +74,7 @@ module Cucumber
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def visit_feature_element(feature_element)
|
77
|
+
record_tag_occurrences(feature_element, @options)
|
77
78
|
@indent = 2
|
78
79
|
@scenario_indent = 2
|
79
80
|
super
|
@@ -160,7 +161,7 @@ module Cucumber
|
|
160
161
|
super
|
161
162
|
@io.puts
|
162
163
|
if table_row.exception && !@exceptions.index(table_row.exception)
|
163
|
-
print_exception(table_row.exception, :failed, @indent)
|
164
|
+
print_exception(table_row.exception, :failed, @indent)
|
164
165
|
end
|
165
166
|
end
|
166
167
|
|
@@ -187,7 +188,10 @@ module Cucumber
|
|
187
188
|
end
|
188
189
|
|
189
190
|
private
|
190
|
-
|
191
|
+
def cell_prefix(status)
|
192
|
+
@prefixes[status]
|
193
|
+
end
|
194
|
+
|
191
195
|
def cell_prefix(status)
|
192
196
|
@prefixes[status]
|
193
197
|
end
|
@@ -196,6 +200,7 @@ module Cucumber
|
|
196
200
|
print_stats(features)
|
197
201
|
print_snippets(@options)
|
198
202
|
print_passing_wip(@options)
|
203
|
+
print_tag_limit_warnings(@options)
|
199
204
|
end
|
200
205
|
|
201
206
|
end
|
@@ -18,6 +18,11 @@ module Cucumber
|
|
18
18
|
print_summary(features)
|
19
19
|
end
|
20
20
|
|
21
|
+
def visit_feature_element(feature_element)
|
22
|
+
record_tag_occurrences(feature_element, @options)
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
21
26
|
def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
22
27
|
progress(status)
|
23
28
|
@status = status
|
@@ -36,6 +41,7 @@ module Cucumber
|
|
36
41
|
print_stats(features)
|
37
42
|
print_snippets(@options)
|
38
43
|
print_passing_wip(@options)
|
44
|
+
print_tag_limit_warnings(@options)
|
39
45
|
end
|
40
46
|
|
41
47
|
CHARS = {
|
@@ -51,7 +57,7 @@ module Cucumber
|
|
51
57
|
@io.print(format_string(char, status))
|
52
58
|
@io.flush
|
53
59
|
end
|
54
|
-
|
60
|
+
|
55
61
|
def table_header_cell?(status)
|
56
62
|
status == :skipped_param
|
57
63
|
end
|
data/lib/cucumber/rake/task.rb
CHANGED
@@ -8,8 +8,8 @@ module Cucumber
|
|
8
8
|
#
|
9
9
|
# Cucumber::Rake::Task.new
|
10
10
|
#
|
11
|
-
# This will create a task named '
|
12
|
-
#
|
11
|
+
# This will create a task named 'cucumber' described as 'Run Cucumber features'.
|
12
|
+
# It will use steps from 'features/**/*.rb' and features in 'features/**/*.feature'.
|
13
13
|
#
|
14
14
|
# To further configure the task, you can pass a block:
|
15
15
|
#
|
@@ -148,7 +148,7 @@ module Cucumber
|
|
148
148
|
end
|
149
149
|
|
150
150
|
# Define Cucumber Rake task
|
151
|
-
def initialize(task_name = "
|
151
|
+
def initialize(task_name = "cucumber", desc = "Run Cucumber features")
|
152
152
|
@task_name, @desc = task_name, desc
|
153
153
|
@fork = true
|
154
154
|
@libs = ['lib']
|
data/lib/cucumber/step_mother.rb
CHANGED
@@ -127,7 +127,9 @@ module Cucumber
|
|
127
127
|
end
|
128
128
|
|
129
129
|
# Registers a new StepDefinition. This method is aliased
|
130
|
-
# to <tt>Given</tt>, <tt>When</tt> and <tt>Then</tt
|
130
|
+
# to <tt>Given</tt>, <tt>When</tt> and <tt>Then</tt>, and
|
131
|
+
# also to the i18n translations whenever a feature of a
|
132
|
+
# new language is loaded.
|
131
133
|
#
|
132
134
|
# See Cucumber#alias_steps for details on how to
|
133
135
|
# create your own aliases.
|
data/lib/cucumber/version.rb
CHANGED
@@ -4,15 +4,27 @@ unless ARGV.any? {|a| a =~ /^gems/}
|
|
4
4
|
|
5
5
|
begin
|
6
6
|
require 'cucumber/rake/task'
|
7
|
+
namespace :cucumber do
|
8
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
9
|
+
t.fork = true # You may get faster startup if you set this to false
|
10
|
+
t.cucumber_opts = "--tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
11
|
+
end
|
7
12
|
|
8
|
-
|
9
|
-
|
10
|
-
|
13
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
14
|
+
t.fork = true # You may get faster startup if you set this to false
|
15
|
+
t.cucumber_opts = "--tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Run all features'
|
19
|
+
task :all => [:ok, :wip]
|
20
|
+
end
|
21
|
+
|
22
|
+
task :features => 'cucumber:ok' do
|
23
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
11
24
|
end
|
12
|
-
task :features => 'db:test:prepare'
|
13
25
|
rescue LoadError
|
14
|
-
desc '
|
15
|
-
task :
|
26
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
27
|
+
task :cucumber do
|
16
28
|
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
17
29
|
end
|
18
30
|
end
|
@@ -47,7 +47,7 @@ module Cucumber
|
|
47
47
|
]
|
48
48
|
]
|
49
49
|
]
|
50
|
-
|
50
|
+
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
@@ -59,7 +59,7 @@ module Cucumber
|
|
59
59
|
|
60
60
|
it "should pretty print" do
|
61
61
|
require 'cucumber/formatter/pretty'
|
62
|
-
visitor = Formatter::Pretty.new(@step_mother, STDOUT, {:comment => true})
|
62
|
+
visitor = Formatter::Pretty.new(@step_mother, STDOUT, {:comment => true, :include_tags => {}, :exclude_tags => {}})
|
63
63
|
visitor.visit_feature_element(@scenario_outline)
|
64
64
|
end
|
65
65
|
end
|
@@ -101,6 +101,11 @@ module Cucumber
|
|
101
101
|
table2.hashes.first[:three].should == '4444'
|
102
102
|
end
|
103
103
|
|
104
|
+
it "should allow renaming columns using regexp" do
|
105
|
+
table2 = @table.map_headers(/one|uno/ => :three)
|
106
|
+
table2.hashes.first[:three].should == '4444'
|
107
|
+
end
|
108
|
+
|
104
109
|
it "should copy column mappings when mapping headers" do
|
105
110
|
@table.map_column!('one') { |v| v.to_i }
|
106
111
|
table2 = @table.map_headers('one' => 'three')
|
@@ -361,7 +361,8 @@ END_OF_MESSAGE
|
|
361
361
|
|
362
362
|
it "should accept --no-color option" do
|
363
363
|
Term::ANSIColor.should_receive(:coloring=).with(false)
|
364
|
-
config.
|
364
|
+
config = Configuration.new(StringIO.new)
|
365
|
+
config.parse!(['--no-color'])
|
365
366
|
end
|
366
367
|
|
367
368
|
describe "--backtrace" do
|
@@ -87,10 +87,10 @@ module Cli
|
|
87
87
|
|
88
88
|
context '-t TAGS --tags TAGS' do
|
89
89
|
it "removes the @ prefix" do
|
90
|
-
after_parsing('-t @foo,bar') { options[:include_tags].should ==
|
90
|
+
after_parsing('-t @foo,bar') { options[:include_tags].should == {'foo' => nil, 'bar' => nil} }
|
91
91
|
end
|
92
92
|
it "designates tags prefixed with ~ as tags to be excluded" do
|
93
|
-
after_parsing('--tags ~@foo,bar') { options[:exclude_tags].should ==
|
93
|
+
after_parsing('--tags ~@foo,bar') { options[:exclude_tags].should == {'foo' => nil} }
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -157,13 +157,13 @@ module Cli
|
|
157
157
|
it "combines the include_tags of both" do
|
158
158
|
given_cucumber_yml_defined_as('baz' => %w[-t bar])
|
159
159
|
options.parse!(%w[--tags foo -p baz])
|
160
|
-
options[:include_tags].should ==
|
160
|
+
options[:include_tags].should == {'foo' => nil, 'bar' => nil}
|
161
161
|
end
|
162
162
|
|
163
163
|
it "combines the exclude_tags of both" do
|
164
164
|
given_cucumber_yml_defined_as('baz' => %w[-t ~bar])
|
165
165
|
options.parse!(%w[--tags ~foo -p baz])
|
166
|
-
options[:exclude_tags].should ==
|
166
|
+
options[:exclude_tags].should == {'foo' => nil, 'bar' => nil}
|
167
167
|
end
|
168
168
|
|
169
169
|
it "only takes the paths from the original options, and disgregards the profiles" do
|
@@ -269,8 +269,6 @@ module Cli
|
|
269
269
|
options[:paths].should == ['my_feature.feature']
|
270
270
|
end
|
271
271
|
end
|
272
|
-
|
273
|
-
|
274
272
|
end
|
275
273
|
|
276
274
|
describe '#expanded_args_without_drb' do
|
@@ -295,6 +293,13 @@ module Cli
|
|
295
293
|
options.expanded_args_without_drb.should == %w[features FOO=bar]
|
296
294
|
end
|
297
295
|
|
296
|
+
it "ignores the paths from the profiles if one was specified on the command line" do
|
297
|
+
given_cucumber_yml_defined_as('foo' => 'features --drb')
|
298
|
+
options.parse!(%w[some_feature.feature -p foo])
|
299
|
+
options.expanded_args_without_drb.should == %w[some_feature.feature]
|
300
|
+
end
|
301
|
+
|
302
|
+
|
298
303
|
|
299
304
|
|
300
305
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aslakhellesoy-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.94
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Aslak Helles\xC3\xB8y"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-06 00:00:00 -07:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|