testrail-api


Nametestrail-api JSON
Version 1.13.2 PyPI version JSON
download
home_pagehttps://github.com/tolstislon/testrail-api
SummaryPython wrapper of the TestRail API
upload_time2024-07-15 14:59:39
maintainerNone
docs_urlNone
authortolstislon
requires_python>=3.8
licenseMIT License
keywords testrail api client api-client library testrail_api testrail-api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Testrail Api

[![PyPI](https://img.shields.io/pypi/v/testrail-api?color=%2301a001&label=pypi&logo=version)](https://pypi.org/project/testrail-api/)
[![Downloads](https://pepy.tech/badge/testrail-api)](https://pepy.tech/project/testrail-api)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/testrail-api.svg)](https://pypi.org/project/testrail-api/)
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/testrail-api)](https://pypi.org/project/testrail-api/)
[![Build Pypi](https://github.com/tolstislon/testrail-api/actions/workflows/python-publish.yml/badge.svg)](https://github.com/tolstislon/testrail-api)

This is a Python wrapper of the TestRail API according
to [the official documentation](https://www.gurock.com/testrail/docs/api)


Install
----
Install using pip with

```bash
pip install testrail-api
```

##### Support environment variables

```dotenv
TESTRAIL_URL=https://example.testrail.com/
TESTRAIL_EMAIL=example@mail.com
TESTRAIL_PASSWORD=password
```

Example
----

```python
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

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tolstislon/testrail-api",
    "name": "testrail-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "testrail, api, client, api-client, library, testrail_api, testrail-api",
    "author": "tolstislon",
    "author_email": "tolstislon@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/95/49/989e7091f3a3957c383080701a865005a68f15687674ccb57cffe1a7f5c2/testrail_api-1.13.2.tar.gz",
    "platform": null,
    "description": "# Testrail Api\n\n[![PyPI](https://img.shields.io/pypi/v/testrail-api?color=%2301a001&label=pypi&logo=version)](https://pypi.org/project/testrail-api/)\n[![Downloads](https://pepy.tech/badge/testrail-api)](https://pepy.tech/project/testrail-api)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/testrail-api.svg)](https://pypi.org/project/testrail-api/)\n[![PyPI - Implementation](https://img.shields.io/pypi/implementation/testrail-api)](https://pypi.org/project/testrail-api/)\n[![Build Pypi](https://github.com/tolstislon/testrail-api/actions/workflows/python-publish.yml/badge.svg)](https://github.com/tolstislon/testrail-api)\n\nThis is a Python wrapper of the TestRail API according\nto [the official documentation](https://www.gurock.com/testrail/docs/api)\n\n\nInstall\n----\nInstall using pip with\n\n```bash\npip install testrail-api\n```\n\n##### Support environment variables\n\n```dotenv\nTESTRAIL_URL=https://example.testrail.com/\nTESTRAIL_EMAIL=example@mail.com\nTESTRAIL_PASSWORD=password\n```\n\nExample\n----\n\n```python\nfrom datetime import datetime\n\nfrom testrail_api import TestRailAPI\n\napi = TestRailAPI(\"https://example.testrail.com/\", \"example@mail.com\", \"password\")\n\n# if use environment variables\n# api = TestRailAPI()\n\n\nnew_milestone = api.milestones.add_milestone(\n    project_id=1,\n    name=\"New milestone\",\n    start_on=datetime.now()\n)\n\nmy_test_run = api.runs.add_run(\n    project_id=1,\n    suite_id=2,\n    name=\"My test run\",\n    include_all=True,\n    milestone_id=new_milestone[\"id\"]\n)\n\nresult = api.results.add_result_for_case(\n    run_id=my_test_run[\"id\"],\n    case_id=5,\n    status_id=1,\n    comment=\"Pass\",\n    version=\"1\"\n)\nattach = \"screenshots/attach.jpg\"\napi.attachments.add_attachment_to_result(result[\"id\"], attach)\n\napi.runs.close_run(my_test_run[\"id\"])\napi.milestones.update_milestone(new_milestone[\"id\"], is_completed=True)\n```\n\n#### Custom response handler\n\n```python\nfrom datetime import datetime\nimport simplejson\n\nfrom testrail_api import TestRailAPI\n\n\ndef my_handler(response):\n    if response.ok:\n        return simplejson.loads(response.text)\n    return 'Error'\n\n\napi = TestRailAPI(\"https://example.testrail.com/\", \"example@mail.com\", \"password\", response_handler=my_handler)\nnew_milestone = api.milestones.add_milestone(\n    project_id=1,\n    name=\"New milestone\",\n    start_on=datetime.now()\n)\n\n```\n\nContributing\n----\nContributions are very welcome.\n\n###### Getting started\n\n* python 3.11\n* pipenv 2022.12.19+\n\n1. Clone the repository\n    ```bash\n    git clone https://github.com/tolstislon/testrail-api.git\n    cd testrail-api\n   ```\n2. Install dev dependencies\n    ```bash\n    pipenv install --dev\n    pipenv shell\n   ```\n3. Run the black\n    ```bash\n    pipenv run black\n   ```\n4. Run the flake8\n    ```bash\n    pipenv run flake8\n   ```\n5. Run the tests\n    ```bash\n    pipenv run tests\n   ```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Python wrapper of the TestRail API",
    "version": "1.13.2",
    "project_urls": {
        "Homepage": "https://github.com/tolstislon/testrail-api"
    },
    "split_keywords": [
        "testrail",
        " api",
        " client",
        " api-client",
        " library",
        " testrail_api",
        " testrail-api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "018b1d67c227d5fbd0545c070e634c96f90ca6d45637551005c1824ac026f24d",
                "md5": "2912fe0eb64256eaa250748af16a3fe1",
                "sha256": "a0c7e3235ccf0393fe1d11df12597a3da2b63159b165264f1eb43eb6c1de5ecb"
            },
            "downloads": -1,
            "filename": "testrail_api-1.13.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2912fe0eb64256eaa250748af16a3fe1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20567,
            "upload_time": "2024-07-15T14:59:37",
            "upload_time_iso_8601": "2024-07-15T14:59:37.582528Z",
            "url": "https://files.pythonhosted.org/packages/01/8b/1d67c227d5fbd0545c070e634c96f90ca6d45637551005c1824ac026f24d/testrail_api-1.13.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9549989e7091f3a3957c383080701a865005a68f15687674ccb57cffe1a7f5c2",
                "md5": "234e9898c7eef2d53f0b279cedd3fc38",
                "sha256": "b37b6067375e33cc2a536dc679e6858610c7db425b1f768eb416a56856b39b07"
            },
            "downloads": -1,
            "filename": "testrail_api-1.13.2.tar.gz",
            "has_sig": false,
            "md5_digest": "234e9898c7eef2d53f0b279cedd3fc38",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 41067,
            "upload_time": "2024-07-15T14:59:39",
            "upload_time_iso_8601": "2024-07-15T14:59:39.096002Z",
            "url": "https://files.pythonhosted.org/packages/95/49/989e7091f3a3957c383080701a865005a68f15687674ccb57cffe1a7f5c2/testrail_api-1.13.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-15 14:59:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tolstislon",
    "github_project": "testrail-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "testrail-api"
}
        
Elapsed time: 0.30974s