通过并行方法的标签逻辑与 cucumber 选项不同。如果能有一些文档就太好了。
mvn -Doptions="--tags @integration --tags @x --tags ~@wip"不适用于带有标签作为集成或 x 的场景
根据我的理解,上面代表 @CucumberOptions(tags = {"@integration","@x","~@wip"}
如果我给出 mvn -Doptions="--tags @integration,@x"那么它将执行带有标签集成或 x 的场景。
public static List<String> setTags(String options){
logger.info("Tag input from maven command:"+options);
logger.info("Parsing all the tags");
List<String> allTags = new ArrayList<>();
List<String> tags = Arrays.asList(options.split("--tags"));
for (String tag : tags) {
if (StringUtils.isNotEmpty(tag)) {
logger.info("Tags selected are:" + tag.trim());
allTags.add(tag);
}
}
return allTags;
}
public static List<String> getTags(){
if(StringUtils.isNotEmpty(System.getProperty("options"))) {
return setTags(System.getProperty("options"));
}else throw new RuntimeException("Please select a tag for execution");
}
并行方法,我获取导演中的所有功能文件并将标签作为列表传递。
KarateStats stats = CucumberRunner.parallel(PipelineRunner.getTags(), PipelineRunner.getAllFeatureFiles(featureDir), 1, karateOutputPath);
文件1 @集成
场景:等等等等
文件2 @x
场景:废话
最佳答案
Based on my understanding the above represent @CucumberOptions(tags = {"@integration","@x","~@wip"}
不,那是错误的。请参阅这篇博文,它甚至还链接到 Karate 文档:https://testingneeds.wordpress.com/2015/09/15/junit-runner-with-cucumberoptions/
这应该就是您正在寻找的内容。
@CucumberOptions(tags = {"@integration,@x", "~@wip"})
如果您仍然发现问题,我们可以修复它 - 但请按照此处的流程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
关于karate - 并行运行的标记逻辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51833396/