A powerful testing framework based on pytest, specifically designed for QA engineers
Project description
QaPyTest
QaPyTest — a powerful testing framework based on pytest, specifically
designed for QA engineers. Turn your ordinary tests into detailed, structured
reports with built-in HTTP, SQL, Redis and GraphQL clients.
🎯 QA made for QA — every feature is designed for real testing and debugging needs.
⚡ Why QaPyTest?
- 🚀 Ready to use: Install → run → get a beautiful report
- 🔧 Built-in clients: HTTP, SQL, Redis, GraphQL — all in one package
- 📊 Professional reports: HTML reports with attachments and logs
- 🎯 Soft assertions: Collect multiple failures in one run instead of stopping at the first
- 📝 Structured steps: Make your tests self-documenting
- 🔍 Debugging friendly: Full traceability of every action in the test
⚙️ Key features
- HTML report generation: simple report at
report.html. - Soft assertions: allow collecting multiple failures in a single run without immediately ending the test.
- Advanced steps: structured logging of test steps for better report readability.
- Attachments: ability to add files, logs and screenshots to test reports.
- HTTP client: client for performing HTTP requests.
- SQL client: client for executing raw SQL queries.
- Redis client: client for working with Redis.
- GraphQL client: client for executing GraphQL requests.
- Browser automation: seamless integration with pytest-playwright for end-to-end web testing.
- Test data generation: built-in Faker support for creating realistic test data.
- JSON Schema validation: function to validate API responses or test artifacts with support for soft-assert and strict mode.
- Unicode support: proper display of Unicode characters (Cyrillic, Arabic, Chinese, etc.) in terminal and HTML reports.
👥 Ideal for
- QA Engineers — automate testing of APIs, databases, web services and browser interfaces
- Test Automation specialists — get a ready toolkit for comprehensive testing including web automation
🚀 Quick start
1️⃣ Installation
pip install qapytest
2️⃣ Your first powerful test
from qapytest import step, attach, soft_assert, HttpClient, SqlClient, Faker
def test_comprehensive_api_validation():
fake = Faker()
# Generate realistic test data
user_data = {"name": fake.name(), "email": fake.email()}
# Structured steps for readability
with step('🌐 Testing API endpoint'):
client = HttpClient(base_url="https://api.example.com")
response = client.post("/users", json=user_data)
assert response.status_code == 201
# Add artifacts for debugging
attach(response.text, 'api_response.json')
# Soft assertions - collect all failures
soft_assert(response.json()['id'] > 0, 'User ID check')
soft_assert(
response.json()['email'] == user_data['email'],
'Email matches'
)
# Database integration
with step('🗄️ Validate data in DB'):
db = SqlClient("sqlite:///:memory:")
user_db_data = db.fetch_data(
"SELECT * FROM users WHERE email = :email",
params={"email": user_data['email']}
)
assert len(user_db_data) == 1
3️⃣ Run with beautiful reports
pytest --report-html
# Open report.html 🎨
🔌 Built-in clients — everything QA needs
🌐 HttpClient — HTTP testing on steroids
client = HttpClient(base_url="https://api.example.com")
response = client.post("/auth/login", json={"foo": "bar"})
📊 GraphQL client — Modern APIs with minimal effort
gql = GraphQLClient("https://api.github.com/graphql")
result = gql.execute("query { viewer { foo } }")
🗄️ SqlClient — Direct DB access
db = SqlClient("sqlite:///:memory:")
users = db.fetch_data("SELECT foo FROM bar")
🔴 RedisClient — Enhanced Redis operations with logging
redis_client = RedisClient(host="localhost")
redis_client.set("foo", "bar")
foo = redis_client.get("foo")
🎭 Browser automation — powered by Playwright
def test_web_app(page):
fake = Faker()
# Navigate to login page
page.goto("https://example.com/login")
# Generate and fill test data
page.get_by_label("Username").fill(fake.user_name())
page.get_by_label("Password").fill(fake.password())
page.get_by_role("button", name="Log in").click()
🎛️ Core testing tools
📝 Structured steps
with step('🔍 Check authorization'):
with step('Send login request'):
response = client.post("/login", json=creds)
with step('Validate token'):
assert "token" in response.json()
🎯 Soft Assertions — collect all failures
soft_assert(user.id == 1, "Check user ID")
soft_assert(user.active, 'Check status')
# The test will continue and show all failures together!
📎 Attachments — full context
attach(response.json(), 'server response')
attach(screenshot_bytes, 'error page')
attach(content, 'application', mime='text/plain')
✅ JSON Schema validation
# Strict validation — stop the test on schema validation error
validate_json(api_response, schema_path="user_schema.json", strict=True)
# Soft mode — collect all schema errors and continue test execution
validate_json(api_response, schema=user_schema)
🎲 Faker — Realistic test data generation
fake = Faker()
fake.text(max_nb_chars=200) # Random text
fake.random_int(min=1, max=100) # Random numbers
More about the API on the documentation page.
Test markers
QaPyTest also supports custom pytest markers to improve reporting:
@pytest.mark.title("Custom Test Name"): sets a custom test name in the HTML report@pytest.mark.component("API", "Database"): adds component tags to the test
Example usage of markers
import pytest
@pytest.mark.title("User authorization check")
@pytest.mark.component("Auth", "API")
def test_user_login():
pass
⚙️ CLI options
--env-file: path to an.envfile with environment settings (default —./.env).--env-override: if set, values from the.envfile will override existing environment variables.--report-html [PATH]: create a self-contained HTML report; optionally specify a path (default —report.html).--report-title NAME: set the HTML report title.--report-theme {light,dark,auto}: choose the report theme:light,darkorauto(default).--disable-unicode: disable Unicode character display in terminal output for compatibility with older terminals or CI systems.
More about CLI options on the documentation page.
📑 License
This project is distributed under the license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qapytest-0.3.6.tar.gz.
File metadata
- Download URL: qapytest-0.3.6.tar.gz
- Upload date:
- Size: 130.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30959b119814824d288a7731a0032a179dc8e6b5a57afcbb07b530cce9ddb016
|
|
| MD5 |
6f072a4ca18cb68e09ecbee19a9accdb
|
|
| BLAKE2b-256 |
e9597776f73d4ccf64ef9fe0d4f15bcd0f94aac231c107ca694327d008377153
|
File details
Details for the file qapytest-0.3.6-py3-none-any.whl.
File metadata
- Download URL: qapytest-0.3.6-py3-none-any.whl
- Upload date:
- Size: 51.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5234ee62d1c7d32da1b071b2e4e0487cd8a222a34ddeffb9416b2db2d59ed864
|
|
| MD5 |
89c3a7792e455c848a1349e54399a203
|
|
| BLAKE2b-256 |
a035e2dd4b8068c6c4620c30f8c20f4157ed6288dc1be26dd6c1a7b5d5c3d103
|