A Python toolkit for importing JUnit test results to ReportPortal with property preservation, metadata handling, and querying capabilities.
Project was initially created by human with majority of the functionality. AI model was then used for documentation and refactoring of the project and code structure. Base unit and integration tests for the tools were generated by AI, reviewed by human.
# Install (editable but isolated tool mode -- recommended for making changes in the repo)
uv tool install -e .
# Configure (it is recommended to use proper configuration file see Configuration section)
export RP_URL="https://your-reportportal-instance.com"
export RP_TOKEN="your-token"
export RP_PROJECT="your-project-name"
# Export your Report Portal CA Bundle
export REQUESTS_CA_BUNDLE="<path-to-rp-ca-bundle>"
# Import JUnit results
rptool write --launch-name "Smoke Tests" results/junit_smoke.xml
# Query and analyze
rptool query --launch-id abc123
rptool trigger
rptool summary --attribute kuadrant:v1.3.1- JUnit Import: Convert JUnit XML to ReportPortal launches with property preservation
- Query & Filter: Query launches and test items by status, attributes, time range
- Auto-Analysis: Trigger ReportPortal's auto-analysis on uploaded results
- Release Summaries: Generate testing reports grouped by attributes
- Shell Completion: Tab completion for bash and zsh
- Custom Properties: Pass metadata from test suite through JUnit to ReportPortal (see mock_suite/README.md)
rptool - Unified CLI with subcommands:
write- Import JUnit results to ReportPortalquery- Query launches and test itemstrigger- Trigger auto-analysissummary- Generate release testing summarycompletion- Generate shell completion script
Instal UV
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or use system package manager
Clone the repository.
Static - In this mode any changes to the repository are not reflected with the installation, need to be updated on change
# Install as isolated tool
uv tool install .Dynamic / Editable - installed as an isolated tool, system wide, but linked from the repo, thus changes should be reflected
uv tool install -e .Uninstall
uv tool uninstall rptoolMaking virtual environment, and installing development dependencies.
uv sync --extra dev
source .venv/bin/activateRecommended install pre-commit hooks
uv tool install pre-commit # if not already installed
pre-commit install
# Test the hooks manually (without committing)
pre-commit run --all-files Config File (Recommended):
Copy settings.yaml.tpl to <USER_CONFIG_PATH> and customize. Configuration priority: CLI args > env vars > config file > defaults.
- Linux:
~/.config/rptool/settings.yaml - macOS:
~/Library/Application Support/rptool/settings.yaml - Windows:
%LOCALAPPDATA%\rptool\settings.yaml
Example:
mkdir -p ~/.config/rptool
cp settings.yaml.tpl ~/.config/rptool/settings.yaml
# Edit with your settingsEnvironment Variables (CI/CD):
export RP_URL="https://your-reportportal-instance.com"
export RP_TOKEN="your-token"
export RP_PROJECT="your-project-name"You can generate completion script for bash or zsh.
example:
rptool completion zsh > ~/completion_zsh/_rptoolNote: to propely enable completion for custom commands, there might be additional steps necessary for you shell.
# Import JUnit results
rptool write --launch-name "Smoke Tests" results/junit_smoke.xml
# Query launches
rptool query --launch-id abc123
rptool query --attribute tier:p0 --status FAILED
# Trigger auto-analysis
rptool trigger
# Generate release summary
rptool summary --attribute kuadrant-operator:v1.3.1 --show-details
rptool summary --attribute version:v2.0.0 --group-by platform --output-format json
# Shell completion
rptool completion bash > ~/.local/share/bash-completion/completions/rptool
rptool completion zsh > ~/.local/share/zsh-completion/completions/_rptoolSee rptool <command> --help for detailed options.
Pass metadata from test suite through JUnit to ReportPortal:
ReportPortal-specific properties (prefixed with __rp_):
__rp_launch_description- Launch description__rp_suite_description- Suite description__rp_case_description- Test case description
Standard properties (become ReportPortal attributes):
issue,env,os,platform,version,build,level,component, etc.
# pytest example
def test_something(record_testsuite_property):
record_testsuite_property('custom_property', 'custom_value')Note: recording properties, is not compatible with pytest-xdist, this is solved using (non-xdist) info_collector.py (mocksuite), and rptool promotes properties from this run to launch
Example:
@pytest.mark.issue(issue_id='JIRA-123')
@pytest.mark.component('Gateway')
def test_gateway():
'''This docstring becomes the test description'''
assert TrueSee mock_suite/README.md for complete property documentation and examples.
If you haven't used settings.yaml configuration file, you may use env variable, though it is recommended for CI/CD.
| Variable | Description | Required |
|---|---|---|
RP_URL |
ReportPortal instance URL | Yes |
RP_TOKEN |
ReportPortal API authentication token | Yes |
RP_PROJECT |
ReportPortal project name | Yes |
REQUESTS_CA_BUNDLE |
custom CA bundle for python requests library | No |
TRIGGER_AUTO_ANALYSIS |
Enable auto-analysis (true/false) |
No |
Launch finish timing: The ReportPortal Python client uses asynchronous batching. A 1-second delay is implemented before session termination to ensure all requests (especially finish_launch) are sent to the server. If launches still appear as "running" or get marked as "interrupted", increase the delay in src/reportportal/reportportal_client_wrapper.py line ~87. Additionally launch end_time is set to the actuall host time at the time of reporting, this seems to reliably solve the issue.
- mock_suite/README.md - Custom properties for pytest guide and example
MIT License - Copyright (c) 2026 Kuadrant. See LICENSE for details.
Authors:
- Zdenek Kraus (zkraus@redhat.com)
- Silvia Tarabova (starabov@redhat.com)