Skip to main content

🛰️ SputnikQA — Test Automation Framework

PyPI version Python versions License


SputnikQA — это современный, типизированный и расширяемый фреймворк для написания автотестов на Python.

Идеально подходит для команд, которые хотят писать читаемые, надёжные и поддерживаемые автотесты.

Установка

# Основной пакет
pip install sputnikqa

# С интеграцией Allure
pip install sputnikqa[allure]

# С поддержкой httpx
pip install sputnikqa[httpx]

# С полной функциональностью (рекомендуется)
pip install sputnikqa[allure,httpx]

Основные возможности

  • restapi booster

    • Типизированные модели ответов через Pydantic
    • Автоматическая валидация статуса и тела ответа
    • Декларативные секции API (BaseApiSection) — по аналогии с Page Object
    • Билдеры запросов — для удобного формирования тел и multipart-загрузок
    • Поддержка middleware — логирование, авторизация, retry и др.
    • Встроенная интеграция с Allure:
      • шаги с @allure.step
      • прикрепление cURL, статуса и тела ответа
    • Гибкий HTTP-клиент — поддержка httpx* и кастомных реализаций
    • Поддержка async/await через AsyncApiClient

    *Для использования httpx требуется установка дополнительной зависимости: pip install sputnikqa[httpx]

Пример использования

1. Определите модель ответа

from sputnikqa.boosters.restapi.response_models import JsonResponse

class Pet(JsonResponse):
    id: int | None = None
    name: str
    status: str

2. Создайте секцию API

from sputnikqa.boosters.restapi.sections.base import BaseApiSection

class PetSection(BaseApiSection):
    base_url = "https://petstore.swagger.io/v2"

    def get_pet_by_id(self, pet_id: int):
        response = self.client.get(self.url_join(f"/pet/{pet_id}"))
        return (
            self.validator(response)
            .validate_status(200)
            .validate_response_model({200: Pet})
        )

3. Напишите тест

def test_get_pet(pet_section):
    pet = pet_section.get_pet_by_id(1).get_validated_model()
    assert pet.name == "doggie"
    assert pet.status == "available"

Архитектура

sputnikqa/
├── boosters/
│   └── restapi/
│       ├── clients/          # HTTP-клиенты (httpx* и др.)
│       ├── middleware/       # Middleware (логирование, авторизация)
│       ├── request_builders/ # Билдеры (тело, файлы)
│       ├── response_models/  # Базовые модели ответов
│       ├── sections/         # Базовый класс секций
│       └── validators/       # Валидаторы ответов
└── integrations/
    └── allure/               # Интеграция с Allure

> *Клиент httpx доступен после установки: `pip install sputnikqa[httpx]`

Интеграции

Allure

Автоматически прикрепляет к отчёту:

  • cURL-команду запроса
  • HTTP-статус
  • тело ответа
from sputnikqa.integrations.allure.client import ApiClientAllure
from sputnikqa.integrations.allure.middleware import AllureMiddleware
from sputnikqa.boosters.restapi.clients.httpx_client import HttpxClient

client = ApiClientAllure(HttpxClient(), middlewares=[AllureMiddleware()])

Требуется: pip install sputnikqa[allure,httpx]

Документация и примеры

Полный пример тестов для Petstore API доступен в репозитории:

Для разработчиков

Хотите расширить фреймворк?

  • Реализуйте свой BaseHttpClient для кастомного HTTP-стека.
  • Напишите middleware для авторизации, retry или трассировки.
  • Используйте PrimitiveResponse для обёртки примитивов (str, int, dict).

Лицензия

Distributed under the MIT License. See LICENSE for more information.


SputnikQA — ваш надёжный спутник в мире автоматизации тестирования.

📌 PyPI: https://pypi.org/project/sputnikqa/
📌 GitVerse: https://gitverse.ru/crenom/SputnikQA

Metadata

Release files for sputnikqa 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sputnikqa 0.0.9
File Size Uploaded Provenance Actions
sputnikqa-0.0.9.tar.gz 59.3 kB Without provenance Details for sputnikqa-0.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sputnikqa 0.0.9
File Interpreter ABI Platform Actions
sputnikqa-0.0.9-py3-none-any.whl Python 3 none any Details for sputnikqa-0.0.9-py3-none-any.whl

Total release size: 158.0 kB

Release files / sputnikqa-0.0.9.tar.gz

Download URL sputnikqa-0.0.9.tar.gz
Size 59.3 kB
Tags Source
SHA-256 checksum
How to use checksums
14a9e246170e28cc88edc7dea9f6e1685eef68c09b7698b1b0e438efebc88e29
BLAKE2b-256 checksum
How to use checksums
7ac3f0527a2cfa99f8b150fc91bc1697160ca7500151ec6291173a6f53e40538
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.13.15 Linux/5.15.0-144-generic

Release files / sputnikqa-0.0.9-py3-none-any.whl

Download URL sputnikqa-0.0.9-py3-none-any.whl
Size 98.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74ad1de26fe51c75e6aae4740f88114162b794bb0420e8ad0a4cfbcf455783df
BLAKE2b-256 checksum
How to use checksums
83e31189e330e7096a477410ace32377b88c57570e136e9330416d3bf684a16e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.13.15 Linux/5.15.0-144-generic

Security for sputnikqa 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page