Cucumber history and persisting scenarios (or premises)

I had this problem. Cucumber scripts for an extremely long workflow.

And now I wrote separate scripts for each of a long series of multi-part forms. I have a Background section that installs each Scenario . But now, when I run the whole function, the cucumber wants to repeat Background for each Scenario . I want to check out Scenario , which builds all the previous ones.

The following is a general view of what my function looks like:

 Feature: Submit a manuscript In order to complete a manuscript submission As a corresponding author I want to complete the to-do list Background: Given I am logged in as "Steve" And an article_submission "Testing Web Apps" exists And "Steve" is a "Corresponding Author" for "Testing Web Apps" And I am on the manuscript to-do list page for "Testing Web Apps" Scenario: Steve suggests reviewers for his manuscript ... Scenario: Steve completes the manuscript fees to-do item ... Scenario: Steve wants to add Barbara as a co-author ... Scenario: Steve uploads necessary files ... Scenario: Steve edits the fees page and general information page ... Scenario: Steve re-uploads the manuscript file ... Scenario: Steve completes the Copyright Transfer ... Scenario: Steve completes Author Responsibilities & Agreement ... # These scenarios depend on all the previous ones having run Scenario: Steve Completes submission ... Scenario: Steve goes back and make changes ... Scenario: Steve fills out payment page 

Can I use the previous scripts? And is there a way to run Background only once?

+6
ruby-on-rails ruby-on-rails-3 cucumber
source share
1 answer

I decided to β€œfreeze” the application in a state that was right after the function started. I did this by adding hooks that unload and load the database.

In features/support/hooks.rb I have:

 After('@complete-submission') do # Dump the database exec "mysqldump -u root --password=### onc_test > #{Rails.root}/support/submission.sql" end Before('@load-submission') do # Load the database exec "mysql -u root --password=### onc_test < #{Rails.root}/support/submission.sql" end 

This works mostly, except @load-submission not possible to mysteriously run the script, but the database is loaded. Therefore, I have to run it again without a tag. Maybe someone can help me understand what he has.

+2
source share

All Articles