← Back to libraryQuestion 261 of 468
🥒Cucumber / BDDIntermediate

Cucumber Reports

📌 Definition:

Cucumber generates execution reports via plugins configured in the runner — built-in pretty/HTML/JSON output plus third-party reporters (Cucumber Reports Maven plugin, Allure, ExtentReports) for rich, shareable results.

📖 Detailed Explanation:

The plugin option produces output: 'pretty' (console), 'html:target/cucumber.html' (built-in HTML), and 'json:target/cucumber.json' (machine-readable, consumed by richer reporters). Popular add-ons: the maven-cucumber-reporting plugin and Allure produce dashboards with pass/fail trends, step details, embedded screenshots, and tags. Attaching screenshots in @After hooks (scenario.attach(...)) makes failures self-diagnosing in the report. Reports turn BDD scenarios into living documentation of what passed, which is valuable for stakeholders. Choosing a reporter and wiring screenshots on failure is a common framework task.

🔑 Key Points:
  • plugin option: pretty (console), html, json (for richer tools)
  • JSON output feeds Allure / maven-cucumber-reporting dashboards
  • Attach screenshots in @After (scenario.attach) → self-diagnosing
  • Reports double as living documentation for stakeholders
🌍 Real-World Example:

The runner outputs json, which the maven-cucumber-reporting plugin turns into an HTML dashboard showing scenario pass/fail by tag, with failure screenshots embedded from the @After hook.

🎯 Scenario-Based Interview Question:

Stakeholders want a readable report with pass/fail trends and failure screenshots. How do you produce it from Cucumber?