Skip to main content

Extensible test automation framework — built for QA engineers who value clean architecture and scalability.

Project description

🛰️ 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sputnikqa-0.0.4b2.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sputnikqa-0.0.4b2-py3-none-any.whl (55.3 kB view details)

Uploaded Python 3

File details

Details for the file sputnikqa-0.0.4b2.tar.gz.

File metadata

  • Download URL: sputnikqa-0.0.4b2.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.9 Windows/10

File hashes

Hashes for sputnikqa-0.0.4b2.tar.gz
Algorithm Hash digest
SHA256 f93f7c6cffa4520656db080a85a5490a8db1db110b6806954678d222c5ea5d0a
MD5 a7834d0ec21aa5afc5b802c22804a244
BLAKE2b-256 d3a44a140aa8853f055136485cb5b23c79f0768f95bcab77f1f7a9754bca14cb

See more details on using hashes here.

File details

Details for the file sputnikqa-0.0.4b2-py3-none-any.whl.

File metadata

  • Download URL: sputnikqa-0.0.4b2-py3-none-any.whl
  • Upload date:
  • Size: 55.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.9 Windows/10

File hashes

Hashes for sputnikqa-0.0.4b2-py3-none-any.whl
Algorithm Hash digest
SHA256 44b9d294e42fe6e79191daecb14c381646ee179a2b2e9a225212344bfa12c4a1
MD5 827e649b14e83816eb3b6ab17d0e0ee4
BLAKE2b-256 0536d66ff6b239f1b49cb4739e96d5f43b79778aee9f9ffcbb77135aa2b4d70a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page