[rspec-users] Cucumber - Adding a step definition

Matt Wynne matt at mattwynne.net
Sat Mar 14 18:58:41 EDT 2009


On 14 Mar 2009, at 22:01, Tim Hart wrote:

> On Mar 14, 2009, at 3:38 PM, "Andrew Premdas" <apremdas at gmail.com<mailto:apremdas at gmail.com 
> >> wrote:
>
> Is the syntax you're using a misreading of the wiki advice on  
> Feature-Coupled Steps.
>
> Why not have
>
> "GIven a policy with a PCF practice state and seconday risk"
>
> Because the work we are currently doing is going to involve several  
> hundred different variations of over a hundred different attributes  
> of a policy. I need to make sure that I'm able to reuse as many  
> statements describing that policy as I possibly can.

Have you thought about using Scenario Outlines to express these  
several hundred variations in a tabular format?

That would enable you something like:

Given a policy with <policy features>
When blah
Then <outcome>

Examples:
| policy features                        | outcome |
| a PCF practice state and seconday risk | foo     |

Just a thought.



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



More information about the rspec-users mailing list