参数化Cucumber Runner类

时间:2016-12-01 21:16:48

标签: cucumber cucumber-jvm runner

我的跑步者课程看起来像这样:

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = { "pretty", "html:target/cucumber", "json:target/cucumber.json" },
        glue = "glue path",
        features = "feature path",
        tags = {"@tags"}
        )
public class TestClass{
}

我想知道是否有办法替换像

这样的硬编码值
glue = "**some path**", features = "**some feature**" 

有常量或变量吗?你能帮忙解决这个问题吗?

感谢。

1 个答案:

答案 0 :(得分:0)

将您的值声明为静态最终变量,您可以在注释中使用。

public static final String glue = "glue"; in class Constants.java

将其用作

@CucumberOptions(
        plugin = { "pretty", "html:target/cucumber", "json:target/cucumber.json" },
        glue = Constants.glue,
        features = "feature path",
        tags = {"@tags"}
        )