Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Python wrapper of the TestRail API

Project description

Testrail Api

PyPI Downloads PyPI - Python Version PyPI - Implementation Build Status codecov

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
  • 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=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)

Contributing

Contributions are very welcome.

Project details


Download files

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

Files for testrail-api, version 1.8.1
Filename, size File type Python version Upload date Hashes
Filename, size testrail_api-1.8.1-py2.py3-none-any.whl (15.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page