Git Product home page Git Product logo

pytest-testrail's Introduction

pytest-testrail

PyPI version Downloads Codacy Badge

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.

Installation

pip install pytest-testrail

Configuration

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

    @pytestrail.case('C1234', 'C5678')
    def test_bar():
        # test code goes here

Or if you want to add defects to testcase result:

    from pytest_testrail.plugin import pytestrail

    @pytestrail.defect('PF-524', 'BR-543')
    def test_bar():
        # test code goes here

Config for TestRail

  • Settings file template config:
    [API]
    url = https://yoururl.testrail.net/
    email = [email protected]
    password = <api_key>

    [TESTRUN]
    assignedto_id = 1
    project_id = 2
    suite_id = 3
    plan_id = 4
    description = 'This is an example description'

    [TESTCASE]
    custom_comment = 'This is a custom comment'

Or

  • Set command line options (see below)

Usage

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

Examples:

TestRun will be created automatically

    py.test --testrail --tr-testrun-suite-id=XXXX

TestRun will be created automatically with testrun-name

    py.test --testrail --tr-testrun-name='TestRunName' --tr-testrun-suite-id=XXXX

TestPlan will be created automatically with testplan-name, TestRun will be added automatically

    py.test --testrail --tr-testplan-name='NameTestPlan' --tr-testrun-suite-id=XXXX

TestRun in TestPlan will be created automatically

    py.test --testrail --tr-plan-id=XXXXXX --tr-testrun-suite-id=XXXX

Update TestRun (XXXXXX) in TestPlan (ZZZZZ)

    py.test --testrail --tr-plan-id=ZZZZZZ --tr-plan-id=XXXXXX --tr-testrun-suite-id=XXXX

All available options

option description
--testrail Create and update testruns with TestRail
--tr-config Path to the config file containing information about the TestRail server (defaults to testrail.cfg)
--tr-url TestRail address you use to access TestRail with your web browser (config file: url in API section)
--tr-email Email for the account on the TestRail server (config file: email in API section)
--tr-password Password for the account on the TestRail server (config file: password in API section)
--tr-testrun-assignedto-id ID of the user assigned to the test run (config file:assignedto_id in TESTRUN section)
--tr-testrun-project-id ID of the project the test run is in (config file: project_id in TESTRUN section)
--tr-testrun-suite-id ID of the test suite containing the test cases (config file: suite_id in TESTRUN section)
--tr-testrun-suite-include-all Include all test cases in specified test suite when creating test run (config file: include_all in TESTRUN section)
--tr-testrun-name Name given to testrun, that appears in TestRail (config file: name in TESTRUN section)
--tr-testrun-description Description given to testrun, that appears in TestRail (config file: description in TESTRUN section)
--tr-run-id Identifier of testrun, that appears in TestRail. If provided, option "--tr-testrun-name" will be ignored
--tr-plan-id Identifier of testplan, that appears in TestRail (config file: plan_id in TESTRUN section) If provided, option "--tr-testrun-name" will be ignored
--tr-testplan-name Name given to testplan
--tr-testplan-description Description given to testplan
--tr-version Indicate a version in Test Case result.
--tr-no-ssl-cert-check Do not check for valid SSL certificate on TestRail host
--tr-close-on-complete Close a test plan or test run on completion.
--tr-dont-publish-blocked Do not publish results of "blocked" testcases in TestRail
--tr-skip-missing Skip test cases that are not present in testrun
--tr-milestone-id Identifier of milestone to be assigned to run
--tc-custom-comment Custom comment, to be appended to default comment for test case (config file: custom_comment in TESTCASE section)

pytest-testrail's People

Contributors

akqikserve avatar allankilpatrick avatar allanklp avatar allankp avatar amygitsthings avatar apallier avatar chartjes avatar cuongld2 avatar gridivit avatar hottes avatar igur007 avatar kobenguyent avatar mgeiger avatar neg3ntropy avatar nikikuzi avatar pavelvolokhov avatar reverbc avatar samdfonseca avatar voloxastik avatar yuriik-qa avatar zeburek avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.