ExtentReports with Spark Reporter – Beautiful HTML Reporting in Selenium
By Bhau Automation • HTML Reporting for Automation Frameworks
🎯 What You Will Learn
- What are ExtentReports & Spark Reporter?
- Why Spark Reporter is used for HTML reports?
- Step-by-step integration in Selenium Framework
- How to generate, customize & view HTML reports
- Live demo using Java + Selenium
- Best reporting practices for automation
📌 What is ExtentReports?
ExtentReports is one of the most powerful reporting libraries used in Selenium, Appium, API Automation, and frameworks like TestNG & JUnit.
- Generates detailed test execution reports
- Supports screenshots
- Supports logs, labels, categories & devices
- Modern HTML UI
📌 What is Spark Reporter?
Spark Reporter is the latest, modern & lightweight HTML report generator built inside ExtentReports 5.x series. It creates clean, responsive & beautiful HTML dashboards.
✨ Key Features:
- Attractive UI dashboard
- Pass/Fail charts
- Dark & Light themes
- Search filters, timeline & categories
- Screenshot support
🛠 Step-by-Step Integration (Selenium + Java)
1️⃣ Add ExtentReports Dependency
com.aventstack extentreports 5.0.9
2️⃣ Initialize ExtentReports + Spark Reporter
ExtentSparkReporter spark = new ExtentSparkReporter("reports/SparkReport.html");
ExtentReports extent = new ExtentReports();
extent.attachReporter(spark);
3️⃣ Create Test Logs
ExtentTest test = extent.createTest("Login Test");
test.pass("Browser Launched");
test.info("Entering username");
test.fail("Login failed");
4️⃣ Flush Report
extent.flush();
📊 Sample HTML Dashboard Output
- Test Steps
- Pass/Fail Results
- System Environment Details
- Failure Screenshot
- Execution Timeline
🧪 Best Practices for Reporting
- Create separate folder for each execution
- Add screenshot on failure
- Use categories like regression, sanity, smoke
- Print logs (info, warning, fail, skip)
- Integrate with CI/CD (Jenkins, GitHub Actions)
🎯 Interview Questions
Q: Why ExtentReports over TestNG default reports?
Because ExtentReports supports screenshots, charts, filters & a professional dashboard.
Q: Can Spark Reporter generate multiple reports?Yes, you can attach multiple reporters to ExtentReports.
Q: Does Spark Reporter support screenshots?Yes, both Base64 & file-based screenshots are supported.
🎥 Watch the Full Tutorial
👉 Watch: ExtentReports + Spark Reporter Tutorial
✔️ Key Takeaways
- Spark Reporter creates beautiful HTML dashboards
- Integration is easy with Selenium
- Supports screenshots, logs & categories
- Must-have for any professional automation framework
🚀 Created with ❤️ by Bhau Automation