2016-11-14 94 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