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

时间:2019-01-29 09:12:59

标签: karate cucumber-java

与黄瓜一起使用空手道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的内容?

我应该怎么做才能生成cummon.json文件?

1 个答案:

答案 0 :(得分:2)

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

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

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