Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhikhareval/qa-hackathon-raptors
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.
https://github.com/zhikhareval/qa-hackathon-raptors
allure api playwright pytest python
Last synced: 2 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/zhikhareval/qa-hackathon-raptors
- Owner: ZhikharevAl
- License: mit
- Created: 2024-11-29T18:40:28.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-02T23:42:23.000Z (2 months ago)
- Last Synced: 2024-12-09T13:40:18.974Z (about 2 months ago)
- Topics: allure, api, playwright, pytest, python
- Language: Python
- Homepage: https://zhikhareval.github.io/qa-hackathon-raptors/
- Size: 1.41 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Ruff Linter](https://github.com/ZhikharevAl/qa-hackathon-raptors/actions/workflows/ruff_check.yml/badge.svg)](https://github.com/ZhikharevAl/qa-hackathon-raptors/actions/workflows/ruff_check.yml)
# API Defect Hunt ๐ต๏ธโโ๏ธ๐
## Project Overview
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.
## Tech Stack ๐ ๏ธ
- **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## Prerequisites ๐
- Python 3.10+
- `uv`
- `pip`## Setup & Installation ๐
### 1. Clone the Repository
```bash
git clone https://github.com/ZhikharevAl/qa-hackathon-raptors.git
cd qa-hackathon-raptors
```### 2. Create Virtual Environment with uv
```bash
uv venv # Creates a new virtual environment
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
```### 3. Install Dependencies
```bash
uv pip install -r requirements.txt
uv pip install pre-commit
pre-commit install
```### 4. Configure Environment Variables
Create a `.env` file with necessary credentials:
```
API_TOKEN=your_api_token_here
```## Development Tools ๐ ๏ธ
### Linting with Ruff
```bash
ruff check . # Check for linting issues
ruff format . # Format code
```### Pre-commit Hooks
Automatically run before each commit:
- Linting
- Formatting
- Type checking
- Other configured checks## Pydantic Validation ๐
### Key Features
- Strict type validation
- Data parsing
- Schema generation
- Runtime type checking### Example Model
```python
from pydantic import BaseModel, Fieldclass 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")
```## Running Tests ๐งช
### All Tests
```bash
pytest
```### Parallel Execution
```bash
pytest -n auto # Automatically detect available CPU cores
```### Specific Test Suite
```bash
pytest tests/test_users.py
```## Generating Allure Reports ๐
### 1. Run Tests with Allure Tracking
```bash
pytest --alluredir=allure-results
```### 2. Generate HTML Report
```bash
allure serve allure-results
```## Project Structure
```
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
```## Coverage Report ๐
```python
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% |## Best Practices ๐
- 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## ๐ TODO
- [ ] Refactor tests to use fixtures
- [ ] ๐ฏ Target: 90%+ test coverage
- [ ] Dynamic test data generation## License
[MIT](LICENSE.md)