java - Maven Cucumber 报告多个 JSON 文件

标签 java maven cucumber cucumber-jvm

我的 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/

相关文章:

ruby-on-rails-3 - Rails 3.0.9 + Devise + Cucumber + Capybara 臭名昭著的 "No route matches/users/sign_out"

java - 为什么HashSet或HashMap不支持基于位置的访问?然而,这些类还将对象存储在 Enter 类型的数组中

java - 静态初始化是好的编程习惯吗?

maven - 我可以将 Maven 属性中的列表传递到插件配置中吗

java - 在 Netbeans 中运行 Maven 项目

java - Kafka 依赖项 - ccs 与 ce

java - XSSFCell -> 如何从 long 中获取间隔时间值

java - Gradle:为什么 ANT jar 任务更快?

ruby-on-rails - Rails、Cucumber 和本地化消息

ruby-on-rails - Rails 生成 cucumber :install fails with "Could not load generator"