Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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, 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")
```

## 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)