如何在空手道中参数化詹金斯的黄瓜选项标签
How to parameterise the cucumber options tags from jenkins in karate
我有以下 java class 与 cucumberOptions
一起运行
@CucumberOptions(标签 = {“@userManagement”})
public class 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"
我有以下 java class 与 cucumberOptions
一起运行@CucumberOptions(标签 = {“@userManagement”}) public class 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"