6
我有這個問題Cucumber scenarios for extremely long work flow黃瓜背景和持續存在的場景(或先決條件)
而現在我已經爲每個一長串的多部分形式的步驟寫孤立的場景。我有一個Background
部分,設置每個Scenario
。但現在當我運行整個功能時,黃瓜想要爲每個Scenario
重複Background
。我想測試一個Scenario
,它構建了所有以前的。
這裏是什麼我的功能看起來光禿禿的輪廓:
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
?
我想你可能會讓自己的事情變得比他們需要的更難。您列出的作爲情景的內容代替方案中的步驟。就像Pan提到您鏈接到的問題的答案一樣,您的場景應該是自包含的,並且不需要像這樣有依賴關係。如果是我,我會將背景和場景摺疊回一小部分(最後3個可能會變成1場景),並使用更高級別的步驟,例如「鑑於史蒂夫已完成稿件提交」,並進行驗證那些以確保每一步都有效。 – 2011-02-18 18:44:53