将多个json结果合并到一个更新的Cucumber-JVM报告中 [英] Combine Multiple json results in one, updated Cucumber-JVM Report
问题描述
我的自动化项目中有两个跑步者,如下所示:
-
主要运行者-执行所有带有
@ui-test
标签的测试用例,如果场景失败,则将使用场景位置(例如features/Dummy.feature:22
)填充target/rerun.txt
: >@RunWith(Cucumber.class) @CucumberOptions( features = "classpath:features", plugin = {"pretty", "html:target/cucumber-html-report", "json:target/cucumber.json", "rerun:target/rerun.txt"}, tags = {"@ui-test", "~@ignore"} ) public class RunCukesTest { }
-
第二名-重新执行
target/rerun.txt
中的方案:@RunWith(Cucumber.class) @CucumberOptions( features = "@target/rerun.txt", plugin = {"pretty", "html:target/cucumber-html-report-rerun", "json:target/cucumber_rerun.json"} ) public class ReRunFailedCukesTest { }
执行时,将创建两个结果json文件:
-
cucumber.json
-
cucumber_rerun.json
Jenkins将通过Cucumber-JVM Reports
插件收集结果,并创建合并的报告.
问题在于,即使所有target/rerun.txt
测试在第二次运行中均通过了,由于cucumber.json
,报告状态仍将保持失败.
有没有办法(设置Cucumber-JVM Reports
插件或修改上面显示的赛跑者)用cucumber_rerun.json
的结果覆盖cucumber.json
并仅发布修改后的cucumber.json
?
另一个子关键字:maven
,java
,cucumber-java8
,cucumber-junit
,junit
我遇到了与您类似的问题,但是,我使用了单运行程序,处理了来自testNG的重新运行(重新运行是我这样做的原因之一.已从JUnit切换到TestNG),结果我在json报告中增加了测试量. 我的解决方案是事后清理json文件,尽管Jenkins知道失败的测试,但它不会将构建标记为失败或不稳定. 在您的特定情况下,您可以尝试以某种方式匹配rerun.json中的测试,并将其从常规json报告中排除. 对于解析json,我可能建议使用Jackson FasterXML
I have two runners in my automation project as follows:
Main runner - Executes all the
@ui-test
tagged test cases and if a scenario is failedtarget/rerun.txt
will be populated with the scenario location (e.g.features/Dummy.feature:22
):@RunWith(Cucumber.class) @CucumberOptions( features = "classpath:features", plugin = {"pretty", "html:target/cucumber-html-report", "json:target/cucumber.json", "rerun:target/rerun.txt"}, tags = {"@ui-test", "~@ignore"} ) public class RunCukesTest { }
Secondary runner - Re-executes the scenarios from
target/rerun.txt
:@RunWith(Cucumber.class) @CucumberOptions( features = "@target/rerun.txt", plugin = {"pretty", "html:target/cucumber-html-report-rerun", "json:target/cucumber_rerun.json"} ) public class ReRunFailedCukesTest { }
When the execution is performed two result json files are created:
cucumber.json
cucumber_rerun.json
Jenkins will collect the results via Cucumber-JVM Reports
plugin and will create a combined report.
The problem is, even if all the target/rerun.txt
tests are passed in the second run, the report status will remain failed because of the cucumber.json
.
Is there a way (to set up Cucumber-JVM Reports
plugin or modify the upper presented runners) to overwrite cucumber.json
with the results from cucumber_rerun.json
and to publish only the modified cucumber.json
?
Another sub-keywords: maven
, java
, cucumber-java8
, cucumber-junit
, junit
I had problem similar to yours, though, I've used single runner, handled re-runs from testNG(re-runs was one of the reasons I've switched from JUnit to TestNG) directly and as a results I had increased amount of tests in my json report. My solution was to clean json files afterwards, despite the fact that Jenkins knows about failed tests it won't mark build as failed or as unstable. In your particular case you may try to somehow match tests from rerun.json and exclude them from regular json report. For parsing jsons I may recommend using Jackson FasterXML
这篇关于将多个json结果合并到一个更新的Cucumber-JVM报告中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!