>我有以下java类,它运行在黄瓜选项
@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
不,你不能像那样动态更改@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"