Cucumber 背景和持续场景(或先决条件)
我遇到了这个问题极长工作流程的黄瓜场景
现在我一直在为一长串多部分表单步骤中的每一个编写单独的场景。我有一个Background
部分来设置每个Scenario
。但现在,当我运行整个功能时,cucumber 希望为每个 Scenario
重复 Background
。我想测试一个基于所有先前场景构建的场景
。
这是我的功能的大致轮廓:
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
是否有办法要求运行以前的场景?有没有办法只运行一次后台
?
I had this problem Cucumber scenarios for extremely long work flow
And now I've been writing isolated scenarios for each of a long series of multi-part form steps. I have a Background
section that sets up each Scenario
. But now when I run the entire feature, cucumber wants to repeat the Background
for each Scenario
. I want to test a Scenario
that builds off of all the previous ones.
Here is the bare outline of what my feature 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
Is there are way to require previous scenarios to be run? And is there a way of running the Background
only once?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我决定将应用程序“冻结”在运行该功能后的状态。我通过添加转储和加载数据库的钩子来做到这一点。
在
features/support/hooks.rb
中,我有:这基本上可以工作,除了
@load-submission
神秘地无法运行场景,但数据库已加载。所以我必须在没有标签的情况下再次运行它。也许有人可以帮我解决这个问题。I decided to "freeze" the application in the state it was immediately after running the Feature. I did this by adding hooks that dump and load the databse.
In
features/support/hooks.rb
I have:This is working basically, except the
@load-submission
fails mysteriously to run the Scenario, but the database is loaded. So I have to run it again without the tag. Maybe someone can help me figure that own out.