testrail-api


Nametestrail-api JSON
Version 1.13.0 PyPI version JSON
download
home_pagehttps://github.com/tolstislon/testrail-api
SummaryPython wrapper of the TestRail API
upload_time2024-01-11 11:16:33
maintainer
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": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "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/0c/e8/ba121d6fe9d2ef398ecf6e7ba9e74c9ab2619cda4652d86a3a5f649f5f21/testrail_api-1.13.0.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.0",
    "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": "200579c765c5a976b7f35883edec452fe44c5276e115c8c5588f265d8a0bdbf3",
                "md5": "ec93b5a5bd44342d792feba670529580",
                "sha256": "f1ba28f1982a5627b47ebdab7646a1e0a41845c3f7181210f4fbb6c9df424f78"
            },
            "downloads": -1,
            "filename": "testrail_api-1.13.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ec93b5a5bd44342d792feba670529580",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20427,
            "upload_time": "2024-01-11T11:16:32",
            "upload_time_iso_8601": "2024-01-11T11:16:32.167454Z",
            "url": "https://files.pythonhosted.org/packages/20/05/79c765c5a976b7f35883edec452fe44c5276e115c8c5588f265d8a0bdbf3/testrail_api-1.13.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ce8ba121d6fe9d2ef398ecf6e7ba9e74c9ab2619cda4652d86a3a5f649f5f21",
                "md5": "f4cce9c6e2e961d3acb1d5ee366a5090",
                "sha256": "b4b196092b9effcfab3748e99876774f64eccbd58da59a959e7bbbb57f4a5252"
            },
            "downloads": -1,
            "filename": "testrail_api-1.13.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f4cce9c6e2e961d3acb1d5ee366a5090",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 40877,
            "upload_time": "2024-01-11T11:16:33",
            "upload_time_iso_8601": "2024-01-11T11:16:33.920385Z",
            "url": "https://files.pythonhosted.org/packages/0c/e8/ba121d6fe9d2ef398ecf6e7ba9e74c9ab2619cda4652d86a3a5f649f5f21/testrail_api-1.13.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-11 11:16:33",
    "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.16063s