空手道框架的 JSON 报告 [英] JSON report for Karate Framework

查看:24
本文介绍了空手道框架的 JSON 报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在使用空手道框架时生成 JSON 报告,以便我可以使用黄瓜报告插件在 JENKINS 中使用它.我的空手道版本是:空手道阿帕奇 - 0.8.0空手道-junit4 - 0.8.0

How can I produce a JSON report while using karate framework so that I can use it in JENKINS using the cucumber reports plugin. My Karate version are: karate-apache - 0.8.0 karate-junit4 - 0.8.0

推荐答案

你真的应该阅读文档:https://github.com/intuit/karate/tree/master/karate-demo#example-report

<dependency>
    <groupId>net.masterthought</groupId>
    <artifactId>cucumber-reporting</artifactId>
    <version>3.8.0</version>
    <scope>test</scope>
</dependency>

public static void generateReport(String karateOutputPath) {
    Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] {"json"}, true);
    List<String> jsonPaths = new ArrayList(jsonFiles.size());
    jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
    Configuration config = new Configuration(new File("target"), "demo");
    ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
    reportBuilder.generateReports();        
}

这篇关于空手道框架的 JSON 报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆