I have the following step that I want to re-use in several scenarios.  It
looks like this:

 When I submit the form
   |form_field_id               |value|
   |billingAddress.email        |mickey_mo...@test.com|
   |billingAddress.firstName    |Mickey|
   |billingAddress.lastName     |Mouse|
   |billingAddress.street1      |249 Cross Road|
   |billingAddress.city         |Sanford|
   |billingAddress.subCountry   |ME|
   |billingAddress.zipPostalCode|04073|
   |billingAddress.country      |US|

This step fills out a form using Selenium behind the scenes.  It's been
copied into several scenarios and I want to DRY it up.  I DRY'd this up by
moving this table data into a fixture file (mickey_mouse.yml), but then the
test becomes less descriptive - the original scenario step above turned into
a one-liner:

 When I submit the form for "mickey_mouse"

I think ideally, I would like some kind of "include_step" feature in
cucumber - where we can write partial snippets and include them wherever I
want.  When cucumber runs, it can replace the included step.  So I could
keep my tests DRY with something like:

    When I submit the form
      Include 'submit_form_for_mickey_mouse'

but when I run the test, cucumber would spit out the partial contents in
place of the Include to make the test more descriptive.

Is there anything in cucumber that would help me out right now?  What I'm
currently looking into is hooking into the formatting and overriding some
rendering - but it feels like a bad hack.

-- 

John Goodsen                 RADSoft / Better Software Faster
jgood...@radsoft.com            Lean/Agile/XP/Scrum Coaching and Training
http://www.radsoft.com          Ruby on Rails and Java Solutions
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to