[rspec-users] minimise scenarios

aidy lewis aidy.lewis at googlemail.com
Mon Jun 16 08:12:18 EDT 2008


Thanks David,

Maybe my steps are too granular and I will link them up as suggested.

What I do like though is re-using steps in different domains.

So I can have

 When "clicks '$link_text'" do | link_text |
    browser.link(:text, Regexp.new(link_text)).click
  end

  When "clicks on '$button_value' button" do | button_value|
    browser.button(:value, button_value).click
  end

Which will click any link and button, so I can say to a manual tester
and/or BA follow this step format and we have done a lot to actually
having the automated UI testing straight away. Obviously this will not
work on domain specific steps.

Aidy

On 16/06/2008, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Jun 16, 2008, at 6:27 AM, aidy lewis wrote:
>
>
> > Hi,
> >
> > I have a number of scenarios that are virtually the same apart from
> > one piece of test data
> >
> > Scenario: The user is returned search links with expected search
> > text description
> >  Given a logged in xx user
> >  When clicks 'Advanced Search'
> >  And enters 'Aidy' in the Contributors field
> >  And clicks search
> >  Then the resultant links are displayed with the search text in
> > each description
> >
> > So, in the first clause of the When method, I would like to change the
> > string value.
> >
> > Is there any way of doing this better than copying and pasting the
> > above Scenario with one different string value and re-running that
> > test?
> >
>
>  For now, no. There is an idea in the works. For right now, I would merge
> some of those steps:
>
>  Scenario: display search links
>   Given I am logged in as David
>   When I do an Advanced Search for Contributors: 'Aidy'
>   Then I should see blah de blah
>
>  That one When covers the three in the original example, and reads quite
> naturally in the domain, no?
>
>  In the future you'll be able to do *something* like this:
>
>  Scenario: display search links
>   Given I am logged in as David
>   When I do an Advanced Search for Contributors: 'Aidy'
>   Then I should see blah de blah
>
>  More Examples:
>   |User    |Query                |Result       |
>   |David   |Contributors:'David' |RSpec        |
>   |David   |Contributors:'Joe'   |this or that |
>
>  Not exactly sure how that's going to look yet, but it's basically a
> FIT-inspired tabular input/output format with the columns bound to the last
> Scenario. Coming soon to a workstation near you (but not too soon).
>
>  Cheers,
>  David
>
>
>  Cheers,
>  David
>  _______________________________________________
>  rspec-users mailing list
>  rspec-users at rubyforge.org
>  http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list