2016-12-01 32 views
0

我的亞軍類看起來是這樣的:黃瓜參數多級亞軍

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

與常量或變量硬編碼值的方法嗎?你能幫忙嗎?

謝謝。

+0

你可以看看[QAF小黃瓜客戶端(https://qmetry.github.io/qaf/latest/gherkin_client.html)它提供的方式來配置通過xml文件或屬性文件中的屬性。 – user861594

回答

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