2016-11-14 92 views
0

所以我想知道是否有辦法跳過黃瓜數據表的某些行。比方說給這個例子中(從黃瓜的網站上得到)使用@wip跳過某些數據行

Scenario Outline: feeding a suckler cow 
    Given the cow weighs <weight> kg 
    When we calculate the feeding requirements 
    Then the energy should be <energy> MJ 
    And the protein should be <protein> kg 

    Examples: 
    | weight | energy | protein | 
    | 450 | 26500 |  215 | 
    | 500 | 29500 |  245 | 
    | 575 | 31500 |  255 | 
    | 600 | 37000 |  305 | 

我只想跳過第二個數據線(重量:500 ..)。這可能嗎?如果目前沒有,我在哪裏可以找到黃瓜標籤並添加我自己的定製標籤?我喜歡@ wipR2 @ wipR4這樣的解決方案,其中R2和R4表示第2行和第4行。

回答

1

您可以通過將示例表分成兩部分並在其中一部分上使用@wip標記來實現。然後使用negate wip標籤運行測試 - 「標籤」選項中的〜@ wip以在cucumberoptions中過濾。

Examples: 
    | weight | energy | protein | 
    | 450 | 26500 |  215 | 
    | 575 | 31500 |  255 | 
    | 600 | 37000 |  305 | 

    @wip 
    Examples: 
    | weight | energy | protein | 
    | 500 | 29500 |  245 | 
+0

cucumberoptions?這是一個文件,我可以改變,或設置? – Tree55Topz

+0

我的不好。沒有在您的問題中看到cucumberjs標籤,並提到了黃瓜java風格。您需要將〜@ wip傳遞給啓動黃瓜的命令的tags選項。基本上你正在過濾掉這個標籤。 – Grasshopper

+0

如果它否定@wip標記,那麼它不會運行拆分部分?不用擔心,我相信它是一個類似的解決方案:) – Tree55Topz