我有这个问题Cucumber scenarios for extremely long work flow
现在,我一直在为一系列多部分表单步骤中的每一步编写孤立的场景 . 我有 Background
部分设置每个 Scenario
. 但是现在当我运行整个功能时,黄瓜想为每个 Scenario
重复 Background
. 我想测试一个 Scenario
,它 Build 在所有以前的基础之上 .
以下是我的功能的简要概述:
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
是否有办法要求运行以前的方案?有没有办法只运行 Background
一次?
1 回答
我决定在运行功能后立即“冻结”应用程序状态 . 我通过添加转储和加载数据库的钩子来做到这一点 .
在
features/support/hooks.rb
我有:这基本上是有效的,除了
@load-submission
神秘地运行Scenario失败,但数据库已加载 . 所以我必须在没有标签的情况下再次运行它 . 也许有人可以帮助我弄明白自己 .