我的 POM 目前看起来是这样的,
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>ExecuteAutomation</projectName>
<outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
</configuration>
</execution>
</executions>
</plugin>
这确实会生成一份报告,但仅包含最后一个功能。我有多个运行者,所以我想找出其中一个:
A.如何将多个 JSON 合并到一份报告中或
B.每次测试完成后,如何附加到一个 JSON 文件?
这两个似乎都是一个可行的解决方案,尽管我更喜欢 A,因为我似乎只在 pom.xml 中缺少一行来执行此操作,因为我目前已经生成了多个 JSON 文件
最佳答案
问题是正在使用的版本(即 2.8)不支持多个 JSON 文件。
解决办法是:
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>4.5.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>ExecuteAutomation</projectName>
<inputDirectory>${project.build.directory}/jsonReports</inputDirectory>
<outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
<jsonFiles>
<!-- supports wildcard or name pattern -->
<param>**/*.json</param>
</jsonFiles>
</configuration>
</execution>
</executions>
</plugin>
了解更多信息 https://github.com/damianszczepanik/maven-cucumber-reporting
关于java - Maven Cucumber 报告多个 JSON 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55103607/