Search code examples
cucumbercucumber-jvmcucumber-javacucumber-junit

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


Currently I am using Cucumber Options with plugin to invoke Custom Report Class implements Reporter. How to do it in newer Cucumber 4 version. Mainly to get Test Results to build own custom reports.


Solution

  • You can implement the Formatter interface - https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/api/formatter/Formatter.java.

    Though this is planned for removal. - https://github.com/cucumber/cucumber-jvm/issues/1401

    Better off using the 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

    Also look at 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