pytest plugin for creating TestRail runs and adding results
Project description
pytest-testrail
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
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
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-assignedto-id | ID of the user assigned to the test run (config file:assignedto_id in TESTRUN section) |
| --tr-testrun-project-id | ID of the project the test run is in (config file: project_id in TESTRUN section) |
| --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 | Name given to testrun, that appears in TestRail (config file: name in TESTRUN section) |
| --tr-testrun-description | 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 (config file: plan_id in TESTRUN section) If provided, option "--tr-testrun-name" will be ignored |
| --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 |
| --tr-milestone-id | Identifier of milestone to be assigned to run |
| --tc-custom-comment | Custom comment, to be appended to default comment for test case (config file: custom_comment in TESTCASE section) |
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file testrail-pytest-1.0.0.tar.gz.
File metadata
- Download URL: testrail-pytest-1.0.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3d481dad6f0fdd80c7c95e9c905fd01a14dfe354d8c1bb5d76d8ca25ae2d333
|
|
| MD5 |
8710896c78ed45d80a34bfbe686c2ab6
|
|
| BLAKE2b-256 |
b8d7167c77c09223cf571d55012daab9396f4d96d780f388bb80a9c382716d84
|
File details
Details for the file testrail_pytest-1.0.0-py3-none-any.whl.
File metadata
- Download URL: testrail_pytest-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d681d1548269ed9317380216fce7bafc4a3a2b6b04994d66734f442f96de1e03
|
|
| MD5 |
39525944260d2627bdc27d431fe83038
|
|
| BLAKE2b-256 |
8b9f23cce172d66e5a573fc9944037f4983b6603e93c2add178b0cf420946911
|