【问题标题】:JSON report for Karate Framework空手道框架的 JSON 报告
【发布时间】:2019-03-19 11:48:32
【问题描述】:

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

【问题讨论】:

    标签: automated-tests jenkins-plugins karate


    【解决方案1】:

    你真的应该阅读文档: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();        
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多