skillfed

junitparser

Manipulates JUnit/xUnit Result XML files

junitparser v5.0.1 14.1M downloads/30d#1,245 on PyPI140
Permissive license Apache-2.0 Active released

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 junitparser

uv

uv add junitparser

poetry

poetry add junitparser

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Topic :: Text Processing

Tags

junit xml parserxunit result parsingtest report xmlmerge junit filesjunit xml creationtest result xml manipulationxunit2 schema support
test-reportingxml-parsingci-cd

More Text Processing packages