qa-kit


Nameqa-kit JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/roshanguptamca/qa-kit
SummaryCLI + generator for REST API pytest integration tests with Allure reporting
upload_time2025-11-05 22:34:09
maintainerNone
docs_urlNone
authorRoshan Gupta
requires_python<4.0,>=3.13
licenseMIT
keywords api testing pytest allure automation cli httpx
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # QA-Kit

**QA-Kit** is a CLI and test generator for REST API integration tests using **pytest** and **httpx**, with built-in support for **Allure reporting**. Generate tests from JSON specifications, run them asynchronously, and generate detailed HTML reports.

---
## Documentation

For detailed usage instructions, CI/CD examples, and setup guide, see the full documentation:

[QA-Kit User Guide (Google Docs)](https://docs.google.com/document/d/10j6AAWTP2WhPDghi9L3MmLJgjmWtkbnyXdMrW6Do1MI/edit?usp=sharing)

## Features

- Generate `pytest` tests from JSON API specifications
- Async HTTP requests with `httpx`
- Partial JSON assertions with recursive key ignore support
- Optional wildcard matching for ignored keys
- Global option to skip assertions
- Allure reporting support (HTML reports)
- Fully configurable via environment variables
- CLI for generation, running, linting, and reporting
- Production-ready and PyPI compatible

---

## Installation
### 1. Clone the repository
```bash
git clone https://github.com/roshanguptamca/qa-kit.git
cd qa-kit
```
### Install Python dependencies (recommended via Poetry)

```bash 
poetry install
```
### Install Allure CLI (required for HTML reports)
macOS (Homebrew):
```bash 
brew install allure
```

Linux (Debian/Ubuntu):
```bash 
sudo apt-add-repository ppa:qameta/allure
sudo apt update
sudo apt install allure

```
Windows (via Scoop):
```bash 
scoop install allure
```

Verify installation:
```bash 
allure --version
````

⚠️ QA-Kit will fail to generate HTML reports without the Allure CLI.

4. (Optional) Docker

If you prefer, Allure reports can also be generated via Docker:
```bash 
docker run --rm -v $(pwd)/allure-results:/allure-results -v $(pwd)/allure-report:/allure
```

# Quick Start
```bash
pip install qa-kit


Or install from GitHub:

```bash
pip install git+https://github.com/roshanguptamca/qa-kit.git
```

1. Prepare JSON specs
    Example: tests/specs/cart_api.json:
        ```json```
        {
          "name": "Cart API Suite",
          "base_url": "https://api.example.com",
          "tests": [
            {
              "id": "create-cart-1",
              "name": "create_cart",
              "method": "POST",
              "path": "/cart/",
              "body": {
                "channel": {"id": "online", "name": "Online"}
              },
              "expected": {
                "status_code": 200,
                "json": {
                  "status": "ACTIVE",
                  "channel": {"id": "online"}
                }
              }
            }
          ]
        }

        ```
2. Generate tests
    ```bash 
   qa_kit generate tests/specs/cart_api.json -o tests/generated
    ```
3. Run tests with Allure reporting
    ```bash` qa_kit run -t tests/generated
    ``````
4. Generate Allure report
    ```bash
   qa_kit report -o allure-report
    ```     
 This runs tests and generates results in allure-results. You can then open the report:
    ```bash
   qa_kit open
    ```
# Environment Variables
- `QA_KIT_SSL_VERIFY`: Set to `true` to enable SSL verification (default: `false`)
- `USE_WILDCARD`: Set to `true` to enable wildcard matching for ignored keys (default: `false`)
- `IGNORE_ASSERT` : Set to `true` to skip JSON assertions (default: `false`)

# JSON Spec Options:

| Field                  | Description                                      |
| ---------------------- | ------------------------------------------------ |
| `id`                   | Unique test identifier                           |
| `name`                 | Test name                                        |
| `method`               | HTTP method (`GET`, `POST`, etc.)                |
| `path`                 | Endpoint path                                    |
| `body`                 | JSON body for request                            |
| `params`               | Query parameters                                 |
| `expected.status_code` | Expected HTTP status code                        |
| `expected.json`        | Expected JSON response                           |
| `ignore_assert`        | Skip JSON assertions for this test               |
| `ignore_json`          | List of keys to ignore recursively in assertions |
| `use_wildcard`         | Enable wildcard for ignored keys                 |


# Example Generated Test:
```python
import pytest
import allure
import httpx
from tests.utils.test_helpers import _assert_partial, SSL_VERIFY

BASE_URL = "https://jsonplaceholder.typicode.com"

@allure.story("JSONPlaceholder API Suite")
async def test_get_post_1_get_post_1():
    """get_post_1"""
    async with httpx.AsyncClient(base_url=BASE_URL, verify=SSL_VERIFY) as client:
        resp = await client.request(
            "GET",
            "/posts/1",
            json={},
            params={}
        )

    assert resp.status_code == 200
    _assert_partial({
        "userId": 1,
        "id": 1
    }, resp.json(), ignore_keys=[], use_wildcard=False)
```


# Example:
# Project Structure
```
tests/
├── specs/         # JSON API specs
├── generated/     # Generated tests
└── utils/
    └── test_helpers.py  # Shared helpers

```
# Contributing

Contributions welcome! Please fork, create a branch, and submit PRs.
Follow black, isort, and flake8 for code formatting and linting.

# License 
MIT © RoshanGupta






            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/roshanguptamca/qa-kit",
    "name": "qa-kit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.13",
    "maintainer_email": null,
    "keywords": "API testing, pytest, allure, automation, cli, httpx",
    "author": "Roshan Gupta",
    "author_email": "roshanguptamca@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/55/93/1d0fe37f596867442a57497894bde9987b1bd5469c6516f6b463861cb462/qa_kit-0.1.2.tar.gz",
    "platform": null,
    "description": "# QA-Kit\n\n**QA-Kit** is a CLI and test generator for REST API integration tests using **pytest** and **httpx**, with built-in support for **Allure reporting**. Generate tests from JSON specifications, run them asynchronously, and generate detailed HTML reports.\n\n---\n## Documentation\n\nFor detailed usage instructions, CI/CD examples, and setup guide, see the full documentation:\n\n[QA-Kit User Guide (Google Docs)](https://docs.google.com/document/d/10j6AAWTP2WhPDghi9L3MmLJgjmWtkbnyXdMrW6Do1MI/edit?usp=sharing)\n\n## Features\n\n- Generate `pytest` tests from JSON API specifications\n- Async HTTP requests with `httpx`\n- Partial JSON assertions with recursive key ignore support\n- Optional wildcard matching for ignored keys\n- Global option to skip assertions\n- Allure reporting support (HTML reports)\n- Fully configurable via environment variables\n- CLI for generation, running, linting, and reporting\n- Production-ready and PyPI compatible\n\n---\n\n## Installation\n### 1. Clone the repository\n```bash\ngit clone https://github.com/roshanguptamca/qa-kit.git\ncd qa-kit\n```\n### Install Python dependencies (recommended via Poetry)\n\n```bash \npoetry install\n```\n### Install Allure CLI (required for HTML reports)\nmacOS (Homebrew):\n```bash \nbrew install allure\n```\n\nLinux (Debian/Ubuntu):\n```bash \nsudo apt-add-repository ppa:qameta/allure\nsudo apt update\nsudo apt install allure\n\n```\nWindows (via Scoop):\n```bash \nscoop install allure\n```\n\nVerify installation:\n```bash \nallure --version\n````\n\n\u26a0\ufe0f QA-Kit will fail to generate HTML reports without the Allure CLI.\n\n4. (Optional) Docker\n\nIf you prefer, Allure reports can also be generated via Docker:\n```bash \ndocker run --rm -v $(pwd)/allure-results:/allure-results -v $(pwd)/allure-report:/allure\n```\n\n# Quick Start\n```bash\npip install qa-kit\n\n\nOr install from GitHub:\n\n```bash\npip install git+https://github.com/roshanguptamca/qa-kit.git\n```\n\n1. Prepare JSON specs\n    Example: tests/specs/cart_api.json:\n        ```json```\n        {\n          \"name\": \"Cart API Suite\",\n          \"base_url\": \"https://api.example.com\",\n          \"tests\": [\n            {\n              \"id\": \"create-cart-1\",\n              \"name\": \"create_cart\",\n              \"method\": \"POST\",\n              \"path\": \"/cart/\",\n              \"body\": {\n                \"channel\": {\"id\": \"online\", \"name\": \"Online\"}\n              },\n              \"expected\": {\n                \"status_code\": 200,\n                \"json\": {\n                  \"status\": \"ACTIVE\",\n                  \"channel\": {\"id\": \"online\"}\n                }\n              }\n            }\n          ]\n        }\n\n        ```\n2. Generate tests\n    ```bash \n   qa_kit generate tests/specs/cart_api.json -o tests/generated\n    ```\n3. Run tests with Allure reporting\n    ```bash` qa_kit run -t tests/generated\n    ``````\n4. Generate Allure report\n    ```bash\n   qa_kit report -o allure-report\n    ```     \n This runs tests and generates results in allure-results. You can then open the report:\n    ```bash\n   qa_kit open\n    ```\n# Environment Variables\n- `QA_KIT_SSL_VERIFY`: Set to `true` to enable SSL verification (default: `false`)\n- `USE_WILDCARD`: Set to `true` to enable wildcard matching for ignored keys (default: `false`)\n- `IGNORE_ASSERT` : Set to `true` to skip JSON assertions (default: `false`)\n\n# JSON Spec Options:\n\n| Field                  | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `id`                   | Unique test identifier                           |\n| `name`                 | Test name                                        |\n| `method`               | HTTP method (`GET`, `POST`, etc.)                |\n| `path`                 | Endpoint path                                    |\n| `body`                 | JSON body for request                            |\n| `params`               | Query parameters                                 |\n| `expected.status_code` | Expected HTTP status code                        |\n| `expected.json`        | Expected JSON response                           |\n| `ignore_assert`        | Skip JSON assertions for this test               |\n| `ignore_json`          | List of keys to ignore recursively in assertions |\n| `use_wildcard`         | Enable wildcard for ignored keys                 |\n\n\n# Example Generated Test:\n```python\nimport pytest\nimport allure\nimport httpx\nfrom tests.utils.test_helpers import _assert_partial, SSL_VERIFY\n\nBASE_URL = \"https://jsonplaceholder.typicode.com\"\n\n@allure.story(\"JSONPlaceholder API Suite\")\nasync def test_get_post_1_get_post_1():\n    \"\"\"get_post_1\"\"\"\n    async with httpx.AsyncClient(base_url=BASE_URL, verify=SSL_VERIFY) as client:\n        resp = await client.request(\n            \"GET\",\n            \"/posts/1\",\n            json={},\n            params={}\n        )\n\n    assert resp.status_code == 200\n    _assert_partial({\n        \"userId\": 1,\n        \"id\": 1\n    }, resp.json(), ignore_keys=[], use_wildcard=False)\n```\n\n\n# Example:\n# Project Structure\n```\ntests/\n\u251c\u2500\u2500 specs/         # JSON API specs\n\u251c\u2500\u2500 generated/     # Generated tests\n\u2514\u2500\u2500 utils/\n    \u2514\u2500\u2500 test_helpers.py  # Shared helpers\n\n```\n# Contributing\n\nContributions welcome! Please fork, create a branch, and submit PRs.\nFollow black, isort, and flake8 for code formatting and linting.\n\n# License \nMIT \u00a9 RoshanGupta\n\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CLI + generator for REST API pytest integration tests with Allure reporting",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/roshanguptamca/qa-kit",
        "Repository": "https://github.com/roshanguptamca/qa-kit"
    },
    "split_keywords": [
        "api testing",
        " pytest",
        " allure",
        " automation",
        " cli",
        " httpx"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d0aad59c4495d4377e62dfcf8b5a644ca3e5f6a25040559647a2b68e182b0aa",
                "md5": "a712e789db66711df775b09c08853ad3",
                "sha256": "3ebf914bd23191cbc81b2efc6dc22c2a76afa5b6bd3b1e6c75bc152adf88c618"
            },
            "downloads": -1,
            "filename": "qa_kit-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a712e789db66711df775b09c08853ad3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.13",
            "size": 10278,
            "upload_time": "2025-11-05T22:34:07",
            "upload_time_iso_8601": "2025-11-05T22:34:07.996914Z",
            "url": "https://files.pythonhosted.org/packages/1d/0a/ad59c4495d4377e62dfcf8b5a644ca3e5f6a25040559647a2b68e182b0aa/qa_kit-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "55931d0fe37f596867442a57497894bde9987b1bd5469c6516f6b463861cb462",
                "md5": "4f95723e526d09207567446739740a1b",
                "sha256": "7eb991c4cda4356b85d3b2bcc03594fa64d3d3090fa2af004df19d40c6d3a8c0"
            },
            "downloads": -1,
            "filename": "qa_kit-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4f95723e526d09207567446739740a1b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.13",
            "size": 8060,
            "upload_time": "2025-11-05T22:34:09",
            "upload_time_iso_8601": "2025-11-05T22:34:09.122858Z",
            "url": "https://files.pythonhosted.org/packages/55/93/1d0fe37f596867442a57497894bde9987b1bd5469c6516f6b463861cb462/qa_kit-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-05 22:34:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "roshanguptamca",
    "github_project": "qa-kit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "qa-kit"
}
        
Elapsed time: 1.44449s