[rspec-users] newbie cucumber tutorial

Matt Wynne matt at mattwynne.net
Mon Dec 22 04:37:41 EST 2008

Great stuff.

One thing I'd point out is the missing (and extremely important) step  
3.5 in Rick Denatale's TDD steps: *Refactor to remove duplication*.

Not that there's any refactoring necessary in your example, but it's  
always worth reminding people they should check for it.

On 22 Dec 2008, at 09:01, Sarah Allen wrote:

> I got started with cucumber and it sure is fun.  I've written up my
> initial experience in tutorial format here for any newbies who want to
> follow in my tracks:
> http://www.ultrasaurus.com/code/2008/12/rails-2-day-3.html
> If anyone has any corrections, let me know.  I was wondering whether
> when writing a real application, do you usually write your whole spec
> with lots of scenarios at once and then get them the execute one at a
> time? or do you write and code one scenario at a time?

Mostly I pick off a simple scenario, write it into Cucumber, then dive  
into the code to make it work. Then when I'm back on the surface with  
the scenario passing, I think about the next simplest scenario, write  
that up into a feature, and I'm off again.

Sometimes I keep a list (you can use # to comment lines in  
the .feature file) of scenarios I'm going to write up later, so I have  
a kind of 'todo list' but I don't usually flesh them out into  
executable scenarios with steps until I'm ready to work on them.

> p.s. what is the relationship between cucumber and RSpec?

Short version: RSpec is for unit testing, Cucumber is for acceptance  

Matt Wynne

More information about the rspec-users mailing list