In that case use
Given users:
|eye|
|blue|

and write the @Given method so it will put defaults in unspecified columns.

On 11 November 2010 17:13, Gilles Scokart <[email protected]> wrote:

> That's indeed a good solution.  But I think this aproach doesn't
> highlight the thing that is important.
>
> If in my test the only thing that mather is that the user has blue
> eyes and others characteristics can be default, I feel the table
> aproach put some 'noice' it.
>
> But I can give it a try to see what it give.
>
>
> Gilles Scokart
>
>
>
> On 11 November 2010 16:22, Mauro Talevi <[email protected]>
> wrote:
> > Why don't you use a tabular parameter to specify your user
> > characteristics, e.g.:
> >
> > Given a user with:
> > |eye colour|height|age|
> > |blue|180|21|
> >
> > In this way, you delegate to the implementation what to do with the
> > table information.
> >
> > Also, you can easily scale up to deal with multiple users with no extra
> > hassle.
> >
> > On 11/11/2010 15:03, Gilles Scokart wrote:
> >> Did you have already faced a case where you want to write different
> >> sentences like this :
> >>
> >> Given a user with blue eyes
> >> Given a user measuring 1m80
> >> Given a user measuring 1m80 with blue eyes
> >> Given a user of 21 years old
> >> Given a user of 21 years old measuring 1m80
> >> Given a user of 21 years old measuring 1m80 with blue eyes
> >> Given a user of 21 years old with blue eyes
> >> ...
> >>
> >> I don't want to write one Step method for each combination, because
> >> that would really be too long (too much method to write, but also too
> >> much pattern).
> >> I could use a different approach where each Step can give one an only
> >> one characteristics.  But I fear mys story may became too long.  Also,
> >> the steps would be more complex to write.  The 'user object' can not
> >> be build at once.  The step must implement some builder logic keeping
> >> all the given characteristics, and will have to be smart enough to
> >> know when all characteristics are known and the object can be created.
> >>
> >> I have started to write an OptionalStepPatternParser to solve that can
> >> handle a pattern like this "a user [of $age year[s] old] [measuring
> >> $size] [with $color eyes]"
> >>
> >> But before I continue deeper in this track, I would like to know how
> >> others are doing ?
> >>
> >>
> >>
> >> Gilles Scokart
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list, please visit:
> >>
> >>     http://xircles.codehaus.org/manage_email
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to