Package: pytest-tytest
Typhoon HIL plugin for pytestFeaturesspecify test parameters in a python modulereference them inpytest.mark.parametrizedecoratorsmark tests as Jira+Xray issuessend test reports directly to Xray using Xray’s REST APIRequirementspytest 5+pytz, tzlocalrequests 2.23+InstallationYou can install “pytest-tytest” viapipfromPyPI:$ pip install pytest-tytestUsageCredentials for Jira and XrayPut credentials needed to access Jira and Xray in environment variables or a
file.XRAY_HOST: Xray URL, defaults tohttps://xray.cloud.xpand-it.comXRAY_CLIENT_ID: Client ID of your Xray API keyXRAY_CLIENT_SECRET: Client secret of your Xray API keyJIRA_HOST: Your Jira host, probablyhttps://mycompany.atlassian.netJIRA_USER: Your Jira account username, probably your email addressJIRA_PASSWORD: Your Jira API token,not your passwordYou 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 thesecretscommand
line parameter:pytest –secrets=/private/secretsTest parameters defined in Python modulesCreate 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.95All module attributes will be available at runtime astytest.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):
    passSpecify which parameter definition file you are using in command line:pytest --runconfig=myparams.pyMarking tests for Xray reportingMark your tests with Jira issue keys, such as this:@pytest.mark.xray(test_key='PRJ-123')
def test_something():
    passAssociate your test run with a test plan in Xray using the test plan key:pytest --xray-plan-key=DEMO-1234If 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=TrueEmbedding the Allure report linkIf you generate an Allure report during a test run, you can embed the link
to the report in Xray’s test execution issue by using this command line
parameter:pytest allure-url=https://jenkins.mycompany.com/jobs/my_job/123/allureCommand-line parameter summarypytest 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
--allure-url=ALLURE_URL
                      URL pointing to the Allure reportAn example of invokingpytest:pytest --runconfig=myparams.py --secrets=/private/secrets --xray-plan-key=PRJ-321 --xray-fail-silently=True --allure-url=https://jenkins.mycompany.com/jobs/my_job/123/allureContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense, “pytest-tytest” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.