Class CucumberJsonReportListener

java.lang.Object
io.karatelabs.output.CucumberJsonReportListener
All Implemented Interfaces:
ResultListener

public class CucumberJsonReportListener extends Object implements ResultListener
A ResultListener that generates Cucumber JSON reports.

This listener writes each feature's Cucumber JSON file as that feature completes. Each feature produces a separate JSON file named {packageQualifiedName}.json. This approach:

  • Makes partial results available as tests complete
  • Compatible with third-party tools (Allure, ReportPortal, etc.)
  • Field Details

  • Constructor Details

    • CucumberJsonReportListener

      public CucumberJsonReportListener(Path outputDir)
      Create a new Cucumber JSON report listener.
      Parameters:
      outputDir - the base output directory (subfolder will be created)
  • Method Details

    • onSuiteStart

      public void onSuiteStart(Suite suite)
      Description copied from interface: ResultListener
      Called when the suite starts execution.
      Specified by:
      onSuiteStart in interface ResultListener
      Parameters:
      suite - the suite about to run
    • onFeatureEnd

      public void onFeatureEnd(FeatureResult result)
      Description copied from interface: ResultListener
      Called when a feature completes execution.
      Specified by:
      onFeatureEnd in interface ResultListener
      Parameters:
      result - the feature result