Skip to main content

pytest plugin to integrate tests with JIRA XRAY

Project description

PyPi Build status Code coverage

pytest-jira-xray is a plugin for pytest that uploads test results to JIRA XRAY.

Installation

pip install pytest-jira-xray

or

python setup.py install

Usage

Mark a test with JIRA XRAY test ID or list of IDs

# -- FILE: test_example.py
import pytest

@pytest.mark.xray('JIRA-1')
def test_foo():
    assert True

@pytest.mark.xray(['JIRA-2', 'JIRA-3'])
    def test_bar():
        assert True

Jira Xray configuration can be provided via Environment Variables:

  • Jira base URL:

$ export XRAY_API_BASE_URL=<Jira base URL>
  • Basic authentication:

$ export XRAY_API_USER=<jria username>
$ export XRAY_API_PASSWORD=<user password>
  • API KEY

$ export XRAY_API_KEY=<api key>
  • SSL Client Certificate

To disable SSL certificate verification, at the client side (no case-sensitive), default is True:

$ export XRAY_API_VERIFY_SSL=False

Or you can provide path to certificate file

$ export XRAY_API_VERIFY_SSL=</path/to/PEM file>
  • Cloud authentication:

$ export XRAY_CLIENT_ID=<client id>
$ export XRAY_CLIENT_SECRET=<client secret>
  • Test Execution parameters:

$ export XRAY_EXECUTION_TEST_ENVIRONMENTS="Env1 Env2 Env3"
$ export XRAY_EXECUTION_FIX_VERSION="1.0"
$ export XRAY_EXECUTION_REVISION=`git rev-parse HEAD`

$ export XRAY_EXECUTION_SUMMARY="Smoke tests" # New execution only
$ export XRAY_EXECUTION_DESC="This is an automated test execution of the smoke tests" # New execution only

Upload results

  • Upload results to new test execution:

$ pytest --jira-xray
  • Upload results to existing test execution:

$ pytest --jira-xray --execution TestExecutionId
  • Upload results to existing test plan (new test execution will be created):

$ pytest --jira-xray --testplan TestPlanId
  • Use with Jira API KEY:

$ pytest --jira-xray --api-key
  • Use with Jira cloud:

$ pytest --jira-xray --cloud
  • Store results in a file instead of exporting directly to a XRAY server

$ pytest --jira-xray --xraypath=xray.json

IntelliJ integration

When you want to synchronize your test results via. Pytest integration in IntelliJ, you need to configure the following:

  1. Use the pytest test configuration template and add –jira-xray -o log_cli=true to Additional Arguments

https://user-images.githubusercontent.com/22340156/145638520-c6bf56d2-089e-430c-94ae-ac8122a3adea.png
  1. Disable –no-summary in Settings

https://user-images.githubusercontent.com/22340156/145638538-71590ec8-86c6-4b93-9a99-460b4e38e153.png

Troubleshooting

This section holds information about common issues.

The Test XXX is in a non-executable status

  • Problem: The test is not executable by the user.

  • Solution: Make sure, that your test is not deactivated, approved and ready to use in Jira.

Error message from server: fixVersions: fixVersions

  • Problem: The version is malformed or doesn’t exist.

  • Solution: Make sure the version exists and the name matches the existing version and that only one version is used.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pytest_jira_xray-0.6.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest_jira_xray-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_jira_xray-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for pytest_jira_xray-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b67b45c9e3528f8b3ba752a555384ff8cffe341d0de04464cd16bef14e7e13f2
MD5 d7383c69adc6c6888eb6b7ef68de68b4
BLAKE2b-256 93fde04d9e1f958fd10c891228ee2b4282e43bc72329b75dbafc5293008aa84a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page