空手道 0.9.1 未生成用于黄瓜报告的 cucumber.json

Karate 0.9.1 is not generating cucumber.json which is used for cucumber reports

空手道 0.6.1 与黄瓜一起使用时。它正在将测试结果输出到代码中指定路径中的 cucumber.json 文件。

然后用于使用 Masterthought 生成黄瓜报告。

@RunWith(Karate.class)

@CucumberOptions(monochrome = true, features = "SampleFeature.feature", 
plugin = {"pretty", "html:target/site/cucumber-pretty", 
"json:target/cucumber-html-reports/cucumber.json" })

但是当我们迁移到 空手道 0.9.1 以从 csv 文件读取输入时。现在,它无法生成 cucumber.json,因此报告因 FileNotFoundException 而失败。

在 pom.xml

中附上了 masterthought 的插件
    <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>3.15.0</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                    <!--    optional, per documentation set this to "true" to bypass
                        generation of Cucumber
                        Reports entirely, defaults to false if not specified -->
                        <skip>false</skip>
                        <!-- output
                        directory for the generated report -->
                        <outputDirectory>${project.build.directory}</outputDirectory>
                        <!-- optional, defaults to outputDirectory if not specified -->
                        <inputDirectory>${project.build.directory}/surefire-reports</inputDirectory>
                        <jsonFiles>
                            <!-- supports wildcard or name pattern -->
                            <param>target/cucumber-html-reports/cucumber-json-report.json</param>
                        </jsonFiles>
                        <cucumberOutput>${project.build.directory}/cucumber-html-reports/cucumber.json</cucumberOutput>
                    <!--    optional, defaults to outputDirectory if not specified -->
                        <classificationDirectory>${project.build.directory}/classifications</classificationDirectory>
                        <classificationFiles>
                            supports wildcard or name pattern
                            <param>sample.properties</param>
                            <param>other.properties</param>
                        </classificationFiles>
                        <parallelTesting>false</parallelTesting>
                    </configuration>
                </execution>
            </executions>
        </plugin>

任何人都可以建议从 0.6.1 到 0.9.1 有什么变化吗?

我应该如何生成 cucumber.json 文件?

从空手道 0.9.0 开始,支持的注释参数只有 featurestags,没有其他参数。空手道是 not based on Cucumber any more.

并行运行器默认会生成您在 target/surefire-reports 中期望的 JSON。请仔细阅读文档的这一部分:https://github.com/intuit/karate#parallel-execution

因此您必须执行以下操作:

编辑 - 注意在 1.0 之后,Cucumber JSON 默认不输出: