【问题标题】:Karate - not able to generate cucumber report with karate 0.9.5空手道 - 无法使用空手道 0.9.5 生成黄瓜报告
【发布时间】:2020-05-23 13:49:57
【问题描述】:

我在使用我制作的示例空手道框架生成黄瓜报告时遇到问题。 我已经按照(快速入门 - 在空手道文档中给出)给出的步骤,然后添加了代码来生成报告,但仍然没有生成报告。

如果有人想查看结构,这里是 Git url https://github.com/techj-sam/sampleAPITest

【问题讨论】:

    标签: karate


    【解决方案1】:

    您可以使用以下代码:

    @Test
    void testParallel() {
        Results results = Runner.path("classpath:api/HealthCheck/com").tags("~@ignore").parallel(5);
        generateReport(results.getReportDir());
        assertEquals(0, results.getFailCount(), results.getErrorMessages());
    }
    
    public static void generateReport(String karateOutputPath) {
        Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true);
        List<String> jsonPaths = new ArrayList<String>(jsonFiles.size());
        //jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
        for(File file : jsonFiles){
            jsonPaths.add(file.getAbsolutePath());
        }
        Configuration config = new Configuration(new File("target"), "REST API Automation - Karate");
        ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
        reportBuilder.generateReports();
    }
    

    【讨论】:

      【解决方案2】:

      您将@Karate.Test 用于并行运行器,这是一个错误。请阅读文档:https://github.com/intuit/karate#junit-5-parallel-execution

      【讨论】:

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