Testrail Api
This is a Python wrapper of the TestRail API according to the official documentation
Install
Install using pip with
pip install testrail-api
Support environment variables
TESTRAIL_URL=https://example.testrail.com/
TESTRAIL_EMAIL=example@mail.com
TESTRAIL_PASSWORD=password
Example
from datetime import datetime
from testrail_api import TestRailAPI
api = TestRailAPI("https://example.testrail.com/", "example@mail.com", "password")
# if use environment variables
# api = TestRailAPI()
new_milestone = api.milestones.add_milestone(
project_id=1,
name="New milestone",
start_on=datetime.now()
)
my_test_run = api.runs.add_run(
project_id=1,
suite_id=2,
name="My test run",
include_all=True,
milestone_id=new_milestone["id"]
)
result = api.results.add_result_for_case(
run_id=my_test_run["id"],
case_id=5,
status_id=1,
comment="Pass",
version="1"
)
attach = "screenshots/attach.jpg"
api.attachments.add_attachment_to_result(result["id"], attach)
api.runs.close_run(my_test_run["id"])
api.milestones.update_milestone(new_milestone["id"], is_completed=True)
Custom response handler
from datetime import datetime
import simplejson
from testrail_api import TestRailAPI
def my_handler(response):
if response.ok:
return simplejson.loads(response.text)
return 'Error'
api = TestRailAPI("https://example.testrail.com/", "example@mail.com", "password", response_handler=my_handler)
new_milestone = api.milestones.add_milestone(
project_id=1,
name="New milestone",
start_on=datetime.now()
)
Contributing
Contributions are very welcome.
Getting started
- python 3.10+
- uv
- Clone the repository
git clone https://github.com/tolstislon/testrail-api.git cd testrail-api
- Install dev dependencies
uv sync - Format the code
uv run ruff format
- Run the linter
uv run ruff check --fix
- Run the tests
uv run pytest -n auto ./tests
Metadata
Release files for testrail-api 1.14.0
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 |
|---|---|---|---|---|
| testrail_api-1.14.0.tar.gz | 97.1 kB | Without provenance | Details for testrail_api-1.14.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| testrail_api-1.14.0-py3-none-any.whl | Python 3 | none | any | Details for testrail_api-1.14.0-py3-none-any.whl |
Total release size: 121.9 kB
Release files / testrail_api-1.14.0.tar.gz
| Download URL | testrail_api-1.14.0.tar.gz |
|---|---|
| Size | 97.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6b582914bbd736b3cf94318be360ec98c06cd5bbe43cedfeafd9e56f989692f
|
|
BLAKE2b-256 checksum How to use checksums |
684c2094044bf6c4e4f69aab58571bf6b2173fe8a605accf89d15756d8b1befc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / testrail_api-1.14.0-py3-none-any.whl
| Download URL | testrail_api-1.14.0-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b0e626b7da7a2234cdb947d33fa7d1037c1b63782aa565f9e0c91a4d3548749
|
|
BLAKE2b-256 checksum How to use checksums |
47936318d6435897c66dab3318b07d47faf951c0321bad694cc92d0757e601fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for testrail-api 1.14.0
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.