Skip to main content

Build Status PyPI version

This is a pytest plugin for creating/editing testplans or testruns based on pytest markers. The results of the collected tests will be updated against the testplan/testrun in TestRail.

Installation

pip install pytest-rail

Configuration

Config for Pytest tests

Add a marker to the tests that will be picked up to be added to the run.

from pytest_rail.plugin import testrail

@testrail('C1234', 'C5678')
def test_foo():
    # test code goes here

# OR

from pytest_rail.plugin import pytestrail

@pytestrail.case('C1234', 'C5678')
def test_bar():
    # test code goes here

See a more detailed example here.

Config for TestRail

  • Settings file template config:

[API]
url = https://yoururl.testrail.net/
email = user@email.com
password = <api_key>

[TESTRUN]
assignedto_id = 1
project_id = 2
suite_id = 3

Or

  • Set command line options (see below)

Usage

Basically, the following command will create a testrun in TestRail, add all marked tests to run. Once the all tests are finished they will be updated in TestRail:

py.test --testrail --tr-config=<settings file>.cfg

All available options

--testrail            Create and update testruns with TestRail
--tr-config=TR_CONFIG
                      Path to the config file containing information about
                      the TestRail server (defaults to testrail.cfg)
--tr-url=TR_URL       TestRail address you use to access TestRail with your
                      web browser (config file: url in API section)
--tr-email=TR_EMAIL   Email for the account on the TestRail server (config
                      file: email in API section)
--tr-password=TR_PASSWORD
                      Password for the account on the TestRail server
                      (config file: password in API section)
--tr-testrun-assignedto-id=TR_TESTRUN_ASSIGNEDTO_ID
                      ID of the user assigned to the test run (config file:
                      assignedto_id in TESTRUN section)
--tr-testrun-project-id=TR_TESTRUN_PROJECT_ID
                      ID of the project the test run is in (config file:
                      project_id in TESTRUN section)
--tr-testrun-suite-id=TR_TESTRUN_SUITE_ID
                      ID of the test suite containing the test cases (config
                      file: suite_id in TESTRUN section)
--tr-testrun-suite-include-all
                      Include all test cases in specified test suite when
                      creating test run (config file: include_all in TESTRUN
                      section)
--tr-testrun-name=TR_TESTRUN_NAME
                      Name given to testrun, that appears in TestRail
                      (config file: name in TESTRUN section)
--tr-run-id=TR_RUN_ID
                      Identifier of testrun, that appears in TestRail. If
                      provided, option "--tr-testrun-name" will be ignored
--tr-plan-id=TR_PLAN_ID
                      Identifier of testplan, that appears in TestRail. If
                      provided, option "--tr-testrun-name" will be ignored
--tr-version=TR_VERSION
                      Indicate a version in Test Case result.
--tr-no-ssl-cert-check
                      Do not check for valid SSL certificate on TestRail
                      host
--tr-close-on-complete
                      Close a test plan or test run on completion.
--tr-dont-publish-blocked
                      Do not publish results of "blocked" testcases in
                      TestRail
--tr-skip-missing     Skip test cases that are not present in testrun

Release files for pytest-rail 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-rail 1.0.5
File Size Uploaded
pytest-rail-1.0.5.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-rail 1.0.5
File Interpreter ABI Platform
pytest_rail-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / pytest-rail-1.0.5.tar.gz

Download URL pytest-rail-1.0.5.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d796184df7ad196d13377f5bcc877b5fdc164efc1e5c7cbf75bddac13db9d138
BLAKE2b-256 checksum
How to use checksums
741c390f9ae48486db138daec1e53a24b4ff0fe1d1635203d877f531319d95ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.10

Release files / pytest_rail-1.0.5-py3-none-any.whl

Download URL pytest_rail-1.0.5-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79933192ec74046fb34a6e5eaae6c9a8a4f74145c30ff1941bb8a6dc8f460aa4
BLAKE2b-256 checksum
How to use checksums
2eee1e5e29eb4037be895991bdb4672b089f7b63eb26a84ef74fdf80caa5d424
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.10

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page