junitparser
Manipulates JUnit/xUnit Result XML files
What it is and what it does
junitparser is a Python library for working with JUnit/xUnit test result XML files. It lets you parse existing XML reports, modify them programmatically, create new reports from scratch, and merge multiple result files together. The library supports the standard windyroad schema by default and can be extended with additional schemas like xunit2 through imports from submodules. It also provides a command-line interface for common operations like merging and verification.
The package has no external runtime dependencies, making it lightweight to install. It supports custom XML attributes and elements through monkey-patching, and allows you to specify alternative XML parsers like lxml for performance optimization. The library is actively maintained and requires Python 3.10 or above in its current version.
Use it for:
- Merge multiple test result XML files from parallel test runs into a single consolidated report.
- Parse existing JUnit XML files to extract test metrics, failure counts, or other metadata for analysis.
- Generate JUnit XML reports programmatically from custom test frameworks or CI/CD pipelines.
- Modify test result XML files to add properties, change classnames, or update test outcomes.
- Support extended test result formats like xunit2 with additional attributes such as interim results or system error logging.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parse, create, and manipulate JUnit/xUnit test result XML files, including merging multiple reports and supporting extended schemas like xunit2.
Yes. junitparser is a stable, actively maintained library with zero dependencies, permissive licensing, and no known vulnerabilities. Install it if you need to parse, generate, or manipulate JUnit/xUnit XML test reports. The Python 3.10+ requirement is the only constraint; if you're on an older Python version, use version 4.0.2 instead.
Install
junitparser on PyPI
pip
pip install junitparseruv
uv add junitparserpoetry
poetry add junitparserInstalling junitparser
Before you install
Low friction install with no runtime dependencies. Actively maintained as of July 2026 with recent releases.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install junitparser
from junitparser import TestCase, TestSuite, JUnitXml
case = TestCase('test_name')
suite = TestSuite('suite_name')
suite.add_testcase(case)
xml = JUnitXml()
xml.add_testsuite(suite)
xml.write('results.xml')
Requires Python 3.10 or above; version 4.0.2 is needed for Python 3.9 or below.
Verify before relying
- Whether the package handles all real-world JUnit/xUnit XML variants beyond the windyroad schema and xunit2.
- Performance characteristics when parsing or merging very large XML files.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 70 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,143,836/month — #1,245 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: junitparser-5.0.1-py3-none-any.whl
Keywords: junit, xunit, xml, parser
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
junit2htmlConverts JUnit or XUnit XML test result files…
permissive · top 5,000 on PyPI
xunitparserParses JUnit/XUnit XML test result files and…
permissive · top 15,000 on PyPI
junit-xmlGenerates JUnit XML test result documents…
permissive · top 5,000 on PyPI
unittest-xml-reportingA unittest test runner that exports test…
permissive · top 5,000 on PyPI
xmlrunnerA unittest test runner that exports test…
copyleft · top 15,000 on PyPI
junit-xml-2Generates JUnit XML test result reports from…
permissive · top 15,000 on PyPI
secscanner2junitConverts GitLab security scanner output (SAST,…
copyleft · top 15,000 on PyPI
flake8-formatter-junit-xmlFormats flake8 linting output as JUnit XML,…
permissive · top 15,000 on PyPI
pylint-junitGenerates JUnit-formatted XML reports from…
permissive · top 15,000 on PyPI
testresourcestestresources extends unittest to manage…
permissive · top 15,000 on PyPI