Skip to main content

Python wrapper of the TestRail API

Project description

PyPI Downloads PyPI - Python Version PyPI - Python Version

This is a Python wrapper of the TestRail API(v2) according to the official documentation

Install

pip install testrail-api

Support environment variables

  • TESTRAIL_URL

  • TESTRAIL_EMAIL

  • TESTRAIL_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=int(datetime.now().timestamp())
)

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 = './attach.jpg'
api.attachments.add_attachment_to_result(result[0]['id'], attach)

api.runs.close_run(my_test_run['id'])
api.milestones.update_milestone(new_milestone['id'], is_completed=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

testrail_api-1.4.4-py3-none-any.whl (12.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page