我想知道一些事情,當背景失敗時,黃瓜返回一個退出代碼0(意思是「OK」,據我所知)。黃瓜:背景失敗,仍然退出,代碼爲0
現在失敗的步驟不應該在背景中(最好在'before'-hook我猜?)。但是有人知道它返回這個退出代碼的理念嗎? 它是一個錯誤還是一個特徵?
附錄: 一個更具體的例子: 比方說這個代碼傳遞:
Feature: Figuring out how Cucumber works
As a developer
I want to find out why cuccies fail, but my build doesnt
In order to have more confidence in my build
Background: logging in into the system
Given I am logged in
Scenario: creating a new test set
When I do something
Then I should see "you've done something"
它返回退出代碼0 讓使其失敗:
Background: logging in into the system
Given I am logged in
Scenario: creating a new test set
Then I should see "there's no way you see this"
When I do something
Then I should see "you've done something"
輸出顯示一失敗的步驟,它返回退出代碼1 當我將失敗的步驟移動到後臺:
Background: logging in into the system
Given I am logged in
Then I should see "there's no way you see this"
Scenario: creating a new test set
When I do something
Then I should see "you've done something"
輸出仍顯示它失敗了,但它退出代碼爲0
但是當一個先決條件失敗,甚至無法執行的情況。因此,我期望測試過程失敗(錯誤代碼不爲0)。 – SirLenz0rlot 2011-12-19 16:10:54
不是。因爲測試沒有失敗。它「只是」沒有執行。返回值代表測試是否失敗。 – robustus 2011-12-19 17:43:50
謝謝,我想我的問題得到了回答,雖然我不滿意設計決定(如果它是一個): 在我看來是一個測試不執行(尤其是當被要求執行時)*更糟*比一個被執行的測試(無論結果如何)。 我會在Cucumber郵件列表上詢問它,想知道貢獻者將如何迴應 – SirLenz0rlot 2011-12-19 17:57:51