Pytest JIRA XRAY Plugin

0.9.3 · active · verified Fri Apr 17

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.

Common errors

Warnings

Install

Imports

Quickstart

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

view raw JSON →