Cucumber 4 - 自定义报告的 Reporter Interface 是否有替代方案?

Cucumber 4 - Is there any alternate for Reporter Interface for Custom Report?

目前我正在使用带有插件的 Cucumber Options 来调用自定义报告 Class 实现 Reporter。如何在较新的 Cucumber 4 版本中执行此操作。主要是为了获取测试结果来构建自己的自定义报告。

您可以实现 Formatter 接口 - https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/api/formatter/Formatter.java

尽管这是计划删除的。 - https://github.com/cucumber/cucumber-jvm/issues/1401

最好使用 Plugin - https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/api/Plugin.java plus EventListener - https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/api/event/EventListener.java

另请参阅 ConcurrentEventListener https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/api/event/ConcurrentEventListener.java if u plan to use parallel running - https://github.com/cucumber/cucumber-jvm/pull/1357