TestRail client by BestDoctor
Implements API v2 for TestRail.
Installation
pip install best_testrail_client
Prerequisites
-
Enabled API in your TestRail project.
-
Generated API key.
Usage
from best_testrail_client.client import TestRailClient
from best_testrail_client.enums import BaseResultStatus
from best_testrail_client.models.result import Result
from best_testrail_client.models.run import Run
# Client initialization
project_url = 'https://<YOUR_PROJECT>.testrail.io/' # or other URL for self-hosted
login = '<account email>'
api_token = '<generated API token>'
client = TestRailClient(project_url, login, api_token)
# Create Test Run
new_run = Run(
name='Test Run from API',
include_all=False,
case_ids=[1, 2, 3],
)
created_run = client.runs.add_run(run=new_run, project_id=1)
# You can set global Project ID
client.set_project_id(project_id=2)
# Add results for run
results = [
Result(status_id=BaseResultStatus.PASSED.value, case_id=1, comment='Passed test'),
Result(status_id=BaseResultStatus.FAILED.value, case_id=2, comment='Failed test'),
Result(status_id=6, case_id=3, comment='Waiting test'), # Custom status
]
client.results.add_results_for_cases(run_id=created_run.id, results=results)
# Close run
client.runs.close_run(run_id=created_run.id)
Custom attributes
Custom attributes are stored in custom dictionary attribute in models.
It stores all data from API and converts it back.
from best_testrail_client.client import TestRailClient
# Client initialization
project_url = 'https://<YOUR_PROJECT>.testrail.io/' # or other URL for self-hosted
login = '<account email>'
api_token = '<generated API token>'
client = TestRailClient(project_url, login, api_token)
created_run = client.runs.get_run(run_id=1)
"""
API response looks like:
{
...
'refs': 'SAN-1',
'custom_status1_count': 0,
'custom_status2_count': 0,
'custom_status3_count': 0,
'custom_status4_count': 0,
'custom_status5_count': 0,
'custom_status6_count': 0,
'custom_status7_count': 0,
'description': null,
...
}
It is now stored in custom attribute:
created_run.custom == {
'custom_status1_count': 0,
'custom_status2_count': 0,
'custom_status3_count': 0,
'custom_status4_count': 0,
'custom_status5_count': 0,
'custom_status6_count': 0,
'custom_status7_count': 0,
}
"""
Contributing
We would love you to contribute to our project. It's simple:
- Create an issue with bug you found or proposal you have. Wait for approve from maintainer.
- Create a pull request. Make sure all checks are green.
- Fix review comments if any.
- Be awesome.
Here are useful tips:
- You can run all checks and tests with
make check. Please do it before TravisCI does. - We use BestDoctor python styleguide.
- We respect Django CoC. Make soft, not bullshit.
Metadata
Release files for best-testrail-client 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| best_testrail_client-0.0.3.tar.gz | 21.0 kB | Without provenance | Details for best_testrail_client-0.0.3.tar.gz |
Release files / best_testrail_client-0.0.3.tar.gz
| Download URL | best_testrail_client-0.0.3.tar.gz |
|---|---|
| Size | 21.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84bb1f3ed8dfec0f2b0b3f6b40c1102fef020b9bdf3090070b1311715923a593
|
|
BLAKE2b-256 checksum How to use checksums |
b6d342f55570a0a71c8bc0bf8661fd89b94b5c4e9f6578586a4b5b3fb8348fc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Security for best-testrail-client 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.