我在下面的Java类中运行了cumulanOptions
@CucumberOptions(标签= {“ @userManagement”}) 公共类IC_API_Tests_Runner { 这里的跑步者代码 }
From jenkins I am passing below command ti run the tests
clean test "-Dkarate.env=$WhereToRun" "-Dbvt.tags=@userManagement"
I am able to fetch the value of 'bvt.tags' using below command
bvtTags = karate.properties['bvt.tags'];
Now I need to pass the 'bvtTags' value to the CucumberOptions.
I tried
@CucumberOptions(tags = {"bvtTags"})
public class IC_API_Tests_Runner {
runner code here
}
But 'bvtTags' value is not substituted in the CucumberOptions. But I am able to print the value of 'bvtTags' with print statement in karate code.
Any help will be great help
答案 0 :(得分:2)
不,您不能像这样动态更改@CucumberOptions
。
使用API动态选择测试,请参见以下示例:DemoTestSelected.java
。
然后执行以下操作(请根据您的环境进行更改):
String tags = System.getProperty("bvt.tags");
List<String> tags = Arrays.asList(tags);
编辑:实际上,您不需要执行任何操作。 (我想您永远不会阅读文档:)
请参考:https://github.com/intuit/karate#command-line
-Dkarate.options="--tags @userManagement"