[Cucumber:4093] [ANN] Cucumber 0.7.0.beta.2

94 views
Skip to first unread message

aslak hellesoy

unread,
Apr 21, 2010, 6:53:06 PM4/21/10
to cu...@googlegroups.com
Dear Cukers,

I'm very excited to announce the 2nd beta release of Cucumber 0.7.0.
(The 1st beta release was silently made a couple of days ago). I'm
excited because we have a brand new feature parser that is 80-100
times faster than before. This is great news for all you people who
have grown your Cucumber feature suites to hundreds of scenarios (or
even features). With previous versions of Cucumber it could take a
minute or more to just _parse_ the .feature files - before anything
even started executing.

== FAST ==

If parsing takes a minute for you, upgrading to 0.7.0.beta.2 should
reduce parse time to less than a second. So before you upgrade, please
run all of your features one last time with the old version and pass
the --verbose flag. This should print the time it takes to parse
features. Write it down.

Upgrade and run with --verbose again. Write it down. Please share both
number with us so we can get some data on how much time this saves for
people.

== TAGS ==

Had you given up on --tags because your feature suite was so big and
took so long to parse? Pick it up again :-)

== UPGRADING ==

gem update cucumber --prerelease

cucumber 0.7.0 should be a drop-in replacement for 0.6.4 (apart from
some minor potential changes to your feature files - see below). But
we can't be 100% sure before some of you have tried it. Please report
back to us so we can fix any bad issues before 0.7.0 final. We're
especially interested in getting some feedback from Windows users - we
haven't had time to test much on Windows yet (we just assume it will
work, hehe).

== GHERKIN ==

If you're wondering how we can get such a massive speed increase, it's
due to the new gherkin parser. The previous one was written in
Treetop, which is a nice, but very slow parser generator. It served us
well for nearly 2 years. Thanks Treetop. Ragel is a much, much faster
parser generator. A brand new parser based on Ragel has been written
from scratch. This parser now lives in the gherkin gem.

This would not have been feasible if it hadn't been for the duo Greg
Hnatiuk and Mike Sassak. They picked up the gauntlet I threw 6 months
ago when I asked for a faster parser. The code they have written is
very very clean. Thanks guys, you kick ass!

The gherkin parser isn't just extremely fast, it's also extremely
solid. Gherkin is mostly native code (C for MRI and Java for JRuby).
There is even Windows-specific gherkin gems with precompiled C code.

== GRAMMAR ==

We have tried to make the grammar of the new gherkin parser as
identical as possible to the old one. However, there are some minor
differences:

* Each feature file *must* start with a "Feature:" keyword. Run
cucumber --i18n help and cucumber --i18n LANG for details.
* You can now put tags above Examples. This gives you more flexibility
for --tags filtering.
* You are now allowed to have comments between table rows.
* You can't have comments at the end of a line # like this
* # Only like this

== I18N ==

Since all of the Treetop code is now gone from Cucumber, so is the
languages.yml file. So if you want to contribute a new translation
that now happens in the gherkin gem.

== BETTER TOOL SUPPORT ==

Another nice feature of Gherkin is code generation support for other
tools. -Like text editors and IDEs. Thanks to this, Gherkin's 40+ i18n
translations are now supported by several text editors and syntax
highlighters: http://wiki.github.com/aslakhellesoy/gherkin/tool-support

Generating Gherkin aware source code for *your* tool has never been easier.

== PRETTY PRINTING ==

Another *really* nice thing we built into gherkin is pretty-printing
of features (without running them). Not only indentation, but also
alignment of table cells. This pretty printer is implemented both in
pure Ruby and in Pure Java, making it easy to integrate with other
tools. As you can see on Gherkin's Tools page, the NetBeans IDE
already have support for autoformatting of Gherkin features.

Now this is a lot of stuff. Go crazy with it.

--The Cucumber team

--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.

Tim Walker

unread,
Apr 21, 2010, 8:01:05 PM4/21/10
to cu...@googlegroups.com
Awesome! Great work.

Does this mean the polyglot dependency is gone?

Thanks again!

Tim

Luke Melia

unread,
Apr 21, 2010, 11:08:37 PM4/21/10
to cu...@googlegroups.com, te...@weplay.com
On Apr 21, 2010, at 6:53 PM, aslak hellesoy wrote:

> Upgrade and run with --verbose again. Write it down. Please share both
> number with us so we can get some data on how much time this saves for
> people.


0.6.4: Parsing feature files took 1m7.858s
0.7.0.beta.2: Parsing feature files took 0m5.418s

Very nice!!!!! Great job.

Cheers,
Luke
--
Luke Melia
lu...@lukemelia.com
http://www.lukemelia.com/

Andrew Premdas

unread,
Apr 22, 2010, 1:26:41 AM4/22/10
to cu...@googlegroups.com
On 22 April 2010 04:08, Luke Melia <lu...@lukemelia.com> wrote:
On Apr 21, 2010, at 6:53 PM, aslak hellesoy wrote:

Upgrade and run with --verbose again. Write it down. Please share both
number with us so we can get some data on how much time this saves for
people.


0.6.4: Parsing feature files took 1m7.858s
0.7.0.beta.2: Parsing feature files took 0m5.418s

Very nice!!!!! Great job.

Cheers,
Luke
--
Luke Melia
lu...@lukemelia.com
http://www.lukemelia.com/


0.6.4
==== 
Parsing feature files took 0m16.378s
420 scenarios
2826 steps

0.7.0b2
======
Parsing feature files took 0m0.383s 

Luke could you put your number of scenarios and steps - I'm wondering if your features are just massively bigger than ours, or if our lack of nested steps is making parsing quicker... thanks

Aslak & co - stunning work on the parser very much appreciated

All best

Andrew

Mike Sassak

unread,
Apr 22, 2010, 1:50:07 AM4/22/10
to cu...@googlegroups.com
+1. In addition to that we'd very much appreciate it if all those
kindly posting their results include:

1) the ruby version and implementation
2) a characterization of your feature suite (small scenarios, huge
scenarios, tons of scenario outlines, a billion nested steps,
py_strings galore etc.)

I personally am most interested in 2). I suspect that suites that make
heavy use of tables or py_strings will see less of an improvement than
others, but that's only a suspicion at this point. So far we've
focused entirely on correctness and robustness. As a result the C
implementation does some things that likely make MRI's heap allocator
and garbage collector cry. Optimizing it will be fun. :-)

Thanks for all the feedback so far. Keep it coming!

Mike

Mike Sassak

unread,
Apr 22, 2010, 1:54:29 AM4/22/10
to cu...@googlegroups.com
On Wed, Apr 21, 2010 at 8:01 PM, Tim Walker <walk...@gmail.com> wrote:
> Awesome! Great work.
>
> Does this mean the polyglot dependency is gone?

Yes.

Jonathan Tron

unread,
Apr 22, 2010, 3:11:12 AM4/22/10
to Cukes
Here's my results :

Feature: 162
Scenario: 902
Steps: 12993
32m34.321s

Cucumber 0.6.4 :

Parsing feature files took 1m44.918s

Cucumber 0.7.0b2

Parsing feature files took 0m1.520s

Amazing job guys !

Gherkin project is just awesome, I used it some months ago to develop
a prototype of rule engine and this has proven to be both reliable,
fast and clean.

Andrew Premdas

unread,
Apr 22, 2010, 4:25:22 AM4/22/10
to cu...@googlegroups.com

Andrew Premdas

unread,
Apr 22, 2010, 4:41:46 AM4/22/10
to cu...@googlegroups.com
Update for Mike hope its useful

ruby 1.8.7p249 MRI, OSX 10.6
no nested steps (well maybe half a dozen at most
step defs 258 KB on disk (132,454 bytes) for 65 items
features 336 KB on disk (163,051 bytes) for 88 items

Very simple features 
42 scenario outlines
limited use of tables
quite a few tags

0.6.4
====
Parsing feature files took 0m16.378s
420 scenarios
2826 steps
0.7.0b2
======
Parsing feature files took 0m0.383s

On 22 April 2010 06:50, Mike Sassak <msa...@gmail.com> wrote:

Karl Baum

unread,
Apr 22, 2010, 7:37:26 AM4/22/10
to cu...@googlegroups.com
I was using cucumber 0.6.2 because i was lazy about upgrading :-).
With cucumber 0.7.0 i am getting errors with step defs beginning
within 'And'

And "I have several receipts in my weshop account" do
3.times { Factory(:receipt, :user => @current_user) }
end

undefined method `And' for main:Object (NoMethodError)
/Users/karl/NetBeansProjects/weshopnetwork/features/step_definitions/
weshop_steps.rb:269
/Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/
rubygems/custom_require.rb:31:in `gem_original_require'
/Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/
rubygems/custom_require.rb:31:in `require'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/activesupport-2.3.5/
lib/active_support/dependencies.rb:158:in `require'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/rb_support/rb_language.rb:119:in `load_code_file'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/step_mother.rb:83:in `load_code_file'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/step_mother.rb:75:in `load_code_files'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/step_mother.rb:74:in `each'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/step_mother.rb:74:in `load_code_files'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/cli/main.rb:51:in `execute!'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/cli/main.rb:20:in `execute'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/
bin/cucumber:8
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/bin/cucumber:19:in `load'
/Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/bin/cucumber:19

Thanks!

-karl


On Apr 21, 2010, at 6:53 PM, aslak hellesoy wrote:

aslak hellesoy

unread,
Apr 22, 2010, 7:51:01 AM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 1:37 PM, Karl Baum <karl...@gmail.com> wrote:
> I was using cucumber 0.6.2 because i was lazy about upgrading :-).  With
> cucumber 0.7.0 i am getting errors with step defs beginning within 'And'
>
> And "I have several receipts in my weshop account" do
>  3.times { Factory(:receipt, :user => @current_user) }
> end
>

That's one of the changes in 0.7.0 I forgot to mention.

You can only use Given, When and Then (or any i18n translation) for
step definitions.

The reason is that I want to discourage people from using And and But
in step definitions, as it (intuitively) undermines their reuse. It
can make the impression that it has to follow another step definition,
but this isn't necessarily the case.

I'm open to discuss this though. What's a good reason to use And in a stepdef?

Aslak

> undefined method `And' for main:Object (NoMethodError)
> /Users/karl/NetBeansProjects/weshopnetwork/features/step_definitions/weshop_steps.rb:269
> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in
> `require'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/rb_support/rb_language.rb:119:in
> `load_code_file'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:83:in
> `load_code_file'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:75:in
> `load_code_files'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
> `each'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
> `load_code_files'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:51:in
> `execute!'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:20:in
> `execute'
> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/cucumber:8

Ben Lovell

unread,
Apr 22, 2010, 8:22:10 AM4/22/10
to cu...@googlegroups.com
On 22 April 2010 12:51, aslak hellesoy <aslak.h...@gmail.com> wrote:
On Thu, Apr 22, 2010 at 1:37 PM, Karl Baum <karl...@gmail.com> wrote:
> I was using cucumber 0.6.2 because i was lazy about upgrading :-).  With
> cucumber 0.7.0 i am getting errors with step defs beginning within 'And'
>
> And "I have several receipts in my weshop account" do
>  3.times { Factory(:receipt, :user => @current_user) }
> end
>

That's one of the changes in 0.7.0 I forgot to mention.

You can only use Given, When and Then (or any i18n translation) for
step definitions.

The reason is that I want to discourage people from using And and But
in step definitions, as it (intuitively) undermines their reuse. It
can make the impression that it has to follow another step definition,
but this isn't necessarily the case.

I'm open to discuss this though. What's a good reason to use And in a stepdef?

Aslak


If And & Given were synonymous this would solve literally 99% of these cases surely?

Cheers,
Ben

aslak hellesoy

unread,
Apr 22, 2010, 8:23:20 AM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 2:22 PM, Ben Lovell <benjami...@gmail.com> wrote:
> On 22 April 2010 12:51, aslak hellesoy <aslak.h...@gmail.com> wrote:
>>
>> On Thu, Apr 22, 2010 at 1:37 PM, Karl Baum <karl...@gmail.com> wrote:
>> > I was using cucumber 0.6.2 because i was lazy about upgrading :-).  With
>> > cucumber 0.7.0 i am getting errors with step defs beginning within 'And'
>> >
>> > And "I have several receipts in my weshop account" do
>> >  3.times { Factory(:receipt, :user => @current_user) }
>> > end
>> >
>>
>> That's one of the changes in 0.7.0 I forgot to mention.
>>
>> You can only use Given, When and Then (or any i18n translation) for
>> step definitions.
>>
>> The reason is that I want to discourage people from using And and But
>> in step definitions, as it (intuitively) undermines their reuse. It
>> can make the impression that it has to follow another step definition,
>> but this isn't necessarily the case.
>>
>> I'm open to discuss this though. What's a good reason to use And in a
>> stepdef?
>>
>> Aslak
>>
>
> If And & Given were synonymous this would solve literally 99% of these cases
> surely?

What cases? What do you mean by solve? Got an example?

Aslak

byrnejb

unread,
Apr 22, 2010, 8:47:22 AM4/22/10
to Cukes


On Apr 21, 6:53 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:

> == UPGRADING ==
>
> gem update cucumber --prerelease
>

I do not seem able to obtain it. Is there a specific source
repository that I should make known to RubyGems?

[root@inet04 ~]# gem update cucumber --prerelease --force
Updating installed gems
Nothing to update

byrnejb

unread,
Apr 22, 2010, 8:51:17 AM4/22/10
to Cukes


On Apr 22, 8:47 am, byrnejb <byrn...@harte-lyne.ca> wrote:
> On Apr 21, 6:53 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
>
> > == UPGRADING ==
>
> > gem update cucumber --prerelease
>
> I do not seem able to obtain it.  Is there a specific source
> repository that I should make known to RubyGems?
>
> [root@inet04 ~]# gem update cucumber --prerelease --force
> Updating installed gems
> Nothing to update
>

It appears in my case that gem install is required rather than gem
update:

gem install cucumber --prerelease
Building native extensions. This could take a while...

byrnejb

unread,
Apr 22, 2010, 8:57:25 AM4/22/10
to Cukes


On Apr 22, 8:51 am, byrnejb <byrn...@harte-lyne.ca> wrote:

> > On Apr 21, 6:53 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
>
> > > == UPGRADING ==
>
> > > gem update cucumber --prerelease
>
> > I do not seem able to obtain it.  Is there a specific source
> > repository that I should make known to RubyGems?
>
> > [root@inet04 ~]# gem update cucumber --prerelease --force
> > Updating installed gems
> > Nothing to update
>
> It appears in my case that gem install is required rather than gem
> update:
>
> gem install cucumber --prerelease
> Building native extensions.  This could take a while...
. . .
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
(::)

Successfully installed trollop-1.16.2
Successfully installed gherkin-1.0.18
Successfully installed cucumber-0.7.0.beta.2
3 gems installed

rake cucumber --verbose
. . .
/usr/bin/ruby -I "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
lib:lib" "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/
cucumber" --profile default
/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/../lib/
cucumber/ast/feature_element.rb:2:in `require': no such file to load
-- gherkin/parser/tag_expression (LoadError)
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/ast/feature_element.rb:2
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/ast/background.rb:1:in `require'
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/ast/background.rb:1
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/ast.rb:4:in `require'
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/ast.rb:4
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/parser.rb:2:in `require'
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/parser.rb:2
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber.rb:6:in `require'
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber.rb:6
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/cli/main.rb:2:in `require'
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/
bin/../lib/cucumber/cli/main.rb:2
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/
cucumber:5:in `require'
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/
cucumber:5
rake aborted!
Command failed with status (1): [/usr/bin/ruby -I "/usr/lib64/ruby/
gems/1.8...]

(See full trace by running task with --trace)

Am I missing something?

Luke Melia

unread,
Apr 22, 2010, 9:17:17 AM4/22/10
to cu...@googlegroups.com
I was seeing this error when I had vendored cucumber and cucumber-
rails as plugins. For testing, I just removed them and ran with the
installed gems, and everything worked OK. Ultimately, though, I'd
prefer to keep dependencies vendored (those without native extensions,
anyway).

Karl Baum

unread,
Apr 22, 2010, 9:46:10 AM4/22/10
to cu...@googlegroups.com
Sometimes 'And' just seems to flow nicely in my scenarios. When i
need two given conditions for example:

Given a user with username "foo"
And a user with username "bar"

Or if i have to make two assertions to make:

When I press "submit"
Then I should see "Preferences Saved"
And my preferences should be updated

Thanks!

-karl



On Apr 22, 2010, at 7:51 AM, aslak hellesoy wrote:

> On Thu, Apr 22, 2010 at 1:37 PM, Karl Baum <karl...@gmail.com>
> wrote:
>> I was using cucumber 0.6.2 because i was lazy about upgrading :-).
>> With
>> cucumber 0.7.0 i am getting errors with step defs beginning within
>> 'And'
>>
>> And "I have several receipts in my weshop account" do
>> 3.times { Factory(:receipt, :user => @current_user) }
>> end
>>
>
> That's one of the changes in 0.7.0 I forgot to mention.
>
> You can only use Given, When and Then (or any i18n translation) for
> step definitions.
>
> The reason is that I want to discourage people from using And and But
> in step definitions, as it (intuitively) undermines their reuse. It
> can make the impression that it has to follow another step definition,
> but this isn't necessarily the case.
>
> I'm open to discuss this though. What's a good reason to use And in
> a stepdef?
>
> Aslak
>
>> undefined method `And' for main:Object (NoMethodError)
>> /Users/karl/NetBeansProjects/weshopnetwork/features/
>> step_definitions/weshop_steps.rb:269
>> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/
>> 1.8/rubygems/custom_require.rb:31:in

Mike Sassak

unread,
Apr 22, 2010, 10:26:21 AM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 9:46 AM, Karl Baum <karl...@gmail.com> wrote:
> Sometimes 'And' just seems to flow nicely in my scenarios.  When i need two
> given conditions for example:
>
> Given a user with username "foo"
> And a user with username "bar"
>
> Or if i have to make two assertions to make:
>
> When I press "submit"
> Then I should see "Preferences Saved"
> And my preferences should be updated
>

You can still use "And" within your features, just not in your step
definitions. You've defined a step definition using "And". Switch the
step definition to Given and you'll stop getting that error under
0.7.0.

Mike

> Thanks!
>
> -karl
>
>
>
> On Apr 22, 2010, at 7:51 AM, aslak hellesoy wrote:
>
>> On Thu, Apr 22, 2010 at 1:37 PM, Karl Baum <karl...@gmail.com> wrote:
>>>
>>> I was using cucumber 0.6.2 because i was lazy about upgrading :-).  With
>>> cucumber 0.7.0 i am getting errors with step defs beginning within 'And'
>>>
>>> And "I have several receipts in my weshop account" do
>>>  3.times { Factory(:receipt, :user => @current_user) }
>>> end
>>>
>>
>> That's one of the changes in 0.7.0 I forgot to mention.
>>
>> You can only use Given, When and Then (or any i18n translation) for
>> step definitions.
>>
>> The reason is that I want to discourage people from using And and But
>> in step definitions, as it (intuitively) undermines their reuse. It
>> can make the impression that it has to follow another step definition,
>> but this isn't necessarily the case.
>>
>> I'm open to discuss this though. What's a good reason to use And in a
>> stepdef?
>>
>> Aslak
>>
>>> undefined method `And' for main:Object (NoMethodError)
>>>
>>> /Users/karl/NetBeansProjects/weshopnetwork/features/step_definitions/weshop_steps.rb:269
>>>
>>> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
>>> `gem_original_require'
>>>
>>> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
>>> `require'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in
>>> `require'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/rb_support/rb_language.rb:119:in
>>> `load_code_file'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:83:in
>>> `load_code_file'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:75:in
>>> `load_code_files'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
>>> `each'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
>>> `load_code_files'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:51:in
>>> `execute!'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:20:in
>>> `execute'
>>>
>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/cucumber:8

Robert Hanson

unread,
Apr 22, 2010, 10:40:02 AM4/22/10
to cu...@googlegroups.com
I've been writing my steps in the feature file with "And", but in the step definition file I always use "Given", "When" or "Then". I don't see a problem with requiring people to use "Given", "When" or "Then", as long as "And" and "But" are allowed in feature files.

It makes sense to me.

-----Original Message-----
From: cu...@googlegroups.com [mailto:cu...@googlegroups.com] On Behalf Of aslak hellesoy
Sent: Thursday, April 22, 2010 6:51 AM
To: cu...@googlegroups.com
Subject: Re: [Cucumber:4110] [ANN] Cucumber 0.7.0.beta.2

On Thu, Apr 22, 2010 at 1:37 PM, Karl Baum <karl...@gmail.com> wrote:
> I was using cucumber 0.6.2 because i was lazy about upgrading :-).  
> With cucumber 0.7.0 i am getting errors with step defs beginning within 'And'
>
> And "I have several receipts in my weshop account" do
>  3.times { Factory(:receipt, :user => @current_user) } end
>

That's one of the changes in 0.7.0 I forgot to mention.

You can only use Given, When and Then (or any i18n translation) for step definitions.

The reason is that I want to discourage people from using And and But in step definitions, as it (intuitively) undermines their reuse. It can make the impression that it has to follow another step definition, but this isn't necessarily the case.

I'm open to discuss this though. What's a good reason to use And in a stepdef?

Aslak

> undefined method `And' for main:Object (NoMethodError)
> /Users/karl/NetBeansProjects/weshopnetwork/features/step_definitions/w
> eshop_steps.rb:269
> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/r

Karl Baum

unread,
Apr 22, 2010, 10:46:55 AM4/22/10
to cu...@googlegroups.com
I am fine with changing my step definitions to not use "And", but I'm
not sure i follow the logic in disallowing it.

Thanks!
>>>> /Users/karl/NetBeansProjects/weshopnetwork/features/
>>>> step_definitions/weshop_steps.rb:269
>>>>
>>>> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/
>>>> 1.8/rubygems/custom_require.rb:31:in
>>>> `gem_original_require'
>>>>
>>>> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/
>>>> 1.8/rubygems/custom_require.rb:31:in
>>>> `require'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> activesupport-2.3.5/lib/active_support/dependencies.rb:158:in
>>>> `require'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> cucumber-0.7.0.beta.2/bin/../lib/cucumber/rb_support/
>>>> rb_language.rb:119:in
>>>> `load_code_file'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:83:in
>>>> `load_code_file'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:75:in
>>>> `load_code_files'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
>>>> `each'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
>>>> `load_code_files'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:51:in
>>>> `execute!'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/
>>>> cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:20:in
>>>> `execute'
>>>>
>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/

Robert Hanson

unread,
Apr 22, 2010, 10:45:58 AM4/22/10
to cu...@googlegroups.com
If I understand correctly, its not the scenarios that are changing, just the step definitions. In your step definitions files, where you use And/But, replace that with either When or Then, depending on whether the step is an action or a verifer.


-----Original Message-----
From: cu...@googlegroups.com [mailto:cu...@googlegroups.com] On Behalf Of Karl Baum
Sent: Thursday, April 22, 2010 8:46 AM
To: cu...@googlegroups.com

aslak hellesoy

unread,
Apr 22, 2010, 10:46:30 AM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 4:46 PM, Karl Baum <karl...@gmail.com> wrote:
> I am fine with changing my step definitions to not use "And", but I'm not
> sure i follow the logic in disallowing it.
>

I'll try to explain again.

In a feature file - And has a semantic meaning for the human reader.
It means "the same as above".

In a file with step definitions you should avoid having relationships
between step definitions, as this is opposed to reuse. That's why I
removed And,
as it encourages stepdef relationships (bad).

Aslak
>>>>> /Users/karl/NetBeansProjects/weshopnetwork/features/step_definitions/weshop_steps.rb:269
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
>>>>> `gem_original_require'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/rubies/ruby-1.8.7-tv1_8_7_72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
>>>>> `require'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in
>>>>> `require'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/rb_support/rb_language.rb:119:in
>>>>> `load_code_file'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:83:in
>>>>> `load_code_file'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:75:in
>>>>> `load_code_files'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
>>>>> `each'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/step_mother.rb:74:in
>>>>> `load_code_files'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:51:in
>>>>> `execute!'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/../lib/cucumber/cli/main.rb:20:in
>>>>> `execute'
>>>>>
>>>>>
>>>>> /Users/karl/.rvm/gems/ruby-1.8.7-tv1_8_7_72/gems/cucumber-0.7.0.beta.2/bin/cucumber:8

Karl Baum

unread,
Apr 22, 2010, 10:52:48 AM4/22/10
to cu...@googlegroups.com
Ok... i understand now.

thx!

-karl

byrnejb

unread,
Apr 22, 2010, 11:23:25 AM4/22/10
to Cukes


On Apr 22, 9:17 am, Luke Melia <l...@lukemelia.com> wrote:
> I was seeing this error when I had vendored cucumber and cucumber-
> rails as plugins. For testing, I just removed them and ran with the  
> installed gems, and everything worked OK. Ultimately, though, I'd  
> prefer to keep dependencies vendored (those without native extensions,  
> anyway).

ll vendor/plugins
total 32
drwxrwxr-x 8 byrnejb byrnejb 4096 Apr 12 14:57 activewarehouse-etl
drwxrwxr-x 4 byrnejb byrnejb 4096 Aug 14 2009 irs_process_scripts
drwxrwxr-x 2 byrnejb byrnejb 4096 May 19 2009 prawnto
drwxrwxr-x 6 byrnejb byrnejb 4096 Mar 31 2009 routing_navigator

I do not see how any of these plugins should have any influence on
cucumber.

byrnejb

unread,
Apr 22, 2010, 11:26:52 AM4/22/10
to Cukes


On Apr 22, 7:51 am, aslak hellesoy <aslak.helle...@gmail.com> wrote:

> You can only use Given, When and Then (or any i18n translation) for
> step definitions.
. . .
> I'm open to discuss this though. What's a good reason to use And in a stepdef?
>

I do not do this myself but I can see an argument for using "And" when
employing nested steps

When /something/ do
Then "something else"
And "something more"
And "finally this"
end

Gregory Hnatiuk

unread,
Apr 22, 2010, 11:30:20 AM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 11:26 AM, byrnejb <byr...@harte-lyne.ca> wrote:


On Apr 22, 7:51 am, aslak hellesoy <aslak.helle...@gmail.com> wrote:

> You can only use Given, When and Then (or any i18n translation) for
> step definitions.
.  .  .
> I'm open to discuss this though. What's a good reason to use And in a stepdef?
>

I do not do this myself but I can see an argument for using "And" when
employing nested steps

When /something/ do
 Then "something else"
   And "something more"
   And "finally this"
end


If you use the newer helper for nesting steps:

When /something/ do
  steps %Q{
      Then something else
      And something more
      And finally this
   }
end
 
you can freely use Ands and Buts in your step definitions, as they are parsed just like your features.

Greg

--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.

David Chelimsky

unread,
Apr 22, 2010, 11:31:02 AM4/22/10
to cu...@googlegroups.com

On Apr 22, 2010, at 9:46 AM, aslak hellesoy wrote:

> On Thu, Apr 22, 2010 at 4:46 PM, Karl Baum <karl...@gmail.com> wrote:
>> I am fine with changing my step definitions to not use "And", but I'm not
>> sure i follow the logic in disallowing it.
>>
>
> I'll try to explain again.
>
> In a feature file - And has a semantic meaning for the human reader.
> It means "the same as above".
>
> In a file with step definitions you should avoid having relationships
> between step definitions, as this is opposed to reuse. That's why I
> removed And,
> as it encourages stepdef relationships (bad).

This is one of those "how much rope?" situations. I was originally opposed to this feature even existing, but I use it sparingly now and I find it very useful in moderation. That said, disallowing And and But in the step definitions makes this feature less valuable in process. Consider: I've got a scenario that says:

Given a
And b
And c

And then I want to encapsulate that in a step definition for use in other scenarios:

Given a, b, and c

So I copy from the feature:

Given /^a, b, and c$/ do
steps %Q{
Given a
And b
And c
}
end

And _now_ I have to convert the And's to Given's

Given /^a, b, and c$/ do
steps %Q{
Given a
Given b
Given c
}
end

This extra step makes it harder to use this feature, and it also makes it harder for me to scan features and step definitions and quickly see the relationship between these steps and the ones in a feature. I think in this case we should support And and But and encourage proper moderate use of this feature, rather than making it only work half as well as it could.

FWIW,
David

aslak hellesoy

unread,
Apr 22, 2010, 11:38:21 AM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 5:30 PM, Gregory Hnatiuk <ghna...@gmail.com> wrote:
>
>
> On Thu, Apr 22, 2010 at 11:26 AM, byrnejb <byr...@harte-lyne.ca> wrote:
>>
>>
>> On Apr 22, 7:51 am, aslak hellesoy <aslak.helle...@gmail.com> wrote:
>>
>> > You can only use Given, When and Then (or any i18n translation) for
>> > step definitions.
>> .  .  .
>> > I'm open to discuss this though. What's a good reason to use And in a
>> > stepdef?
>> >
>>
>> I do not do this myself but I can see an argument for using "And" when
>> employing nested steps
>>
>> When /something/ do
>>  Then "something else"
>>    And "something more"
>>    And "finally this"
>> end
>>
>
> If you use the newer helper for nesting steps:
> When /something/ do
>   steps %Q{
>       Then something else
>       And something more
>       And finally this
>    }
> end
>
> you can freely use Ands and Buts in your step definitions, as they are
> parsed just like your features.

Which reminds me, Greg. We're not using Gherkin here yet - just the
fragile regexp parser. Something we should fix before 0.7.0 final!

Aslak

byrnejb

unread,
Apr 22, 2010, 11:50:53 AM4/22/10
to Cukes


On Apr 22, 11:30 am, Gregory Hnatiuk <ghnat...@gmail.com> wrote:

> If you use the newer helper for nesting steps:
>
> When /something/ do
>   steps %Q{
>       Then something else
>       And something more
>       And finally this
>    }
> end
>
> you can freely use Ands and Buts in your step definitions, as they are
> parsed just like your features.

I really, really do not see this as an improvement. First, one needs
to know that the "steps" helper exists. Two, it adds a level of
obscure syntax without any discernible benefit over the straight
forward use of Given, When, Then, And or But.

aslak hellesoy

unread,
Apr 22, 2010, 11:55:17 AM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 5:50 PM, byrnejb <byr...@harte-lyne.ca> wrote:
>
>
> On Apr 22, 11:30 am, Gregory Hnatiuk <ghnat...@gmail.com> wrote:
>
>> If you use the newer helper for nesting steps:
>>
>> When /something/ do
>>   steps %Q{
>>       Then something else
>>       And something more
>>       And finally this
>>    }
>> end
>>
>> you can freely use Ands and Buts in your step definitions, as they are
>> parsed just like your features.
>
> I really, really do not see this as an improvement.  First, one needs
> to know that the "steps" helper exists.

That is true for anything you use. Even your toothbrush.

The intent is that you can more easily copy from a feature and paste
into a stepdef - without the need to edit.

That said - I get your point about using And and But in stepdefs. Any
purist objections if I add them back?

Aslak

Mike Sassak

unread,
Apr 22, 2010, 12:07:24 PM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 11:55 AM, aslak hellesoy
<aslak.h...@gmail.com> wrote:
> On Thu, Apr 22, 2010 at 5:50 PM, byrnejb <byr...@harte-lyne.ca> wrote:
>>
>>
>> On Apr 22, 11:30 am, Gregory Hnatiuk <ghnat...@gmail.com> wrote:
>>
>>> If you use the newer helper for nesting steps:
>>>
>>> When /something/ do
>>>   steps %Q{
>>>       Then something else
>>>       And something more
>>>       And finally this
>>>    }
>>> end
>>>
>>> you can freely use Ands and Buts in your step definitions, as they are
>>> parsed just like your features.
>>
>> I really, really do not see this as an improvement.  First, one needs
>> to know that the "steps" helper exists.
>
> That is true for anything you use. Even your toothbrush.
>
> The intent is that you can more easily copy from a feature and paste
> into a stepdef - without the need to edit.
>
> That said - I get your point about using And and But in stepdefs. Any
> purist objections if I add them back?

I think they're best left out for the reasons you mentioned. IMO, the
steps helper is much cleaner, and because this is Ruby, it takes about
two seconds to put them back in if you really want them:

class Object
def And(*args, &blk)
Given(*args, &blk)
end
end

Plop that in features/support/and.rb, and you'll be good to go.

Mike

Aslak Hellesøy

unread,
Apr 22, 2010, 12:15:06 PM4/22/10
to Cukes
Hot on the heels of Cucumber, I've also released a beta of Cuke4Duke,
bringing all the same goodness to the JVM world.

http://github.com/aslakhellesoy/cuke4duke/blob/v0.3.0.beta.1/History.txt

To upgrade, add this to your pom:

<gem>install gherkin --version 1.0.18</gem>
<gem>install cuke4duke --version 0.3.0.beta.1</gem>

I'd love to get some before and after parse times from you java people
too. Pass --verbose to cucumber and let us know the numbers!

Aslak
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/cukes?hl=en.

aslak hellesoy

unread,
Apr 22, 2010, 12:27:45 PM4/22/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 2:57 PM, byrnejb <byr...@harte-lyne.ca> wrote:
>
>
> On Apr 22, 8:51 am, byrnejb <byrn...@harte-lyne.ca> wrote:
>
>> > On Apr 21, 6:53 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
>>
>> > > == UPGRADING ==
>>
>> > > gem update cucumber --prerelease
>>
>> > I do not seem able to obtain it.  Is there a specific source
>> > repository that I should make known to RubyGems?
>>
>> > [root@inet04 ~]# gem update cucumber --prerelease --force
>> > Updating installed gems
>> > Nothing to update
>>
>> It appears in my case that gem install is required rather than gem
>> update:
>>
>> gem install cucumber --prerelease
>> Building native extensions.  This could take a while...
> .  .  .
> (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
> (::)
>
> Successfully installed trollop-1.16.2
> Successfully installed gherkin-1.0.18
> Successfully installed cucumber-0.7.0.beta.2
> 3 gems installed
>
> rake cucumber --verbose

It looks like rubygems isn't loaded. Don't get fooled by the
backtraces. You're running off the cucumber that lives in the rubygems
dir, but the rubygems _code_ still might not be loaded. I think.

What happens when you do:

/usr/bin/ruby -r rubygems -I
"/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/lib:lib"
"/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/cucumber"
--profile default

(Note the explicit loading of rubygems)

Aslak

George Dinwiddie

unread,
Apr 22, 2010, 1:07:32 PM4/22/10
to cu...@googlegroups.com
David,

I don't think so. (see below)
I don't think you have to change this. As I understand it, you're
allowed to use And or But when /invoking/ a step, but it doesn't make
sense to do so where you're /defining/ a step. Where a step invokes
other steps, I think And or But are just fine.

- George


--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

Mike Sassak

unread,
Apr 22, 2010, 1:17:43 PM4/22/10
to cu...@googlegroups.com
Almost. :-)

This is okay:

Given "doing something with embedded steps" do
steps %Q{
Given one
And two
}
end

Notice the use of the #steps helper.

The following two were once possible, but currently are *not*:

And "my favorite step definition" do
# do something
end

Given "calling a step within a step" do
And %Q{some other step}
end

The And method is no longer being defined on Object, so you can't call
it directly like you can Given, When and Then.

HTH,
Mike

Mike Gaffney

unread,
Apr 22, 2010, 1:28:22 PM4/22/10
to cu...@googlegroups.com
Under JRuby:

78 scenarios
792 steps

Cucumber 0.6.4
Parsing feature files took 0m6.760s

Cucumber 0.7.0.beta.2
Parsing feature files took 0m1.925s

-Mike

Mike Sassak

unread,
Apr 22, 2010, 6:31:12 PM4/22/10
to cu...@googlegroups.com
On Wed, Apr 21, 2010 at 11:08 PM, Luke Melia <lu...@lukemelia.com> wrote:
> On Apr 21, 2010, at 6:53 PM, aslak hellesoy wrote:
>
>> Upgrade and run with --verbose again. Write it down. Please share both
>> number with us so we can get some data on how much time this saves for
>> people.
>
>
> 0.6.4: Parsing feature files took 1m7.858s
> 0.7.0.beta.2: Parsing feature files took 0m5.418s
>
> Very nice!!!!! Great job.
>

Hi Luke,

Thanks for testing the beta out! Can you run your features again and
see if any warnings about "Reverting to the Ruby lexer" are printed
out at the top? If not, can you tell us the details of your Ruby
setup? I'm curious as to why you didn't see as much of a speed up as
some others have.

Thanks,
Mike

> Cheers,
> Luke

Luke Melia

unread,
Apr 22, 2010, 6:45:32 PM4/22/10
to cu...@googlegroups.com
On Apr 22, 2010, at 6:31 PM, Mike Sassak wrote:

>> 0.6.4: Parsing feature files took 1m7.858s
>> 0.7.0.beta.2: Parsing feature files took 0m5.418s
>
> Thanks for testing the beta out! Can you run your features again and
> see if any warnings about "Reverting to the Ruby lexer" are printed
> out at the top? If not, can you tell us the details of your Ruby
> setup? I'm curious as to why you didn't see as much of a speed up as
> some others have.

Hi Mike,

I'll give it a try again tonight. But parsing in 7% of the time it
originally took seemed like pretty great improvement to me. Did you
expect more?

I'm running on REE 1.8.7 and have a large app with 389 feature files,
2,498 scenarios, light use of tables and backgrounds, some nested
steps, and a small number of tags, heavily used.

I'm hoping Gherkin will shave around 5 minutes off our build, since we
have two runs (selenium and in-memory), each distributed over four EC2
machines using testjour. The parsing thus happens a several times, so
the speedup should be multiplied. It will be a little while before I
can upgrade our setup and find out for sure.

byrnejb

unread,
Apr 23, 2010, 11:06:58 AM4/23/10
to Cukes


On Apr 22, 12:27 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:

>
> It looks like rubygems isn't loaded. Don't get fooled by the
> backtraces. You're running off the cucumber that lives in the rubygems
> dir, but the rubygems _code_ still might not be loaded. I think.
>
> What happens when you do:
>
> /usr/bin/ruby -r rubygems -I
> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/lib:lib"
> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/cucumber"
> --profile default
>

That solves the problem, but it does not explain why rubygems is not
loaded via the rake task.

$ /usr/bin/ruby -r rubygems -I \
> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/lib:lib" \
> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/cucumber" \
> --profile default
Using the default profile...
.... . . . ....

111 scenarios (111 passed)
1126 steps (1126 passed)
1m6.979s

However, I do not see much of an improvement in performance. It
shaves about 1.6 seconds off a 70 second run time, about 2%.

$ /usr/bin/ruby -I \
> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.6.4/lib:lib" \
> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.6.4/bin/cucumber" \
> --profile default
Using the default profile...
.... . . . ....

111 scenarios (111 passed)
1126 steps (1126 passed)
1m8.599s

byrnejb

unread,
Apr 23, 2010, 11:26:53 AM4/23/10
to Cukes


On Apr 22, 11:55 am, aslak hellesoy <aslak.helle...@gmail.com> wrote:

>
> That is true for anything you use. Even your toothbrush.
>

Yes. However as I recall Cucumber is supposed to present a simplified
generic DSL that is not syntactically bound to its implementation
language. %Q{} is probably not going to be recognized for what it is
outside of the Ruby community, and I suspect not frequently even
there. So, of the two alternative formulations:

When /do something/ do
steps %Q{
Then a step
And another step
}
end

When /do something/ do
Then "a step"
And "another step"
end

Which is the least surprising to someone just learning Cucumber and
possessing a limited, or no, background in Ruby? Both are
idiosyncratic but somehow I feel that the substitution of " for / is
just a little less obscure than 'steps %Q{. . .}'




> The intent is that you can more easily copy from a feature and paste
> into a stepdef - without the need to edit.

I see. I do not generally do that myself but I understand the
attraction of such a feature.

>
> That said - I get your point about using And and But in stepdefs. Any
> purist objections if I add them back?
>

Please keep in mind that I am simply acting as a 'devils advocate' in
this case. I only employ When and Then in step files and I only use
the keyword When in the actual definition, 'When /do something/ do'.
I use Then whenever I call one step from within another, 'Then "do
something"'. So I will not gain or lose anything regardless of how
this matter is resolved.

Aslak Hellesøy

unread,
Apr 23, 2010, 1:15:41 PM4/23/10
to cu...@googlegroups.com, Cukes


Den 23. apr. 2010 kl. 17.26 skrev byrnejb <byr...@harte-lyne.ca>:

>
>
> On Apr 22, 11:55 am, aslak hellesoy <aslak.helle...@gmail.com> wrote:
>
>>
>> That is true for anything you use. Even your toothbrush.
>>
>
> Yes. However as I recall Cucumber is supposed to present a simplified
> generic DSL that is not syntactically bound to its implementation
> language. %Q{}

%Q{} is just one of ruby's many string delimiters. It's not a Cucumber
thing. You can of course use any other Ruby String delimiter.

> is probably not going to be recognized for what it is
> outside of the Ruby community,

Probably not. Your point being?

Are you suggesting that I shouldn't expect (Ruby) Cucumber users to
know Ruby?

> and I suspect not frequently even
> there.

I think you're wrong.

Aslak

Aslak Hellesøy

unread,
Apr 23, 2010, 1:20:13 PM4/23/10
to cu...@googlegroups.com, Cukes


Den 23. apr. 2010 kl. 17.06 skrev byrnejb <byr...@harte-lyne.ca>:

>
>
> On Apr 22, 12:27 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
>
>>
>> It looks like rubygems isn't loaded. Don't get fooled by the
>> backtraces. You're running off the cucumber that lives in the
>> rubygems
>> dir, but the rubygems _code_ still might not be loaded. I think.
>>
>> What happens when you do:
>>
>> /usr/bin/ruby -r rubygems -I
>> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/lib:lib"
>> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/cucumber"
>> --profile default
>>
>
> That solves the problem, but it does not explain why rubygems is not
> loaded via the rake task.
>
> $ /usr/bin/ruby -r rubygems -I \
>> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/lib:lib" \
>> "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.7.0.beta.2/bin/cucumber" \
>> --profile default
> Using the default profile...
> .... . . . ....
>
> 111 scenarios (111 passed)
> 1126 steps (1126 passed)
> 1m6.979s
>
> However, I do not see much of an improvement in performance. It
> shaves about 1.6 seconds off a 70 second run time, about 2%.
>

I thought I had been very precise that Gherkin improves _feature file
parse time_, and (obviously?) not execution time. Your app and
frameworks/db etc is the bottleneck there.

Allow me to repeat what I said in the initial mail: Run with --verbose
to see feature parse time. I'd be surprised if you don't find a
massive improvement there.

Aslak

Jonathan Linowes

unread,
Apr 23, 2010, 2:39:48 PM4/23/10
to cu...@googlegroups.com
when i run
cucumber --verbose
it does not report the parse times, only the total run times

There are some known failures in my test suite (dont ask...)
But a few more after updating the gem (and fixing the And's in step definitions), something to do with instance variables I use to remember "current" objects.
And I have some heavy database lifting to setup a bunch of features, which bloats the run time

So I dont know if this is useful at all, but here ya go:


was
cucumber = 0.6.2

403 scenarios (11 failed, 1 undefined, 391 passed)
3866 steps (11 failed, 15 skipped, 7 undefined, 3833 passed)
47m7.892s


after update
cucumber >= 0.7.0.beta.2

402 scenarios (13 failed, 1 undefined, 388 passed)
3866 steps (13 failed, 23 skipped, 7 undefined, 3823 passed)
44m33.936s


On Apr 21, 2010, at 6:53 PM, aslak hellesoy wrote:

> Dear Cukers,
>
> I'm very excited to announce the 2nd beta release of Cucumber 0.7.0.
> (The 1st beta release was silently made a couple of days ago). I'm
> excited because we have a brand new feature parser that is 80-100
> times faster than before. This is great news for all you people who
> have grown your Cucumber feature suites to hundreds of scenarios (or
> even features). With previous versions of Cucumber it could take a
> minute or more to just _parse_ the .feature files - before anything
> even started executing.
>
> == FAST ==
>
> If parsing takes a minute for you, upgrading to 0.7.0.beta.2 should
> reduce parse time to less than a second. So before you upgrade, please
> run all of your features one last time with the old version and pass
> the --verbose flag. This should print the time it takes to parse
> features. Write it down.
>
> Upgrade and run with --verbose again. Write it down. Please share both
> number with us so we can get some data on how much time this saves for
> people.
>
> == TAGS ==
>
> Had you given up on --tags because your feature suite was so big and
> took so long to parse? Pick it up again :-)
>
> == UPGRADING ==
>
> gem update cucumber --prerelease
>
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
>

-- jonathan linowes
parkerhill technology group llc
jona...@parkerhill.com
office: 603-838-2884

killer app: http://reviewramp.com
tech blog: http://vaporbase.com
personal blog: http://jon.linow.es
twitter: @linojon

Mike Sassak

unread,
Apr 23, 2010, 2:58:36 PM4/23/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 6:45 PM, Luke Melia <lu...@lukemelia.com> wrote:
> On Apr 22, 2010, at 6:31 PM, Mike Sassak wrote:
>
>>> 0.6.4: Parsing feature files took 1m7.858s
>>> 0.7.0.beta.2: Parsing feature files took 0m5.418s
>>
>> Thanks for testing the beta out! Can you run your features again and
>> see if any warnings about "Reverting to the Ruby lexer" are printed
>> out at the top? If not, can you tell us the details of your Ruby
>> setup? I'm curious as to why you didn't see as much of a speed up as
>> some others have.
>
> Hi Mike,
>
> I'll give it a try again tonight. But parsing in 7% of the time it
> originally took seemed like pretty great improvement to me. Did you expect
> more?
>
> I'm running on REE 1.8.7 and have a large app with 389 feature files, 2,498
> scenarios, light use of tables and backgrounds, some nested steps, and a
> small number of tags, heavily used.
>
> I'm hoping Gherkin will shave around 5 minutes off our build, since we have
> two runs (selenium and in-memory), each distributed over four EC2 machines
> using testjour. The parsing thus happens a several times, so the speedup
> should be multiplied. It will be a little while before I can upgrade our
> setup and find out for sure.
>

Hi Luke,

Did you get the chance to rerun it? You're right, I was expecting a
greater increase. Something around 2 seconds to parse, actually. When
we've benchmarked it before the C parser pretty consistently took
1/40th of the time of Treetop, but the Ruby one took around 1/10,
which is close to what you reported. Hence my suspicions.

Thanks again,
Mike

Luke Melia

unread,
Apr 23, 2010, 3:01:00 PM4/23/10
to cu...@googlegroups.com
On Apr 23, 2010, at 2:58 PM, Mike Sassak wrote:

> Did you get the chance to rerun it? You're right, I was expecting a
> greater increase. Something around 2 seconds to parse, actually. When
> we've benchmarked it before the C parser pretty consistently took
> 1/40th of the time of Treetop, but the Ruby one took around 1/10,
> which is close to what you reported. Hence my suspicions.

I haven't yet. I hosed my environment while getting my new MBPro set
up. I'll get it to you as soon as I can.

aslak hellesoy

unread,
Apr 23, 2010, 3:44:53 PM4/23/10
to cu...@googlegroups.com
On Fri, Apr 23, 2010 at 8:39 PM, Jonathan Linowes <lin...@gmail.com> wrote:
> when i run
>        cucumber --verbose
> it does not report the parse times, only the total run times
>

Maybe you missed it. It's reported in the beginning of the output. Can
you gist the full output you get?

> There are some known failures in my test suite (dont ask...)
> But a few more after updating the gem (and fixing the And's in step definitions),

I have re-enabled support for And and But on master.

Jonathan Linowes

unread,
Apr 23, 2010, 3:52:11 PM4/23/10
to cu...@googlegroups.com
Parsing feature files took 0m24.879s

Parsing feature files took 0m0.495s

:)

byrnejb

unread,
Apr 23, 2010, 4:17:07 PM4/23/10
to Cukes

0.6.4 = Parsing feature files took 0m5.576s

0.7.0b2 = Parsing feature files took 0m0.067s

aslak hellesoy

unread,
Apr 23, 2010, 4:54:44 PM4/23/10
to cu...@googlegroups.com
On Fri, Apr 23, 2010 at 10:17 PM, byrnejb <byr...@harte-lyne.ca> wrote:
>
> 0.6.4 = Parsing feature files took 0m5.576s
>
> 0.7.0b2 = Parsing feature files took 0m0.067s
>

Aha! almost 100% faster. You don't have a big feature suite, so it
won't mean much to you though. Others will have more pain relief.

Aslak

Andrew Premdas

unread,
Apr 23, 2010, 6:36:19 PM4/23/10
to cu...@googlegroups.com
IMO its far better to extract methods in your steps rather than nest them to do this sort of thing

so basically get you step defs to look something like this

Given a do
   call_a
end

Given b do
   call_b
end

Given a and b do
  call_a
  call_b
end

where the call_ are method calls to methods defined in a step helper. This will stop you ending up with

Given wibble
   Given a
   And b
end

Given a
  Given x
  And y
end

When I refactored my steps to avoid nesting I often found 4 or 5 levels of nesting, and once had 8 levels. Using modules and methods keeps this complexity under control. Instead of having to parse lots of nested 'natural language' steps you just parse Ruby code, which is far more suitable for expressing the complexity required in step definitions, and keeping control of different levels of functionality

All best

Andrew

byrnejb

unread,
Apr 24, 2010, 11:52:26 AM4/24/10
to Cukes


On Apr 23, 4:54 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
> On Fri, Apr 23, 2010 at 10:17 PM, byrnejb <byrn...@harte-lyne.ca> wrote:
>
> > 0.6.4 = Parsing feature files took 0m5.576s
>
> > 0.7.0b2 = Parsing feature files took 0m0.067s
>
> Aha! almost 100% faster. You don't have a big feature suite, so it
> won't mean much to you though. Others will have more pain relief.

More like 80 times (or 8000%) faster I think. It is good to be
conservative with your claims but there is no need to be that modest.

Rick DeNatale

unread,
Apr 25, 2010, 9:54:18 PM4/25/10
to cu...@googlegroups.com
On Thu, Apr 22, 2010 at 11:55 AM, aslak hellesoy
<aslak.h...@gmail.com> wrote:
> On Thu, Apr 22, 2010 at 5:50 PM, byrnejb <byr...@harte-lyne.ca> wrote:
>>
>>
>> On Apr 22, 11:30 am, Gregory Hnatiuk <ghnat...@gmail.com> wrote:
>>
>>> If you use the newer helper for nesting steps:
>>>
>>> When /something/ do
>>>   steps %Q{
>>>       Then something else
>>>       And something more
>>>       And finally this
>>>    }
>>> end
>>>
>>> you can freely use Ands and Buts in your step definitions, as they are
>>> parsed just like your features.
>>
>> I really, really do not see this as an improvement.  First, one needs
>> to know that the "steps" helper exists.
>
> That is true for anything you use. Even your toothbrush.
>
> The intent is that you can more easily copy from a feature and paste
> into a stepdef - without the need to edit.
>
> That said - I get your point about using And and But in stepdefs. Any
> purist objections if I add them back?
>

+1 for adding And and But back in for the steps helper at least.

I think David's point about being able to easily generate a higher
level step def by cutting and pasting a scenario is vaild.
Particularly since I was one of those asking to bring back
GivenScenario, and this is the best work around.

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

Brian Cardarella

unread,
Apr 27, 2010, 2:44:21 PM4/27/10
to Cukes
Cucumber 0.6.4
Parsing feature files took 0m12.944s


Cucumber 0.7.0-beta.4
Parsing feature files took 0m0.264s

Pretty big improvement!

- Brian

On Apr 23, 4:54 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
> On Fri, Apr 23, 2010 at 10:17 PM, byrnejb <byrn...@harte-lyne.ca> wrote:
>
> > 0.6.4 = Parsing feature files took 0m5.576s
>
> > 0.7.0b2 = Parsing feature files took 0m0.067s
>
> Aha! almost 100% faster. You don't have a big feature suite, so it
> won't mean much to you though. Others will have more pain relief.
>
> Aslak
>
> > --
> > You received this message because you are subscribed to the Google Groups "Cukes" group.
> > To post to this group, send email to cu...@googlegroups.com.
> > To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/cukes?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/cukes?hl=en.
Reply all
Reply to author
Forward
0 new messages