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

查看:75
本文介绍了空手道框架的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

You really should read the docs: 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天全站免登陆