This is a comprehensive API testing framework designed to systematically identify and report defects in web service interfaces using Python, Playwright, and advanced testing methodologies.
- Language: Python 3.10+
- Virtual Environment:
uv
- Testing Framework:
- Pytest
- Playwright
- Validation:
- Pydantic
- Linting: Ruff
- Pre-commit Hooks:
pre-commit
- Reporting: Allure
- Parallel Execution: pytest-xdist
- Python 3.10+
uv
pip
git clone https://github.com/ZhikharevAl/qa-hackathon-raptors.git
cd qa-hackathon-raptors
uv venv # Creates a new virtual environment
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
uv pip install -r requirements.txt
uv pip install pre-commit
pre-commit install
Create a .env
file with necessary credentials:
API_TOKEN=your_api_token_here
ruff check . # Check for linting issues
ruff format . # Format code
Automatically run before each commit:
- Linting
- Formatting
- Type checking
- Other configured checks
- Strict type validation
- Data parsing
- Schema generation
- Runtime type checking
from pydantic import BaseModel, Field
class UserResponse(BaseModel):
uuid: str = Field(..., description="UUID of the user")
email: str = Field(..., description="Email address of the user")
name: str = Field(..., description="Name of the user")
nickname: str = Field(..., description="Nickname of the user")
pytest
pytest -n auto # Automatically detect available CPU cores
pytest tests/test_users.py
pytest --alluredir=allure-results
allure serve allure-results
project-root/
β
βββ tests/ # Test suites
β βββ test_users.py
β βββ ...
β
βββ services/ # API service classes
β βββ users/
β β βββ models/ # Pydantic models
β βββ ...
β
βββ config/ # Configuration files
βββ utils/ # Utility modules
βββ requirements.txt # Dependency list
βββ .pre-commit-config.yaml # Pre-commit configuration
pytest --cov=tests/
Name | Stmts | Miss | Cover |
---|---|---|---|
tests_init_.py | 0 | 0 | 100% |
tests\test_games.py | 45 | 6 | 87% |
tests\test_users.py | 80 | 26 | 68% |
tests\test_wishlist.py | 28 | 3 | 89% |
------------------------- | ------- | ------ | ------- |
TOTAL | 153 | 35 | 77% |
- Use
uv
for dependency management - Utilize Ruff for consistent code quality
- Leverage pre-commit hooks
- Use Pydantic for robust data validation
- Create comprehensive Pydantic models
- Use fixtures for test setup/teardown
- Parameterize tests
- Validate response schemas
- coverage report
- Refactor tests to use fixtures
- π― Target: 90%+ test coverage
- Dynamic test data generation