Skip to main content

PyPI version Downloads MIT license pytest

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-testrail-e2e

Configuration

Config for Pytest tests

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

from pytest_testrail.plugin import testrail

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

# OR

from pytest_testrail.plugin import pytestrail

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

Or if you want to add defects to testcase result:

from pytest_testrail.plugin import pytestrail

@pytestrail.defect("PF-524", "BR-543")
def test_bar():
    # test code goes here

Skip a testcase [You need create ‘Skipped’ status in TestRail’]:

from pytest_testrail.plugin import pytestrail

@pytestrail.case("C1234")
@pytest.mark.skip("Mark as skipped description")
# or @pytest.mark.skip(reason="Mark as skipped description")
def test_bar():
    # test code goes here

Block a testcase:

from pytest_testrail.plugin import pytestrail

@pytestrail.case("C1234")
@pytest.mark.skip(reason="Mark as skipped description", block=True)
def test_bar():
    # test code goes 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
plan_id = 4
description = 'This is an example description'

[TESTCASE]
custom_comment = 'This is a custom comment'

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

option

description

–testrail

Create and update testruns with TestRail

–tr-config

Path to the config file containing information about the TestRail server (defaults to testrail.cfg)

–tr-url

TestRail address you use to access TestRail with your web browser (config file: url in API section)

–tr-email

Email for the account on the TestRail server (config file: email in API section)

–tr-password

Password for the account on the TestRail server (config file: password in API section)

–tr-testrun-as signedto-id

ID of the user assigned to the test run (config file:assignedto_id in TESTRUN section)

–tr-testrun-pr oject-id

ID of the project the test run is in (config file: project_id in TESTRUN section)

–tr-testrun-su ite-id

ID of the test suite containing the test cases (config file: suite_id in TESTRUN section)

–tr-testrun-su ite-include-all

Include all test cases in specified test suite when creating test run (config file: include_all in TESTRUN section)

–tr-testrun-na me

Name given to testrun, that appears in TestRail (config file: name in TESTRUN section)

–tr-testrun-de scription

Description given to testrun, that appears in TestRail (config file: description in TESTRUN section)

–tr-run-id

Identifier of testrun, that appears in TestRail. If provided, option “–tr-testrun-name” will be ignored

–tr-plan-id

Identifier of testplan, that appears in TestRail. If provided, option “–tr-testrun-name” will be ignored

–tr-version

Indicate a version in Test Case result.

–tr-no-ssl-cer t-check

Do not check for valid SSL certificate on TestRail host

–tr-close-on-c omplete

Close a test plan or test run on completion.

–tr-dont-publi sh-blocked

Do not publish results of “blocked” testcases in TestRail

–tr-skip-missi ng

Skip test cases that are not present in testrun

–tr-milestone- id

Identifier of milestone to be assigned to run

–tc-custom-com ment

Custom comment, to be appended to default comment for test case (config file: custom_comment in TESTCASE section)

–tr-report-sin gle-test

Report result immediately for each test case when it finished

TestRail Settings

To increase security, the TestRail team suggests using an API key instead of a password. You can see how to generate an API key here.

If you maintain your own TestRail instance on your own server, it is recommended to enable HTTPS for your TestRail installation.

For TestRail hosted accounts maintained by Gurock, all accounts will automatically use HTTPS.

You can read the whole TestRail documentation here.

Author

NGUYEN Viet - github

License

This project is licensed under the MIT license.

Acknowledgments

Download files

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

Source Distribution

pytest-testrail-e2e-2.1.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

pytest_testrail_e2e-2.1.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest-testrail-e2e-2.1.1.tar.gz.

File metadata

  • Download URL: pytest-testrail-e2e-2.1.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for pytest-testrail-e2e-2.1.1.tar.gz
Algorithm Hash digest
SHA256 4fad24d59fa357dfd52f139fa5a5f6da9acd7889eda4dad2b5c511f50cf72af8
MD5 836505c8fe31f50aa48ce4d54f71543f
BLAKE2b-256 ae7db9357a76b30546c4974132223d176eba6dd28d61269d25b0a85fea21a307

See more details on using hashes here.

File details

Details for the file pytest_testrail_e2e-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_testrail_e2e-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for pytest_testrail_e2e-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 def23d93aa6ea876568945981934d248513b8a2c2a78e1b9a6afb891254e7bfe
MD5 1e0dbd64fb4255df5bfe75dc78cd34e2
BLAKE2b-256 32d8c8ec2a5caf0ed0883694f901d5e2e73d06943bc1014f57d97798601fb2e5

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.2

2 files

This release

2.1.1 This release

2 files

2.0.0

2 files

1.0.4

2 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