Python wrapper of the TestRail API
Project description
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.11
- pipenv 2022.12.19+
- Clone the repository
git clone https://github.com/tolstislon/testrail-api.git cd testrail-api
- Install dev dependencies
pipenv install --dev pipenv shell
- Run the black
pipenv run black
- Run the flake8
pipenv run flake8
- Run the tests
pipenv run tests
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
testrail_api-1.13.4.tar.gz
(41.6 kB
view details)
Built Distribution
File details
Details for the file testrail_api-1.13.4.tar.gz
.
File metadata
- Download URL: testrail_api-1.13.4.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
27a2cfb4f64067f6a97db370ee04e274ae106029ccb344a587d44b156e5a2af7
|
|
MD5 |
c48010fe66cef763a86906b77f7d7d10
|
|
BLAKE2b-256 |
ac11c2714f51e1310356c07a295a239683a5028f463e6d031fe08d1c9c51a03e
|
File details
Details for the file testrail_api-1.13.4-py3-none-any.whl
.
File metadata
- Download URL: testrail_api-1.13.4-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
382e6978e677427eefa8ed1ec3e534f3ff4ab50c1cbf5731f6a9b190d75bbc8e
|
|
MD5 |
8c8af78bb418668371f50fcebf17473d
|
|
BLAKE2b-256 |
25c989a77da6c076daae4a81c753c7fc1ad65686ca2bfc527267a23996db8219
|