[QA] Best practices for long scenarios in Cucumber?

Jeff Hall jhall at wikimedia.org
Tue Dec 17 21:26:47 UTC 2013


I want to create a browser test (for Visual Editor) that will repro a 
single continuous session where the user makes multiple edits to the 
same page.  As I understand it, Cucumber "Scenarios" each equate to a 
new user session, which is not what I want, so the alternative seems to 
be to construct a long, continuous scenario like the following:


   Scenario:
     Given I am logged in
     When I am at my user page
     And I click Edit for VisualEditor
     And I insert the text "My first edit. "
     And I click Save page
     And I click This is a minor edit
     And I click Review your changes
     And I click Return to save form
     And I click Save page the second time
     Then Page should contain My first edit.

     Given I click Edit for VisualEditor
     When I insert the text "My second edit. "
     And I click Save page
     And I click Save page another time
     Then Page should contain My second edit. My first edit.

     <and on and on...>


This works just fine, but it seems like a violation of the Don't Repeat 
Yourself (DRY) philosophy1].  Does anyone know if there is a more 
elegant way to construct a long Scenario in Cucumber?

Thanks,

Jeff


[1] https://en.wikipedia.org/wiki/Don%27t_Repeat_Yourself



More information about the QA mailing list