Convert JUnit/TestNG XML reports into readable HTML reports.
npm install junit-html-reporterHere's a complete README.md for your junit-html-reporter npm package:
---
Convert JUnit or TestNG XML reports into a clean, easy-to-read HTML report. Supports test exclusions, custom report titles, and provides a summary of passed, failed, and skipped tests.
---
- ✅ Converts JUnit or TestNG XML files into an embeddable HTML report.
- 📋 Displays an overall summary with total passed, failed, and skipped tests.
- 📂 Suite-wise breakdown of test cases with results and execution duration.
- 🛑 Excludes specified test cases automatically.
- 🔍 Automatically skips empty suites and test cases from the report.
- 🎨 Responsive, email-friendly HTML template.
---
``bash`
npm install -g junit-html-reporter
---
`bash`
junit-html-reporter
#### Parameters:
- → Path to the input JUnit or TestNG XML file.
- → Custom title for the HTML report.[output-path]
- → (Optional) Path to save the generated HTML report. Defaults to report.html.[excluded-tests]
- → (Optional) Comma-separated list of test names to exclude.
---
`bash`
junit-html-reporter ./results/report.xml "My Custom Test Report" ./output/report.html "RepeatedTest1,Test2ToExclude"
- Generates a report titled "My Custom Test Report".
- Excludes tests named RepeatedTest1 and Test2ToExclude from the report.
- Saves the output to ./output/report.html.
---
- Overall Summary:
- ✔ Passed: Total number of passed tests.
- ❌ Failed: Total number of failed tests.
- ⚠ Skipped: Total number of skipped tests.
- Suite-wise Breakdown:
- Displays suite names and corresponding test case details.
- Test case details include:
- Test name
- Status (Passed, Failed, Skipped)
- Execution duration
---
You can customize the HTML output by modifying the templates/reportTemplate.html file.
---
- Automatically excludes empty suites and test cases from the report and the overall count.
- Prevents clutter and ensures the report reflects only relevant information.
---
1. Clone the repository:
`bash`
git clone https://github.com/your-username/junit-html-reporter.git
cd junit-html-reporter
2. Install dependencies:
`bash`
npm install
3. Run the script locally:
`bash``
node ./bin/index.js ./results/report.xml "Local Test Report" ./output/report.html
4. Submit a pull request for any improvements! 🚀
---
This project is licensed under the MIT License.
---
Developed by Your Name 🚀
---
Let me know if you need any adjustments for the documentation! 🚀