11

我知道您可以为功能指定标签,然后在命令行上运行 cucumber 时忽略它们。但我正在使用 cucumber-jvm 并从 maven 运行它。@ignore 不起作用,我不知道如何将要忽略的标签传递给执行 Gherkin 测试的运行器。

解决方法是在开发和测试新功能时将完成的功能移动到另一个目录,但这不是应该的。其他用户如何处理这种缺陷?

4

2 回答 2

23

你可以告诉跑步者跳过@ignore

import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(features = {"classpath:my_feature.feature"},
tags = {"~@ignore"})
public class RunCukesTest {
}
于 2014-05-20T13:43:16.190 回答
7

您可以将您的场景标记为@ignore将被忽略的场景。

如果您只想运行选择性场景,请将您要测试的每个新功能标记为@new_test。告诉 Cukes Runner 只运行标签 = @new_test

import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(features = {"classpath:my_feature.feature"},
tags = {"@new_test"})
public class RunCukesTest {

}

任何你不想测试的东西都不应该有标签或应该有其他标签名称

于 2013-10-03T00:28:56.637 回答