47 lines
1.5 KiB
Markdown
47 lines
1.5 KiB
Markdown
# Стандарты тестирования
|
|
|
|
## Пирамида
|
|
|
|
```
|
|
/\ E2E (10%): сквозные сценарии
|
|
/ \
|
|
/──────\ Integration (20%): API, БД, внешние сервисы
|
|
/ \
|
|
/──────────\ Unit (70%): изолированные модули
|
|
/ \
|
|
```
|
|
|
|
## Существующее покрытие
|
|
|
|
- **125 тестов**: 111 agent tests + 14 API/schema tests
|
|
- **Фреймворк**: pytest + pytest-asyncio
|
|
- **БД**: тесты используют моки, без реальной БД
|
|
|
|
## Цели по новым тестам
|
|
|
|
| Слой | Модуль | Приоритет | Сейчас |
|
|
|------|--------|-----------|--------|
|
|
| Services | `auth_service.py` | High | 0 |
|
|
| Services | `idea_service.py` | High | 0 |
|
|
| Services | `user_service.py` | High | 0 |
|
|
| Services | `agent_service.py` | High | 0 |
|
|
| Services | `analysis_service.py` | High | 0 |
|
|
| Integrations | `yandex_gpt.py` | Medium | 0 |
|
|
| Integrations | `gigachat.py` | Medium | 0 |
|
|
| Integrations | `fallback.py` | Medium | 0 |
|
|
| Core | `security.py`, `exceptions.py` | Medium | 0 |
|
|
|
|
## 9 сценариев для каждого API endpoint
|
|
|
|
1. Missing field → 422
|
|
2. Wrong type → 422
|
|
3. Invalid/expired token → 401
|
|
4. Wrong permissions → 403
|
|
5. Not found → 404
|
|
6. Conflict → 409
|
|
7. Success → 200/201
|
|
8. Rate limit → 429 (когда реализован)
|
|
9. Idempotency
|
|
|
|
**Цель:** 4 группы endpoints × 9 сценариев = 36 integration-тестов
|