Agile_disciple_small

Ruby Tidbits: Spork your Cucumber

This is a continuation of last week’s post. Not long after Tim Harper released Spork for RSpec, the Cucumber team announced support for Spork in Cucumber. If this sounds like some kind of dining meme, just let me show you how much of a picnic this is to use.

Since the last blog post, Spork 0.5.7 has been released, so I’ll be using that version here. Cucumber is at version 0.3.11.

First, let’s bootstrap Cucumber

  ruby script/generate cucumber

Time to generate some features.

  script/generate feature Spoon color:string size:string

We can make our features pass pretty easily for this example.

  script/generate rspec_scaffold Spoon color:string size:string

Don’t forget to migrate

  rake db:migrate

Now start spork for cucumber

  spork cuc

And run the features

  rake features

Now we’re not going to see much here since this project is so small, but I did time the run on these.

Without Spork

 time rake features

real 0m3.296s
user 0m2.456s
sys 0m0.756s

With Spork:

 time rake features

real 0m1.914s
user 0m1.093s
sys 0m0.298s

I would love to see some real world stats on this on somebody’s cucumber suite. If you want help getting this going on your long running suite, let me know and I’ll lend a hand in exchange for getting some timing results.