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-xrayVerified import paths — ran on the pinned version, not inferred.
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.
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.
Ensure you include the appropriate flag (`--testplan-key <KEY>` or `--testexecution-key <KEY>`) with your `pytest` command when using `--upload-xray-results`.
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.
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.
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.
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.
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.