Skip to main content

Typhoon HIL plugin for pytest

Project description

PyPI version Python versions See Build Status on Travis CI

Typhoon HIL pytest integration with Jira and Xray

Features

  • specify test parameters in a python module

  • reference them in pytest.mark.parametrize decorators

  • mark tests as Jira+Xray issues

  • send test reports directly to Xray using Xray’s REST API

  • embed a URL to the test execution report in Xray

Requirements

  • pytest 5+

  • pytz, tzlocal

  • requests 2.23+

Installation

You can install “pytest-typhoon-xray” via pip from PyPI:

$ pip install pytest-typhoon-xray

Usage

Credentials for Jira and Xray

Put credentials needed to access Jira and Xray in environment variables or a file.

  • XRAY_HOST: Xray URL, defaults to https://xray.cloud.xpand-it.com

  • XRAY_CLIENT_ID: Client ID of your Xray API key

  • XRAY_CLIENT_SECRET: Client secret of your Xray API key

  • JIRA_HOST: Your Jira host, probably https://mycompany.atlassian.net

  • JIRA_USER: Your Jira account username, probably your email address

  • JIRA_TOKEN: Your Jira API token, not your password

You can define credentials as environment variables:

export XRAY_CLIENT_ID=...
export XRAY_CLIENT_SECRET=...

Or you can store credentials in a file, for example, /private/secrets:

XRAY_CLIENT_ID=...
XRAY_CLIENT_SECRET=...
...

Don’t put the variable values in quotes.

If you use a file to store credentials, you should use the secrets command line parameter:

pytest –secrets=/private/secrets

Test parameters defined in Python modules

Create a test parameter definition file as a Python module, such as this:

# myparams.py
import numpy as np

v_range = [277.0, 278.0]
f_range = np.arange(58, 63, 0.2)
vdc_range = [820.0]

class StayConnected:
    voltage_dip_perc = [22, 45, 85, 95]
    dip_total_time_pu = 0.95

All module attributes will be available at runtime as tytest.runtime_settings.Config.attr_name, for example:

from tytest.runtime_settings import Config as C

@python.mark.parametrize('v_range', C.v_range)
def test_something(v_range):
    pass

Specify which parameter definition file you are using in command line:

pytest --runconfig=myparams.py

Marking tests for Xray reporting

Mark your tests with Jira issue keys, such as this:

@pytest.mark.xray(test_key='PRJ-123')
def test_something():
    pass

Associate your test run with a test plan in Xray using the test plan key:

pytest --xray-plan-key=DEMO-1234

If you want to ignore potential networking errors while submitting test reports to Xray, turn this flag on:

pytest --xray-plan-key=DEMO-1234 --xray-fail-silently=True

Command-line parameter summary

pytest invocation now has some additional command line parameters:

--runconfig=RUNCONFIG
                      Specify test config script
--secrets=SECRETS     Full path to secrets file
--xray-plan-key=XRAY_PLAN_KEY
                      Key of the Xray issue that represents the test plan that is being run
--xray-fail-silently=XRAY_FAIL_SILENTLY
                      Ignore Xray communication errors
--web-url=WEB_URL
                      URL pointing to the Allure report

An example of invoking pytest:

pytest --runconfig=myparams.py --secrets=/private/secrets --xray-plan-key=PRJ-321 --xray-fail-silently=True --web-url=https://jenkins.mycompany.com/my_job/123/allure

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, “pytest-tytest” is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

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

Source Distribution

pytest-typhoon-xray-0.1.14.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_typhoon_xray-0.1.14-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-typhoon-xray-0.1.14.tar.gz.

File metadata

  • Download URL: pytest-typhoon-xray-0.1.14.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for pytest-typhoon-xray-0.1.14.tar.gz
Algorithm Hash digest
SHA256 96d5a0b596f749691288680bc94c294b909a55f46812dfecfc096f46552f8cca
MD5 39a4959879425ab79ed624976ad3f380
BLAKE2b-256 8b3bc83c9c5fe109db7dc5a869d57cb2d9756154c55e2588f74a55c259552b0c

See more details on using hashes here.

File details

Details for the file pytest_typhoon_xray-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: pytest_typhoon_xray-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for pytest_typhoon_xray-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 1636e8d812b6a0ffbbd4222001e98383294b4f5c957beecc2c31415d1d2265f3
MD5 4ac6e33c33fd8f7c7471b5be089d0fe7
BLAKE2b-256 bc2ec51db9e00f3a60248b3d4420d1610d06d8ac600497dcc09caeeee3214eb5

See more details on using hashes here.

Supported by

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