junit-html-reporter
v1.0.5
Published
Convert JUnit/TestNG XML reports into readable HTML reports.
Downloads
23
Readme
Here's a complete README.md for your junit-html-reporter npm package:
📊 JUnit HTML Reporter
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.
🚀 Features
- ✅ 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.
📦 Installation
npm install -g junit-html-reporter🛠️ Usage
junit-html-reporter <xml-path> <report-title> [output-path] [excluded-tests]Parameters:
<xml-path>→ Path to the input JUnit or TestNG XML file.<report-title>→ Custom title for the HTML report.[output-path]→ (Optional) Path to save the generated HTML report. Defaults toreport.html.[excluded-tests]→ (Optional) Comma-separated list of test names to exclude.
✅ Example Command
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.
📋 Sample Report Structure
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
🎨 Custom HTML Template
You can customize the HTML output by modifying the templates/reportTemplate.html file.
🐞 Handling Empty Suites & Tests
- Automatically excludes empty suites and test cases from the report and the overall count.
- Prevents clutter and ensures the report reflects only relevant information.
🔧 Development & Contributions
Clone the repository:
git clone https://github.com/your-username/junit-html-reporter.git cd junit-html-reporterInstall dependencies:
npm installRun the script locally:
node ./bin/index.js ./results/report.xml "Local Test Report" ./output/report.htmlSubmit a pull request for any improvements! 🚀
📄 License
This project is licensed under the MIT License.
🙏 Credits
Developed by Your Name 🚀
Let me know if you need any adjustments for the documentation! 🚀
