Typhoon HIL plugin for pytest
Project description
Typhoon HIL plugin for pytest
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
Requirements
pytest 5+
pytz, tzlocal
requests 2.23+
Installation
You can install “pytest-tytest” via pip from PyPI:
$ pip install pytest-tytest
Usage
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_PASSWORD: Your Jira account password
You can define credentials as environment variables:
export XRAY_CLIENT_ID=... export XRAY_CLIENT_SECRET=...
Or you can store credentials in a file:
XRAY_CLIENT_ID=... XRAY_CLIENT_SECRET=... ...
Create one or more run configuration files as Python modules, 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
Mark your tests with Jira issue keys, such as this:
@pytest.mark.xray(test_key='PRJ-123') def test_something(): pass
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
An example of invoking pytest:
pytest --runconfig=myparams.py --secrets=/private/secrets --xray-plan-key=PRJ-321 --xray-fail-silently=True
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytest_tytest-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8e78e969372a778eeb1bca7a15241ea9ed12b55f276043df3239c239064d83c |
|
MD5 | 867e5a455af26a0a96d44ab2c99e882e |
|
BLAKE2b-256 | 6e95bd4ee7f157fe5290b83324a1cc664d0e6cbe967dfa769c617add7adeddf1 |