aslakhellesoy-cucumber 0.1.1 → 0.1.2
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/README.textile +30 -0
- data/examples/calculator/Rakefile +6 -0
- data/examples/calculator/features/addition.feature +16 -0
- data/examples/calculator/features/division.feature +12 -0
- data/examples/calculator/features/steps/addition_steps.rb +31 -0
- data/examples/calculator/lib/calculator.rb +18 -0
- data/examples/java/README.textile +0 -30
- data/lib/cucumber/version.rb +1 -1
- metadata +7 -6
data/README.textile
CHANGED
@@ -29,3 +29,33 @@ I haven't written a tutorial yet. Take a look at the "examples":http://github.co
|
|
29
29
|
Each example directory has a Rakefile, and you can run the features with
|
30
30
|
|
31
31
|
<pre><code>rake features</code></pre>
|
32
|
+
|
33
|
+
h2. Background and Credits
|
34
|
+
|
35
|
+
Cucumber is a rewrite of RSpec's "Story runner", which was originally written by Dan North. Dan's original
|
36
|
+
implementation required that stories be written in Ruby. Shortly after, David Chelimsky added
|
37
|
+
"plain text":http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-plain-english support.
|
38
|
+
|
39
|
+
This brought executable stories a little closer to non-technical users, which is one of the target audiences
|
40
|
+
for this kind of tool.
|
41
|
+
|
42
|
+
However, the RSpec Story runner has several shortcomings which is rather common for tools that move into new territory.
|
43
|
+
Some of the biggest problems with it are:
|
44
|
+
|
45
|
+
* Hard to get started with. A special "all.rb" file must be written before it can be used.
|
46
|
+
* No out of the box Rake support, which puts a lot of people off.
|
47
|
+
* No i18n, so if you want to write stories in a different language than English you're out of luck.
|
48
|
+
* Poor error reporting. No way to know on what line a plain text story failed during execution or parsing.
|
49
|
+
* Limited colouring of output.
|
50
|
+
* No simple way to execute only one scenario.
|
51
|
+
* No command line tool to run stories.
|
52
|
+
|
53
|
+
While all of this could have been fixed in the existing codebase, I figured it would be easier to do a rewrite from scratch.
|
54
|
+
I also had some ideas for extensions of the story grammar, so I decided to use "Treetop":http://treetop.rubyforge.org/
|
55
|
+
and base it on a proper "grammar":http://github.com/aslakhellesoy/cucumber/tree/master/lib/cucumber/treetop_parser/feature.treetop.erb
|
56
|
+
|
57
|
+
Cucumber addresses all of the shortcomings of RSpec's Story runner. If the community likes it, we'll consider phasing out
|
58
|
+
the RSpec story runner.
|
59
|
+
|
60
|
+
The term "Feature" has been adopted in favour of "Story" because I believe it is a more appropriate term. A feature's scenarios
|
61
|
+
typically increases over time - fed by several user stories.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Addition
|
2
|
+
As a math idiot
|
3
|
+
I want to be told the sum of two numbers
|
4
|
+
So that I don't make silly mistakes
|
5
|
+
|
6
|
+
Scenario: Add two numbers
|
7
|
+
Given I have entered 50 into the calculator
|
8
|
+
And I have entered 70 into the calculator
|
9
|
+
When I add
|
10
|
+
Then the result should be 121 on the screen
|
11
|
+
And the result class should be Fixnum
|
12
|
+
|
13
|
+
| input_1 | input_2 | output | class |
|
14
|
+
| 20 | 30 | 50 | Fixnum |
|
15
|
+
| 2 | 5 | 7 | Fixnum |
|
16
|
+
| 20 | 40 | 80 | Number |
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Division
|
2
|
+
As a math genius
|
3
|
+
I want to be told the division of two floats
|
4
|
+
So that I don't make silly mistakes
|
5
|
+
|
6
|
+
Scenario: Regular numbers
|
7
|
+
Given I have entered 3 into the calculator
|
8
|
+
And I have entered 2 into the calculator
|
9
|
+
When I press divide
|
10
|
+
Then the result should be 1.5 on the screen
|
11
|
+
And the result class should be Float
|
12
|
+
And it should rain on Friday
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calculator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /I have entered (\d+) into the calculator/ do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When /I press (\w+)/ do |op|
|
17
|
+
@result = @calc.send op
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /the result should be (.*) on the screen/ do |result|
|
21
|
+
@result.should == result.to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /the result class should be (\w*)/ do |class_name|
|
25
|
+
@result.class.name.should == class_name
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /it should rain on (\w+)/ do |day|
|
29
|
+
@calc.rain?(day).should == true
|
30
|
+
end
|
31
|
+
|
@@ -20,33 +20,3 @@ This will compile the java code and package it in a jar file, and then run Cucum
|
|
20
20
|
that code.
|
21
21
|
|
22
22
|
There is a deliberate error. See if you can fix it!
|
23
|
-
|
24
|
-
h2. Background and Credits
|
25
|
-
|
26
|
-
Cucumber is a rewrite of RSpec's "Story runner", which was originally written by Dan North. Dan's original
|
27
|
-
implementation required that stories be written in Ruby. Shortly after, David Chelimsky added
|
28
|
-
"plain text":http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-plain-english support.
|
29
|
-
|
30
|
-
This brought executable stories a little closer to non-technical users, which is one of the target audiences
|
31
|
-
for this kind of tool.
|
32
|
-
|
33
|
-
However, the RSpec Story runner has several shortcomings which is rather common for tools that move into new territory.
|
34
|
-
Some of the biggest problems with it are:
|
35
|
-
|
36
|
-
* Hard to get started with. A special "all.rb" file must be written before it can be used.
|
37
|
-
* No out of the box Rake support, which puts a lot of people off.
|
38
|
-
* No i18n, so if you want to write stories in a different language than English you're out of luck.
|
39
|
-
* Poor error reporting. No way to know on what line a plain text story failed during execution or parsing.
|
40
|
-
* Limited colouring of output.
|
41
|
-
* No simple way to execute only one scenario.
|
42
|
-
* No command line tool to run stories.
|
43
|
-
|
44
|
-
While all of this could have been fixed in the existing codebase, I figured it would be easier to do a rewrite from scratch.
|
45
|
-
I also had some ideas for extensions of the story grammar, so I decided to use "Treetop":http://treetop.rubyforge.org/
|
46
|
-
and base it on a proper "grammar":http://github.com/aslakhellesoy/cucumber/tree/master/lib/cucumber/treetop_parser/feature.treetop.erb
|
47
|
-
|
48
|
-
Cucumber addresses all of the shortcomings of RSpec's Story runner. If the community likes it, we'll consider phasing out
|
49
|
-
the RSpec story runner.
|
50
|
-
|
51
|
-
The term "Feature" has been adopted in favour of "Story" because I believe it is a more appropriate term. A feature's scenarios
|
52
|
-
typically increases over time - fed by several user stories.
|
data/lib/cucumber/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
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: 2008-08-
|
12
|
+
date: 2008-08-07 00:00:00 -07:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -80,6 +80,11 @@ files:
|
|
80
80
|
- bin/cucumber
|
81
81
|
- config/hoe.rb
|
82
82
|
- config/requirements.rb
|
83
|
+
- examples/calculator/Rakefile
|
84
|
+
- examples/calculator/features/addition.feature
|
85
|
+
- examples/calculator/features/division.feature
|
86
|
+
- examples/calculator/features/steps/addition_steps.rb
|
87
|
+
- examples/calculator/lib/calculator.rb
|
83
88
|
- examples/java/README.textile
|
84
89
|
- examples/java/Rakefile
|
85
90
|
- examples/java/features/hello.feature
|
@@ -90,10 +95,6 @@ files:
|
|
90
95
|
- examples/pure_ruby/Rakefile
|
91
96
|
- examples/pure_ruby/features/addition.rb
|
92
97
|
- examples/pure_ruby/features/steps/addition_steps.rb
|
93
|
-
- examples/simple/Rakefile
|
94
|
-
- examples/simple/features/addition.feature
|
95
|
-
- examples/simple/features/division.feature
|
96
|
-
- examples/simple/features/steps/addition_steps.rb
|
97
98
|
- examples/simple_norwegian/Rakefile
|
98
99
|
- examples/simple_norwegian/features/steps/matte_steg.rb.rb
|
99
100
|
- examples/simple_norwegian/features/summering.feature
|