kosmas58-cucumber 0.3.11.6 → 0.3.90
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +62 -4
- data/Manifest.txt +4 -0
- data/examples/i18n/ko/features/addition.feature +5 -5
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/self_test/features/support/env.rb +2 -1
- data/examples/steps_library/features/step_definitions/steps_lib1.rb +8 -0
- data/examples/steps_library/features/step_definitions/steps_lib2.rb +8 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +15 -0
- data/examples/tickets/features/table_diffing.feature +13 -0
- data/examples/watir/features/step_definitons/search_steps.rb +5 -1
- data/features/bug_371.feature +32 -0
- data/features/cucumber_cli_diff_disabled.feature +2 -1
- data/features/html_formatter/a.html +6 -5
- data/features/language_from_header.feature +30 -0
- data/features/rake_task.feature +28 -0
- data/features/steps_formatter.feature +25 -0
- data/features/support/env.rb +5 -0
- data/features/table_diffing.feature +45 -0
- data/features/unicode_table.feature +35 -0
- data/gem_tasks/sass.rake +4 -0
- data/lib/cucumber/ast/outline_table.rb +2 -1
- data/lib/cucumber/ast/py_string.rb +0 -1
- data/lib/cucumber/ast/step.rb +4 -1
- data/lib/cucumber/ast/table.rb +286 -48
- data/lib/cucumber/ast/visitor.rb +2 -1
- data/lib/cucumber/cli/configuration.rb +8 -2
- data/lib/cucumber/cli/language_help_formatter.rb +9 -7
- data/lib/cucumber/feature_file.rb +53 -0
- data/lib/cucumber/filter.rb +50 -0
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +20 -5
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +49 -0
- data/lib/cucumber/parser/feature.rb +27 -0
- data/lib/cucumber/parser/i18n/language.rb +83 -0
- data/lib/cucumber/rake/task.rb +6 -0
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/version.rb +2 -2
- data/lib/cucumber/webrat/table_locator.rb +66 -0
- data/rails_generators/cucumber/templates/en/webrat_steps.rb +17 -0
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/feature/templates/feature.erb +1 -1
- data/rails_generators/feature/templates/steps.erb +2 -8
- data/spec/cucumber/ast/table_spec.rb +145 -0
- data/spec/cucumber/cli/configuration_spec.rb +13 -0
- data/spec/cucumber/cli/main_spec.rb +0 -1
- data/spec/cucumber/formatter/progress_spec.rb +2 -2
- metadata +18 -4
data/History.txt
CHANGED
@@ -1,12 +1,21 @@
|
|
1
|
-
== 0.3.
|
1
|
+
== 0.3.91 (In Git)
|
2
2
|
|
3
|
-
|
3
|
+
== 0.3.90 2009-07-22
|
4
|
+
|
5
|
+
The Hot summer release
|
6
|
+
|
7
|
+
This is a hot summer in Norway, and Cucumbers are growing in abundance. To celebrate this we give you
|
8
|
+
a new release with lots of new features and bugfixes. This is also one of the last releases in the 0.3 series
|
9
|
+
(hence the 0.3.90 number), so 0.4 (or maybe 1.0!) will be coming up soon. The highlights of this release are:
|
10
|
+
|
11
|
+
=== Egality
|
4
12
|
|
5
13
|
English is not the world's most spoken language, so why should Cucumber force non-English speakers to use the
|
6
14
|
--language flag? As of this release you're no longer forced to do that. Instead, you can add a comment header
|
7
15
|
to your .feature files:
|
8
16
|
|
9
17
|
# language: fr
|
18
|
+
# Cucumber understands that this is French
|
10
19
|
Fonctionnalité: Trou de boulette
|
11
20
|
|
12
21
|
If you don't have that header, Cucumber will work as before - using whatever you specified with --language,
|
@@ -14,6 +23,45 @@ or default to English if no --language option was specified. A nice side effect
|
|
14
23
|
have features in several languages side by side and run them in the same cucumber. (Not recommended unless
|
15
24
|
you want to take polyglot programming to an extreme level).
|
16
25
|
|
26
|
+
=== Table diffing (experimental)
|
27
|
+
|
28
|
+
When you pass a table as an argument to your Then steps you often want to compare that table
|
29
|
+
to some actual values. In previous releases you had to iterate over the table's values and manually
|
30
|
+
compare each row using cell.should equal('foo') or assert_equal('foo', cell). If a discrepancy was found
|
31
|
+
you'd get an error, but it was hard to see how the entire expected data set was different from the actual one.
|
32
|
+
|
33
|
+
With this release you have a much more powerful way to compare expected tables with actual data. An
|
34
|
+
Ast::Table object now has a new #diff!(table) method that you can invoke in your step definitions
|
35
|
+
that take table arguments. If the table you pass in is different from the expected table (from your
|
36
|
+
plain text step), Cucumber will print the difference for each of the row or column and fail your step.
|
37
|
+
|
38
|
+
The Table#diff! method expects an Array of Array, Array of Hash (similar to what you'd get from table#hashes)
|
39
|
+
or simply another Ast::Table object. Here is a simple example:
|
40
|
+
|
41
|
+
Then /^I should see the following cukes:$/ do |expected_cukes_table|
|
42
|
+
actual_table = ... # For example [['Latin', 'English'], ['Cucumis sativus', 'Cucumber'], ['Cucumis anguria', 'Burr Gherkin']]
|
43
|
+
expected_cukes_table.diff!(actual_table)
|
44
|
+
end
|
45
|
+
|
46
|
+
As an extra bonus we provide Webrat users with a new #table_at(selector) method that you can use to transform
|
47
|
+
an HTML table into an Array of Array, so that you can easily compare the contents of your HTML table to
|
48
|
+
expected data passed to a step. Here is an example:
|
49
|
+
|
50
|
+
Then /^I should see the following cukes:$/ do |expected_cukes_table|
|
51
|
+
expected_cukes_table.diff!(table_at('#cuke_table').to_a)
|
52
|
+
end
|
53
|
+
|
54
|
+
You can do the same trick to compare data from a Rails ActiveRecord table (although this is not a
|
55
|
+
recommended practice - your Then steps should compare against what users *see*, not what's in the
|
56
|
+
database):
|
57
|
+
|
58
|
+
# This requires that you use the column names in the header of the plain text expected table
|
59
|
+
Then /^I should have the following cukes in the database:$/ do |expected_cukes_table|
|
60
|
+
expected_cukes_table.diff!(Cuke.find(:all).map(&attributes))
|
61
|
+
end
|
62
|
+
|
63
|
+
=== Environment variables
|
64
|
+
|
17
65
|
Another useful new feature is the ability to define environment variables on Cucumber's command line (just
|
18
66
|
like you can with Rake). Example:
|
19
67
|
|
@@ -22,10 +70,13 @@ like you can with Rake). Example:
|
|
22
70
|
You can now pick up ENV['FOO'] in ruby (for example in env.rb) and take actions according to the value,
|
23
71
|
for example enabling your super hack that validates all HTTP responses for XHTML validity.
|
24
72
|
|
25
|
-
This release also has several bugfixes related to --format and Before/
|
73
|
+
This release also has several bugfixes related to --format and Before/After hooks.
|
26
74
|
|
27
75
|
=== Bugfixes
|
28
|
-
*
|
76
|
+
* Fix some misspellings which affect test fail for Korean example (#373 Dongju Kim)
|
77
|
+
* Make it possible to write non-localized step definitions (#377 Aslak Hellesøy)
|
78
|
+
* Table cells containing unicode are rendered incorrectly (#386 Stefan Kanev)
|
79
|
+
* Before and After hooks run after everything is finished when there are 2+ --format options (#371 Aslak Hellesøy)
|
29
80
|
* When using --out and two --format the first is not delivered inline with execution of features (#361 Aslak Hellesøy)
|
30
81
|
* Profile Formatter broken (#370 Aslak Hellesøy)
|
31
82
|
* Default profile usage with --drb flag degrades gracefully with no server. (#367 Ben Mabey)
|
@@ -33,15 +84,22 @@ This release also has several bugfixes related to --format and Before/Adter hook
|
|
33
84
|
* rake gems no longer lists cucumber as a [F]ramework gem (David Chelimsky)
|
34
85
|
* CLI issues correct exit code when using --drb. Requires Spork version >= 0.5.1. (#355 Ben Mabey)
|
35
86
|
* Make sure script/generate cucumber --spork uses the cucumber Rails environment (Philippe Lafoucrière)
|
87
|
+
* Fixed bug with rake task raising errors with feature files with spaces (#380 Joseph Wilk)
|
36
88
|
|
37
89
|
=== New Features
|
90
|
+
* I should see should support regexes (#382 John Ferlito)
|
91
|
+
* Access to scenario outline name from After hook scenario parameter (#342 Aslak Hellesøy)
|
92
|
+
* Allow multiple --tags switches to be passed
|
93
|
+
* Load step definitions from vendored gems and plugins (#388 Mike Burns)
|
38
94
|
* New --format steps formatter. Variant of the usage formatter that lists available step definitions (Demetrius Nunes)
|
39
95
|
* Possibility to specify scenario language as part of the .feature file (#345 Aslak Hellesøy)
|
40
96
|
* Support specifying environment variables using foo=bar syntax on command line or in profiles (#362 Bryan Helmkamp)
|
41
97
|
* Display failing scenarios at the end of pretty format to make it easier for people to play them back (#360 Ryan Bigg)
|
42
98
|
|
43
99
|
=== Changed Features
|
100
|
+
* When using --tags, positive tags are &&'ed while negative tags are ||'ed (John Wilger)
|
44
101
|
* The data returned from Table#hashes and similar methods are frozen. Dup if you need to modify. (Aslak Hellesøy)
|
102
|
+
* Visitor.visit_table_cell_value(value, col_width, status) is now visitor.visit_table_cell_value(value, status)
|
45
103
|
|
46
104
|
== 0.3.11 2009-06-05
|
47
105
|
|
data/Manifest.txt
CHANGED
@@ -239,6 +239,7 @@ examples/tickets/features/step_definitons/246_steps.rb
|
|
239
239
|
examples/tickets/features/step_definitons/248_steps.rb
|
240
240
|
examples/tickets/features/step_definitons/scenario_outline_steps.rb
|
241
241
|
examples/tickets/features/step_definitons/tickets_steps.rb
|
242
|
+
examples/tickets/features/table_diffing.feature
|
242
243
|
examples/tickets/features/tickets.feature
|
243
244
|
examples/watir/README.textile
|
244
245
|
examples/watir/Rakefile
|
@@ -268,6 +269,8 @@ features/step_definitions/cucumber_steps.rb
|
|
268
269
|
features/step_definitions/extra_steps.rb
|
269
270
|
features/steps_formatter.feature
|
270
271
|
features/support/env.rb
|
272
|
+
features/table_diffing.feature
|
273
|
+
features/unicode_table.feature
|
271
274
|
features/usage.feature
|
272
275
|
features/work_in_progress.feature
|
273
276
|
gem_tasks/deployment.rake
|
@@ -349,6 +352,7 @@ lib/cucumber/step_definition.rb
|
|
349
352
|
lib/cucumber/step_match.rb
|
350
353
|
lib/cucumber/step_mother.rb
|
351
354
|
lib/cucumber/version.rb
|
355
|
+
lib/cucumber/webrat/table_locator.rb
|
352
356
|
lib/cucumber/world.rb
|
353
357
|
rails_generators/cucumber/USAGE
|
354
358
|
rails_generators/cucumber/cucumber_generator.rb
|
@@ -4,11 +4,11 @@
|
|
4
4
|
수학을 잘 못하는 사람으로써
|
5
5
|
두숫자의 합을 알고 싶다
|
6
6
|
|
7
|
-
|
8
|
-
조건 계산기에
|
9
|
-
그리고 계산기에
|
10
|
-
만일 내가
|
11
|
-
그러면 화면에 출력된 결과는
|
7
|
+
시나리오 개요: 두 숫자를 더하기
|
8
|
+
조건 계산기에 <입력1>을 입력했음
|
9
|
+
그리고 계산기에 <입력2>을 입력했음
|
10
|
+
만일 내가 <버튼>를 누르면
|
11
|
+
그러면 화면에 출력된 결과는 <결과>이다
|
12
12
|
|
13
13
|
예:
|
14
14
|
| 입력1 | 입력2 | 버튼 | 결과 |
|
@@ -64,3 +64,18 @@ end
|
|
64
64
|
Then /^I should get a no method error for 'backtrace_line'$/ do
|
65
65
|
pending
|
66
66
|
end
|
67
|
+
|
68
|
+
Then /the table should be different with table:/ do |expected|
|
69
|
+
expected.diff!(table(%{
|
70
|
+
| b | c | a | d |
|
71
|
+
| KASHA | AIIT | BOOYA | X |
|
72
|
+
| four | five | three | Y |
|
73
|
+
}), :coldiff => true)
|
74
|
+
end
|
75
|
+
|
76
|
+
Then /the table should be different with array:/ do |expected|
|
77
|
+
expected.diff!([
|
78
|
+
{'a' => 'BOOYA', 'b' => 'KASHA'},
|
79
|
+
{'a' => 'three', 'b' => 'four'},
|
80
|
+
])
|
81
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@intentional_failure
|
2
|
+
Feature: Tables
|
3
|
+
Scenario: Extra row with table
|
4
|
+
Then the table should be different with table:
|
5
|
+
| a | b |
|
6
|
+
| one | two |
|
7
|
+
| three | four |
|
8
|
+
|
9
|
+
Scenario: Extra row and missing column with table
|
10
|
+
Then the table should be different with table:
|
11
|
+
| a | e | b |
|
12
|
+
| one | Q | two |
|
13
|
+
| three | R | four |
|
@@ -19,4 +19,8 @@ end
|
|
19
19
|
# http://github.com/aslakhellesoy/cucumber/tree/v0.1.15/examples/watir/features/step_definitons/search_steps.rb
|
20
20
|
#
|
21
21
|
# You may keep the page classes along your steps, or even better, put them in separate files, e.g.
|
22
|
-
# support/pages/google_search.rb
|
22
|
+
# support/pages/google_search.rb
|
23
|
+
#
|
24
|
+
# This technique is called "Page Objects", and you can read more about it here:
|
25
|
+
# http://github.com/marekj/watirloo/tree/master
|
26
|
+
# We're not using this technique here, since we want to illustrate the basics only.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Feature: https://rspec.lighthouseapp.com/projects/16211/tickets/371
|
2
|
+
Scenario: Before runs once
|
3
|
+
Given a standard Cucumber project directory structure
|
4
|
+
And a file named "features/f.feature" with:
|
5
|
+
"""
|
6
|
+
Feature: F
|
7
|
+
Scenario: S
|
8
|
+
Given G
|
9
|
+
"""
|
10
|
+
And a file named "features/step_definitions/steps.rb" with:
|
11
|
+
"""
|
12
|
+
Before do
|
13
|
+
puts "B"
|
14
|
+
end
|
15
|
+
Given /G/ do
|
16
|
+
puts "G"
|
17
|
+
end
|
18
|
+
"""
|
19
|
+
When I run cucumber -q --format pretty --format progress --out progress.txt features/f.feature
|
20
|
+
Then it should pass with
|
21
|
+
"""
|
22
|
+
Feature: F
|
23
|
+
|
24
|
+
Scenario: S
|
25
|
+
B
|
26
|
+
G
|
27
|
+
Given G
|
28
|
+
|
29
|
+
1 scenario (1 passed)
|
30
|
+
1 step (1 passed)
|
31
|
+
|
32
|
+
"""
|
@@ -142,7 +142,7 @@ features/background/failing_background_after_success.feature:5:in `And '10' glob
|
|
142
142
|
I sleep all night and I test all day</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Passing background sample</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step passed" id="features_background_passing_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">10</span>' cukes</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">passing background</span></h3><ol><li class="step passed" id="features_background_passing_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '<span class="param">10</span>' cukes</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">another passing background</span></h3><ol><li class="step passed" id="features_background_passing_background_feature_10"><div><span class="keyword">Then</span> <span class="step val">I should have '<span class="param">10</span>' cukes</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Pending background sample</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step undefined" id="features_background_pending_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">pending</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">pending background</span></h3><ol><li class="step skipped" id="features_background_pending_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '<span class="param">10</span>' cukes</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">another pending background</span></h3><ol><li class="step skipped" id="features_background_pending_background_feature_10"><div><span class="keyword">Then</span> <span class="step val">I should have '<span class="param">10</span>' cukes</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Failing background with scenario outlines sample</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step failed" id="features_background_scenario_outline_failing_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">failing without a table</span></div><pre class="failed">FAIL (RuntimeError)
|
143
143
|
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
144
144
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
145
|
-
features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'</pre></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">failing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_failing_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '<count>' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">count</th></tr><tr id="row_10"><td class="val skipped" id="row_10_0">10</td></tr><tr><td
|
145
|
+
features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'</pre></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">failing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_failing_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '<count>' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">count</th></tr><tr id="row_10"><td class="val skipped" id="row_10_0">10</td></tr><tr><td colspan="1" class="failed"><pre>FAIL (RuntimeError)
|
146
146
|
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
147
147
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
148
148
|
features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'</pre></td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">another failing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_failing_background_feature_13"><div><span class="keyword">Then</span> <span class="step val">I should have '<count>' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">count</th></tr><tr id="row_16"><td class="val skipped" id="row_16_0">10</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Passing background with scenario outlines sample</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step passed" id="features_background_scenario_outline_passing_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">10</span>' cukes</span></div></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">passing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_passing_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '<count>' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">count</th></tr><tr id="row_10"><td class="val passed" id="row_10_0">10</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">another passing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_passing_background_feature_13"><div><span class="keyword">Then</span> <span class="step val">I should have '<count>' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">count</th></tr><tr id="row_16"><td class="val passed" id="row_16_0">10</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Calling undefined step</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call directly</span></h3><ol><li class="step undefined" id="features_call_undefined_step_from_step_def_feature_4"><div><span class="keyword">Given</span> <span class="step val">a step definition that calls an undefined step</span></div><pre class="undefined">Undefined step: "this does not exist" (Cucumber::Undefined)
|
@@ -151,7 +151,8 @@ features/call_undefined_step_from_step_def.feature:4:in `Given a step definition
|
|
151
151
|
./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
|
152
152
|
features/call_undefined_step_from_step_def.feature:7:in `Given call step "a step definition that calls an undefined step"'</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Failing expectation</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Failing expectation</span></h3><ol><li class="step failed" id="features_failing_expectation_feature_4"><div><span class="keyword">Given</span> <span class="step val">failing expectation</span></div><pre class="failed">expected: "that",
|
153
153
|
got: "this" (using ==)
|
154
|
-
|
154
|
+
|
155
|
+
Diff:
|
155
156
|
@@ -1,2 +1,2 @@
|
156
157
|
-that
|
157
158
|
+this
|
@@ -165,7 +166,7 @@ yawn</span></h3><ol><li class="step passed" id="features_multiline_name_feature_
|
|
165
166
|
which goes on and on and on for three lines
|
166
167
|
yawn</span></h3><ol><li class="step skipped" id="features_multiline_name_feature_16"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_18"><th class="val skipped_param" id="row_18_0">state</th></tr><tr id="row_19"><td class="val passed" id="row_19_0">passing</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">name</span></h3><ol><li class="step skipped" id="features_multiline_name_feature_22"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">I'm a multiline name
|
167
168
|
which goes on and on and on for three lines
|
168
|
-
yawn</span></h4><table><tr id="row_26"><th class="val skipped_param" id="row_26_0">state</th></tr><tr id="row_27"><td class="val passed" id="row_27_0">passing</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Outline Sample</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">I have no steps</span></h3><ol></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Test state</span></h3><ol><li class="step skipped" id="features_outline_sample_feature_6"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li><li class="step skipped" id="features_outline_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val"><other_state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Rainbow colours</span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">state</th><th class="val skipped_param" id="row_9_1">other_state</th></tr><tr id="row_10"><td class="val undefined" id="row_10_0">missing</td><td class="val skipped" id="row_10_1">passing</td></tr><tr id="row_11"><td class="val passed" id="row_11_0">passing</td><td class="val passed" id="row_11_1">passing</td></tr><tr id="row_12"><td class="val failed" id="row_12_0">failing</td><td class="val skipped" id="row_12_1">passing</td></tr><tr><td
|
169
|
+
yawn</span></h4><table><tr id="row_26"><th class="val skipped_param" id="row_26_0">state</th></tr><tr id="row_27"><td class="val passed" id="row_27_0">passing</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Outline Sample</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">I have no steps</span></h3><ol></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Test state</span></h3><ol><li class="step skipped" id="features_outline_sample_feature_6"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li><li class="step skipped" id="features_outline_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val"><other_state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Rainbow colours</span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">state</th><th class="val skipped_param" id="row_9_1">other_state</th></tr><tr id="row_10"><td class="val undefined" id="row_10_0">missing</td><td class="val skipped" id="row_10_1">passing</td></tr><tr id="row_11"><td class="val passed" id="row_11_0">passing</td><td class="val passed" id="row_11_1">passing</td></tr><tr id="row_12"><td class="val failed" id="row_12_0">failing</td><td class="val skipped" id="row_12_1">passing</td></tr><tr><td colspan="2" class="failed"><pre>FAIL (RuntimeError)
|
169
170
|
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
170
171
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
171
172
|
features/outline_sample.feature:6:in `Given <state> without a table'</pre></td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Only passing</span></h4><table><tr id="row_14"><th class="val skipped_param" id="row_14_0">state</th><th class="val skipped_param" id="row_14_1">other_state</th></tr><tr id="row_15"><td class="val passed" id="row_15_0">passing</td><td class="val passed" id="row_15_1">passing</td></tr></table></div></div></div><div class="feature"><pre class="comment"># Feature comment<br/></pre><span class="tag">@one</span><h2><span class="val">Feature: Sample</span></h2><p class="narrative"></p><div class="scenario"><span class="tag">@two</span><span class="tag">@three</span><h3><span class="keyword">Scenario:</span> <span class="val">Missing</span></h3><ol><li class="step undefined" id="features_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div><div class="scenario"><pre class="comment"># Scenario comment<br/></pre><span class="tag">@three</span><h3><span class="keyword">Scenario:</span> <span class="val">Passing</span></h3><ol><li class="step passed" id="features_sample_feature_12"><div><span class="keyword">Given</span> <span class="step val">passing</span></div><table><tr id="row_13"><td class="val" id="row_13_0">a</td><td class="val" id="row_13_1">b</td></tr><tr id="row_14"><td class="val" id="row_14_0">c</td><td class="val" id="row_14_1">d</td></tr></table></li></ol></div><div class="scenario"><span class="tag">@four</span><h3><span class="keyword">Scenario:</span> <span class="val">Failing</span></h3><ol><li class="step failed" id="features_sample_feature_18"><div><span class="keyword">Given</span> <span class="step val">failing</span></div><pre class="val"> hello</pre><pre class="failed">FAIL (RuntimeError)
|
@@ -174,10 +175,10 @@ features/outline_sample.feature:6:in `Given <state> without a table'</pre></td><
|
|
174
175
|
features/sample.feature:18:in `Given failing'</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature: search examples</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val">Hantu Pisang background match</span></h3><ol><li class="step passed" id="features_search_sample_feature_4"><div><span class="keyword">Given</span> <span class="step val">passing without a table</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">should match Hantu Pisang</span></h3><ol><li class="step passed" id="features_search_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val">passing without a table</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Ignore me</span></h3><ol><li class="step failed" id="features_search_sample_feature_10"><div><span class="keyword">Given</span> <span class="step val">failing without a table</span></div><pre class="failed">FAIL (RuntimeError)
|
175
176
|
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
176
177
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
177
|
-
features/search_sample.feature:10:in `Given failing without a table'</pre></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Ignore me</span></h3><ol><li class="step skipped" id="features_search_sample_feature_13"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">state</th></tr><tr id="row_16"><td class="val failed" id="row_16_0">failing</td></tr><tr><td
|
178
|
+
features/search_sample.feature:10:in `Given failing without a table'</pre></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Ignore me</span></h3><ol><li class="step skipped" id="features_search_sample_feature_13"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">state</th></tr><tr id="row_16"><td class="val failed" id="row_16_0">failing</td></tr><tr><td colspan="1" class="failed"><pre>FAIL (RuntimeError)
|
178
179
|
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
179
180
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
180
|
-
features/search_sample.feature:13:in `Given <state> without a table'</pre></td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Hantu Pisang match</span></h3><ol><li class="step skipped" id="features_search_sample_feature_19"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_21"><th class="val skipped_param" id="row_21_0">state</th></tr><tr id="row_22"><td class="val passed" id="row_22_0">passing</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">no match in name but in examples</span></h3><ol><li class="step skipped" id="features_search_sample_feature_25"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Hantu Pisang</span></h4><table><tr id="row_27"><th class="val skipped_param" id="row_27_0">state</th></tr><tr id="row_28"><td class="val passed" id="row_28_0">passing</td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Ignore me</span></h4><table><tr id="row_31"><th class="val skipped_param" id="row_31_0">state</th></tr><tr id="row_32"><td class="val failed" id="row_32_0">failing</td></tr><tr><td
|
181
|
+
features/search_sample.feature:13:in `Given <state> without a table'</pre></td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Hantu Pisang match</span></h3><ol><li class="step skipped" id="features_search_sample_feature_19"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_21"><th class="val skipped_param" id="row_21_0">state</th></tr><tr id="row_22"><td class="val passed" id="row_22_0">passing</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">no match in name but in examples</span></h3><ol><li class="step skipped" id="features_search_sample_feature_25"><div><span class="keyword">Given</span> <span class="step val"><state> without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Hantu Pisang</span></h4><table><tr id="row_27"><th class="val skipped_param" id="row_27_0">state</th></tr><tr id="row_28"><td class="val passed" id="row_28_0">passing</td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Ignore me</span></h4><table><tr id="row_31"><th class="val skipped_param" id="row_31_0">state</th></tr><tr id="row_32"><td class="val failed" id="row_32_0">failing</td></tr><tr><td colspan="1" class="failed"><pre>FAIL (RuntimeError)
|
181
182
|
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
182
183
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
183
184
|
features/search_sample.feature:25:in `Given <state> without a table'</pre></td></tr></table></div></div></div><div class="feature"><span class="tag">@lots</span><h2><span class="val">Feature: Tons of cukes</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Lots and lots</span></h3><ol><li class="step passed" id="features_tons_of_cukes_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step failed" id="features_tons_of_cukes_feature_5"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div><pre class="failed">We already have 2 cukes! (RuntimeError)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Language from header
|
2
|
+
In order to simplify command line and
|
3
|
+
settings in IDEs, Cucumber should pick
|
4
|
+
up parser language from a header.
|
5
|
+
|
6
|
+
Scenario: LOLCAT
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/lolcat.feature" with:
|
9
|
+
"""
|
10
|
+
# language: en-lol
|
11
|
+
OH HAI: STUFFING
|
12
|
+
B4: HUNGRY
|
13
|
+
MISHUN: CUKES
|
14
|
+
DEN KTHXBAI
|
15
|
+
"""
|
16
|
+
When I run cucumber -i features/lolcat.feature
|
17
|
+
Then it should pass with
|
18
|
+
"""
|
19
|
+
# language: en-lol
|
20
|
+
OH HAI: STUFFING
|
21
|
+
|
22
|
+
B4: HUNGRY # features/lolcat.feature:3
|
23
|
+
|
24
|
+
MISHUN: CUKES # features/lolcat.feature:4
|
25
|
+
DEN KTHXBAI # features/lolcat.feature:5
|
26
|
+
|
27
|
+
1 scenario (1 undefined)
|
28
|
+
1 step (1 undefined)
|
29
|
+
|
30
|
+
"""
|
data/features/rake_task.feature
CHANGED
@@ -148,3 +148,31 @@ Feature: Rake task
|
|
148
148
|
"""
|
149
149
|
* features/support/dont_require_me.rb
|
150
150
|
"""
|
151
|
+
|
152
|
+
Scenario: feature files with spaces
|
153
|
+
Given a file named "features/spaces are nasty.feature" with:
|
154
|
+
"""
|
155
|
+
Feature: The futures green
|
156
|
+
|
157
|
+
Scenario: Orange
|
158
|
+
Given this is missing
|
159
|
+
"""
|
160
|
+
And a file named "Rakefile" with:
|
161
|
+
"""
|
162
|
+
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
163
|
+
require 'cucumber/rake/task'
|
164
|
+
|
165
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
166
|
+
t.cucumber_opts = %w{--quiet --no-color}
|
167
|
+
end
|
168
|
+
"""
|
169
|
+
When I run rake features
|
170
|
+
Then it should pass
|
171
|
+
And the output should contain
|
172
|
+
"""
|
173
|
+
Feature: The futures green
|
174
|
+
|
175
|
+
Scenario: Orange
|
176
|
+
Given this is missing
|
177
|
+
|
178
|
+
"""
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: --formatter steps option - Steps Formatter
|
2
|
+
In order to easily see which steps are already defined,
|
3
|
+
specially when using 3rd party steps libraries,
|
4
|
+
Cucumber should show the available steps in a user-friendly format
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I am in steps_library
|
8
|
+
|
9
|
+
Scenario: Printing steps
|
10
|
+
When I run cucumber -f steps features
|
11
|
+
Then it should pass with
|
12
|
+
"""
|
13
|
+
features/step_definitions/steps_lib1.rb
|
14
|
+
/^I defined a first step$/ # features/step_definitions/steps_lib1.rb:1
|
15
|
+
/^I define a second step$/ # features/step_definitions/steps_lib1.rb:4
|
16
|
+
/^I should also have a third step$/ # features/step_definitions/steps_lib1.rb:7
|
17
|
+
|
18
|
+
features/step_definitions/steps_lib2.rb
|
19
|
+
/^I defined a step 4$/ # features/step_definitions/steps_lib2.rb:1
|
20
|
+
/^I create a step 5$/ # features/step_definitions/steps_lib2.rb:4
|
21
|
+
/^I should be too tired for step 6$/ # features/step_definitions/steps_lib2.rb:7
|
22
|
+
|
23
|
+
6 step definition(s) in 2 source file(s).
|
24
|
+
|
25
|
+
"""
|
data/features/support/env.rb
CHANGED
@@ -70,6 +70,11 @@ class CucumberWorld
|
|
70
70
|
stderr_file.close
|
71
71
|
in_current_dir do
|
72
72
|
@last_stdout = `#{command} 2> #{stderr_file.path}`
|
73
|
+
mode = Cucumber::RUBY_1_9 ? {:external_encoding=>"UTF-8"} : 'r'
|
74
|
+
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
|
75
|
+
@last_stdout = io.read
|
76
|
+
end
|
77
|
+
|
73
78
|
@last_exit_status = $?.exitstatus
|
74
79
|
end
|
75
80
|
@last_stderr = IO.read(stderr_file.path)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Table diffing
|
2
|
+
In order to more easily compare data in tables
|
3
|
+
step definition writers should be able to diff
|
4
|
+
a table with expected data and see the diff inline
|
5
|
+
|
6
|
+
Scenario: Extra row
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/tables.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Tables
|
11
|
+
Scenario: Extra row
|
12
|
+
Then the table should be:
|
13
|
+
| x | y |
|
14
|
+
| a | b |
|
15
|
+
"""
|
16
|
+
And a file named "features/step_definitions/table_steps.rb" with:
|
17
|
+
"""
|
18
|
+
Then /the table should be:/ do |expected|
|
19
|
+
expected.diff!(table(%{
|
20
|
+
| x | y |
|
21
|
+
| a | c |
|
22
|
+
}))
|
23
|
+
end
|
24
|
+
"""
|
25
|
+
When I run cucumber -i features/tables.feature
|
26
|
+
Then it should fail with
|
27
|
+
"""
|
28
|
+
Feature: Tables
|
29
|
+
|
30
|
+
Scenario: Extra row # features/tables.feature:2
|
31
|
+
Then the table should be: # features/step_definitions/table_steps.rb:1
|
32
|
+
| x | y |
|
33
|
+
| a | b |
|
34
|
+
| a | c |
|
35
|
+
Tables were not identical (RuntimeError)
|
36
|
+
./features/step_definitions/table_steps.rb:2:in `/the table should be:/'
|
37
|
+
features/tables.feature:3:in `Then the table should be:'
|
38
|
+
|
39
|
+
Failing Scenarios:
|
40
|
+
cucumber features/tables.feature:2 # Scenario: Extra row
|
41
|
+
|
42
|
+
1 scenario (1 failed)
|
43
|
+
1 step (1 failed)
|
44
|
+
|
45
|
+
"""
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Unicode in tables
|
2
|
+
In order to please the whole world,
|
3
|
+
unicode characters in tables should be
|
4
|
+
properly aligned
|
5
|
+
|
6
|
+
Scenario: All sorts of weird stuff
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/unicode.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Featuring unicode
|
11
|
+
|
12
|
+
Scenario: So what, whatever
|
13
|
+
Given passing
|
14
|
+
| Brüno | abc |
|
15
|
+
| Bruno | æøå |
|
16
|
+
"""
|
17
|
+
And a file named "features/env.rb" with:
|
18
|
+
"""
|
19
|
+
$KCODE='u'
|
20
|
+
"""
|
21
|
+
When I run cucumber -q --dry-run features/unicode.feature
|
22
|
+
Then it should pass with
|
23
|
+
"""
|
24
|
+
Feature: Featuring unicode
|
25
|
+
|
26
|
+
Scenario: So what, whatever
|
27
|
+
Given passing
|
28
|
+
| Brüno | abc |
|
29
|
+
| Bruno | æøå |
|
30
|
+
|
31
|
+
1 scenario (1 undefined)
|
32
|
+
1 step (1 undefined)
|
33
|
+
|
34
|
+
"""
|
35
|
+
|
data/gem_tasks/sass.rake
ADDED
@@ -44,7 +44,8 @@ module Cucumber
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class ExampleRow < Cells
|
47
|
-
|
47
|
+
attr_reader :scenario_outline # https://rspec.lighthouseapp.com/projects/16211/tickets/342
|
48
|
+
|
48
49
|
def create_step_invocations!(scenario_outline)
|
49
50
|
@scenario_outline = scenario_outline
|
50
51
|
@step_invocations = scenario_outline.step_invocations(self)
|
data/lib/cucumber/ast/step.rb
CHANGED
@@ -85,8 +85,11 @@ module Cucumber
|
|
85
85
|
private
|
86
86
|
|
87
87
|
def matched_cells(cells)
|
88
|
+
col_index = 0
|
88
89
|
cells.select do |cell|
|
89
|
-
|
90
|
+
header_cell = cell.table.header_cell(col_index)
|
91
|
+
col_index += 1
|
92
|
+
delimited = delimited(header_cell.value)
|
90
93
|
@name.index(delimited) || (@multiline_arg && @multiline_arg.has_text?(delimited))
|
91
94
|
end
|
92
95
|
end
|