亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Maven Cucumber 報告多個 JSON 文件

Maven Cucumber 報告多個 JSON 文件

米脂 2022-07-27 21:22:22
我的 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 回答

?
汪汪一只貓

TA貢獻1898條經驗 獲得超8個贊

問題是正在使用的版本(即 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


查看完整回答
反對 回復 2022-07-27
?
梵蒂岡之花

TA貢獻1900條經驗 獲得超5個贊

如果您可以運行 bash 命令并且機器上可能有jq可用,則可以嘗試在具有不同名稱的文件中生成報告,然后使用 jq 將它們合并回一個文件


盡管我不并行運行并且不依賴任何插件,但我做類似的事情,我使用surefire插件運行


免責聲明:我沒有使用 --format 測試報告名稱覆蓋,因此該部分可能對您有所不同,但想法是相同的


mvn test -Dcucumber.options="--format=json:target/cucumber_test1.json"

mvn test -Dcucumber.options="--format=json:target/cucumber_test2.json"

...


jq -s '[.[][]]' target/cucumber_*.json > target/cucumber.json


查看完整回答
反對 回復 2022-07-27
  • 2 回答
  • 0 關注
  • 176 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號