[rspec-users] Cucumber Scenario syntax

Evan David Light lists at tiggerpalace.com
Fri Sep 12 12:42:39 EDT 2008

On Sep 12, 2008, at 12:26 PM, David Chelimsky wrote:

>>       I believe that binding the table to the phrasing would be  
>> immensely
>> useful and perhaps even crucial to Scenario authors.
> Can you give an example of how this would be helpful?

I'll try.

Let's define a couple of roles for, the sake of discussion.  Features  
are written in plain text by a "business person" or "domain expert"  
who is not a programmer and that the Steps are implemented by a "code  

I believe that code monkeys could be confused by the following:

Given a Widget
When I supply a line of text that starts with a foo
Then it should output bar

  |type of widget|text_input|result|
  |Widget2        |blech        |foobar|

Looking at the Scenario above, I can't tell, by reading the Given,  
When, or Then lines where "widget_2", "blech", and "foobar" will be  
used respectively.

However, if I could say:

Given a type of widget
When I supply a line of text that starts with my text input
Then it should output the desired output

|type of widget|my text input|the desired output|

I believe that the latter is a fair bit cleaner.  Again, this approach  
would use the FIT table headers as metadata that informs the use of  
the Scenario as a template for running Scenarios.

To nitpick my suggestion just a tad, I wonder whether trimming the  
matched FIT column headers is a good idea or not; however, padding the  
FIT table headers with a little white space may also make them a  
little more readable.


>>       Also, couldn't your second example also support binding to  
>> the table
>> headers?
> Anything is possible :) How would you envision that working. What
> would trigger binding one word in a phrase to a header?

More information about the rspec-users mailing list