Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

pytest plugin for creating TestRail runs and adding results

Project Description

This is a pytest plugin for creating/editing testplans or testruns based on pytest markers. The results of the collected tests will be updated against the testplan/testrun in TestRail.


pip install pytest-testrail


Config for Pytest tests

Add a marker to the tests that will be picked up to be added to the run.

from pytest_testrail.plugin import testrail

@testrail('C1234', 'C5678')
def test_foo():
    # test code goes here

# OR

from pytest_testrail.plugin import pytestrail'C1234', 'C5678')
def test_bar():
    # test code goes here

See a more detailed example here.

Config for TestRail

  • Settings file template config:
url =
email =
password = <api_key>

assignedto_id = 1
project_id = 2
suite_id = 3


  • Set command line options (see below)


Basically, the following command will create a testrun in TestRail, add all marked tests to run. Once the all tests are finished they will be updated in TestRail:

py.test --testrail --tr-config=<settings file>.cfg

All available options

--testrail            Create and update testruns with TestRail
                      Path to the config file containing information about
                      the TestRail server (defaults to testrail.cfg)
--tr-url=TR_URL       TestRail address you use to access TestRail with your
                      web browser (config file: url in API section)
--tr-email=TR_EMAIL   Email for the account on the TestRail server (config
                      file: email in API section)
                      Password for the account on the TestRail server
                      (config file: password in API section)
                      ID of the user assigned to the test run (config file:
                      assignedto_id in TESTRUN section)
                      ID of the project the test run is in (config file:
                      project_id in TESTRUN section)
                      ID of the test suite containing the test cases (config
                      file: suite_id in TESTRUN section)
                      Name given to testrun, that appears in TestRail
                      (config file: name in TESTRUN section)
                      Identifier of testrun, that appears in TestRail. If
                      provided, option "--tr-testrun-name" will be ignored
                      Identifier of testplan, that appears in TestRail. If
                      provided, option "--tr-testrun-name" will be ignored
                      Indicate a version in Test Case result.
                      Do not check for valid SSL certificate on TestRail
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pytest-testrail-1.1.0.tar.gz (7.2 kB) Copy SHA256 Checksum SHA256 Source Dec 13, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting