【问题标题】:Parametrize Cucumber Runner class参数化 Cucumber Runner 类
【发布时间】:2017-04-16 16:12:01
【问题描述】:

我的跑步者类是这样的:

@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**" 

使用常量还是变量?你能帮忙吗?

谢谢。

【问题讨论】:

  • 你可以看看QAF gherkin client它提供了通过xml文件或属性文件中的属性进行配置的方法。

标签: cucumber cucumber-jvm runner


【解决方案1】:

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

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"}
        ) 

【讨论】:

    猜你喜欢
    • 2020-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多