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@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to