Here’s a complete working example of Cucumber Report Generation using:
-
✅ Feature File
-
✅ Step Definition (
Steps.java
) -
✅
TestNGRunner.java
-
✅ Auto-generated HTML/JSON report
📁 Project Structure:
✅ 1. Feature File – login.feature
📄 src/test/java/features/login.feature
✅ 2. Step Definitions – Steps.java
📄 src/test/java/stepDefinitions/Steps.java
✅ 3. TestNG Runner – TestNGRunner.java
📄 src/test/java/cucumberOptions/TestNGRunner.java
✅ 4. Run the Tests
Run TestNGRunner.java
. After the test runs:
-
✅ Console shows "pretty" readable output
-
✅ HTML report is generated at:
target/cucumber-reports.html
-
✅ JSON report at:
target/cucumber.json
📄 Example Output (console)
🧠 Pro Tip:
You can view the HTML report in your browser: