[rspec-users] Reuse of Cucumber Features

Matt Wynne matt at mattwynne.net
Thu Apr 9 14:56:05 EDT 2009


On 9 Apr 2009, at 17:47, Zach Dennis wrote:

> On Thu, Apr 9, 2009 at 9:29 AM, Williams, Wesley
> <Wesley.Williams at sabre.com> wrote:
>> Matt,
>>
>> Hmm, I think this is one way to do it.  I will need to get my  
>> customer
>> to think differently about defining the requirements.  They really  
>> like
>> the tables.
>
> Some times table just work best. I love writing scenarios with natural
> language, but I've hit many cases where the inputs and outputs are
> best displayed as a table, and it's easier for the customer to gr0k,
> then to read a short novel.
>
> This kind of re-use that you seem to need sounds like a potential
> feature for Cucumber. A way to utilize an external file to house a
> table of data. e.g.:
>
> Background
>   Given I have the following set of flights:
>      | foo | bar | baz |
>      ...
>
> Would become
>
> Background
>    Given I have the following set of flights:
>    FromFile: flights/scheduleA
>
> And then you'd have the flights/scheduleA house:
>
>      | foo | bar | baz |
>      ...
>
> Cucumber could dump in the table data it found from the file, and
> print it out when running the scenarios, and it allows some sets of
> sample data be re-used easily, in an understandable manner.
>
> WDYT?


This is a good idea - people do this with Fit (as opposed to Fitnesse)  
and go straight to a spreadsheet for the examples.

I don't see why it needs a new Cucumber feature though - you could  
easily (and more flexibly) write a custom step yourself to load in the  
data from an external file, right?

Matt Wynne
http://blog.mattwynne.net
http://beta.songkick.com



More information about the rspec-users mailing list