Registry / testing / pytest-jira-xray

pytest-jira-xray

JSON →
library0.9.4pypypi✓ verified 84d ago

pytest-jira-xray is a pytest plugin that facilitates integration of test results with Atlassian JIRA's XRAY Test Management tool. It allows users to export pytest test results to XRAY JSON format or directly upload them to JIRA, associating tests with JIRA issues and updating test plans/executions. The current version is 0.9.3, and it appears to be actively maintained with releases tied to new features or bug fixes.

pip install pytest-jira-xray
INSTALL
IMPORT
SIG · PYTEST-JIRA-XRAY
P
pytest-jira-xray
testingpythonv0.9.4
Install
3.2s avg
Import
404ms
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.429s · 34.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.2s · import 0.380s · 35MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest.mark
import pytest
While not importing a specific class from the plugin, users interact with it primarily through pytest markers, e.g., @pytest.mark.jira(key='TEST-123').

This quickstart demonstrates creating a test file with JIRA markers and running pytest to generate an XRAY JSON report and upload results to a specified Test Plan/Execution. Authentication details (URL, user, password) can be provided via command-line arguments, environment variables, or configured in `pytest.ini`. For security, using environment variables for sensitive data is recommended.

# my_test.py import pytest @pytest.mark.jira(key='TP-100', test_key='TEST-456') def test_example_success(): assert True @pytest.mark.jira(key='TP-100', test_key='TEST-457') def test_example_failure(): assert False # pytest.ini # [pytest] # jira-url = https://your-jira-instance.com # jira-user = your-username # jira-password = your-password # Run from terminal: # export JIRA_URL='https://your-jira-instance.com' # export JIRA_USER='your-username' # export JIRA_PASSWORD='your-password' # pytest --xray-json=xray_report.json --jira-url "${JIRA_URL}" --jira-user "${JIRA_USER}" --jira-password "${JIRA_PASSWORD}" --testplan-key "TP-100" --testexecution-key "TP-EXEC-123" --upload-xray-results
Debug
Known issues
gotchaAuthentication details (JIRA URL, user, password) can be provided via command-line arguments, environment variables (JIRA_URL, JIRA_USER, JIRA_PASSWORD), or `pytest.ini`. Command-line arguments take precedence over environment variables, which take precedence over `pytest.ini`.
fix
Be mindful of the precedence order. For CI/CD, environment variables are often preferred for security and flexibility. For local development, `pytest.ini` can be convenient.
affects: All versions
gotchaWhen uploading results to a new or existing Test Execution, you must provide either `--testplan-key` to create a new execution under that plan, or `--testexecution-key` to update an existing execution.
fix
Ensure you include the appropriate flag (`--testplan-key <KEY>` or `--testexecution-key <KEY>`) with your `pytest` command when using `--upload-xray-results`.
affects: All versions
gotchaThe plugin relies on specific XRAY API endpoints. Differences between XRAY Cloud and XRAY Data Center/Server versions can sometimes cause unexpected behavior, although the plugin generally attempts to abstract these.
fix
Consult the official pytest-jira-xray documentation and XRAY API documentation if you encounter unexpected errors, especially when interacting with different JIRA/XRAY hosting types. Ensure your JIRA instance and XRAY plugin are up-to-date.
affects: All versions
Errors
Common errors & fixes
Jira Xray API Error: 401 Unauthorized
Incorrect JIRA URL, username, or password provided. The credentials do not have permission to access JIRA or the XRAY API.
fix
Verify your JIRA_URL, JIRA_USER, and JIRA_PASSWORD (or corresponding CLI arguments/pytest.ini entries) are correct and that the user has necessary permissions in JIRA and XRAY. Test credentials separately if possible.
Error: the following arguments are required: --xray-json
You are trying to run pytest-jira-xray without specifying an output file for the XRAY JSON report or explicitly disabling JSON output when uploading results directly.
fix
If you want to generate a JSON report, add `--xray-json=<path/to/report.json>`. If you are uploading directly to Jira and don't need a local JSON file, you still need to ensure `--upload-xray-results` is used correctly with JIRA credentials and test execution details.
XRAY: The Test Plan with key 'XXX-YYY' does not exist.
The Test Plan key provided with `--testplan-key` does not correspond to an actual Test Plan in JIRA.
fix
Double-check the Test Plan key for typos or ensure that the Test Plan actually exists in your JIRA instance and is accessible to the provided JIRA user.
Cannot assign a test case key 'TEST-XXX' to a test method because it already exists in a different test execution.
This usually happens when trying to update test cases in a Test Execution where the link between the test method and XRAY Test Case is already established differently or there's a conflict in how tests are mapped.
fix
Verify that your test methods are uniquely mapped to XRAY Test Cases via the `@pytest.mark.jira(test_key='TEST-XXX')` marker. If you're using Test Plans, ensure the test cases are correctly associated within the plan.
Upgrade
Version history
0.9.4latest on PyPI · released Apr 24, 2026
Audit
Dependencies
pytestrequiredThis is a pytest plugin; pytest is a peer dependency required for its functionality.
jirarequiredUsed for interacting with the Jira API for test management operations.
Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
1
Resources
pytest-jira-xray — pip install pytest-jira-xray · libregistry