Skip to main content

Testrail Api

PyPI Downloads PyPI - Python Version PyPI - Implementation Build Pypi

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+
  1. Clone the repository
    git clone https://github.com/tolstislon/testrail-api.git
    cd testrail-api
    
  2. Install dev dependencies
    pipenv install --dev
    pipenv shell
    
  3. Run the black
    pipenv run black
    
  4. Run the flake8
    pipenv run flake8
    
  5. Run the tests
    pipenv run tests
    

Metadata

Release files for testrail-api 1.13.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for testrail-api 1.13.6
File Size Uploaded
testrail_api-1.13.6.tar.gz 43.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for testrail-api 1.13.6
File Interpreter ABI Platform
testrail_api-1.13.6-py3-none-any.whl Python 3 none any Details

Total release size: 63.6 kB

Release files / testrail_api-1.13.6.tar.gz

Download URL testrail_api-1.13.6.tar.gz
Size 43.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e9ade5aa08f8a98b6aad03d8e3c8295ad09f8880978ac2c822637668dce45cc8
BLAKE2b-256 checksum
How to use checksums
d1bb5a12a8cb876edc300f9a21f94d4ab79e0380aab48466560263bff8ffda84
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.13.6-py3-none-any.whl

Download URL testrail_api-1.13.6-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bd623cb6190059e4e1cab9727914890243b7a2f01e6abdf8f1bb7ed9d591b6a
BLAKE2b-256 checksum
How to use checksums
900d876ddca3da3a735262865c05e01dd93288811c19bcca3f9ad13c9860d885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

1.13.6 This release

2 release files

1.13.5

2 release files

1.13.4

2 release files

1.13.2

2 release files

1.13.1

2 release files

1.13.0

2 release files

1.12.1

2 release files

1.12.0

1 release file

1.11.0

1 release file

1.10.6

1 release file

1.10.5

1 release file

1.10.4

1 release file

1.10.3

1 release file

1.10.2

1 release file

1.10.1

1 release file

1.10.0

1 release file

1.9.1

1 release file

1.9.0

1 release file

1.8.1

1 release file

1.8.0

1 release file

1.7.2

1 release file

1.7.1

1 release file

1.7.0

1 release file

1.6.4

1 release file

1.6.3

1 release file

1.6.2

1 release file

1.6.1

1 release file

1.6.0

1 release file

1.5.0

1 release file

1.4.11

1 release file

1.4.6

1 release file

1.4.5

1 release file

1.4.4

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.6

1 release file

1.3.5

1 release file

1.3.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

2 release 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