2010-10-31 22 views
4

我已經理解,功能輸出中的藍色破折號表示該步驟被跳過,因爲之前的某些操作失敗了,但在所有場景輪廓中,我都會看到藍色破折號,而且還有一行說明全部通過。黃瓜特徵輸出中的藍色破折號是否總是被忽略?

這是我的場景大綱。

Scenario Outline: Attempt to assign a role when not authorized 
    Given a <user_who_can_not_assign_roles> exists with email: "[email protected]" 
    And that user is signed in 
    And I am on the user's show page 
    And a role exists with name: "<other_role1>" 
    And a role exists with name: "<other_role2>" 
    When I follow "Edit" 
    Then I should not see "Admin" 
    And I should not see "Manager" 
    And I should not see "Salesperson" 
    When I fill in "username" with "spuds" 
    And I fill in "password" with "potatoes" 
    And I fill in "password confirmation" with "potatoes" 
    And I fill in "email" with "[email protected]" 
    And I press "Save" 
    Then I should see "success" 
    And a role should exist with name: "<other_role1>" 
    And that role should not be one of the user's roles 
    And a role should exist with name: "<other_role2>" 
    And that role should not be one of the user's roles 

    Examples: 
    | user_who_can_not_assign_roles | other_role1 | other_role2 | 
    | manager      | Admin  | Salesperson | 
    | salesperson     | Admin  | Manager  | 

當我運行此功能時,我得到了這個輸出。

-------------------......

2情景(2通過)
38步驟(38通過)
0立方米.300s

我得到了它的2個場景,因爲我列出了2個示例,並且38個步驟將是19次運行兩次。我不明白的是,爲什麼它會顯示藍色短劃線(就像它通常爲跳過的步驟顯示的那樣),當它也表示38步驟通過時。

我會假設這是在運行輪廓時的目的,因爲如果我改變標有藍色短劃線的步驟,它將顯示失敗。我只是在黃瓜文件中尋找一些確認,我找不到任何東西。

我正在運行rails 3.0.0,cucumber 0.9.3和pickle 0.4.2。

回答

4

這種情況下的藍色破折號表示場景大綱的解析,這是比測試更多的元數據。我也覺得很困惑。爲了獲得正在發生的事情的一個更好的主意,嘗試執行:

cucumber -f pretty <your_fancy_scenario.feature> 

這將迫使黃瓜,以顯示與顏色編碼的實際情況文本,而不是僅僅是點和線。

希望有幫助!