karate - 并行运行的标记逻辑

标签 karate

通过并行方法的标签逻辑与 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/

相关文章:

javascript - 如何设置从对 .js 或 json 文件的响应中收到的值

variables - Karate -从另一个特征文件中的响应中获取字段的值

spring-boot - 我可以使用 Karate 来测试微服务吗?

karate - 如果其中包含点和下划线,则嵌入表达式不会被替换

karate - 使用内容类型为文本/纯文本的响应进行匹配

karate - 在 Karate 框架中使用外部库

karate - 如何为 Karate DSL 中的模式断言提供动态 key

java - 向 Karate 框架添加自定义步骤定义

java - 如何在socket.send函数中进行变量替换

spring - Karate如何在Azure管道中启动应用程序?