3ccd94f661
Test Organization: - Create tests/unit/, tests/integration/, tests/system/ directories - Move existing tests into appropriate categories - Add pytest markers (@pytest.mark.unit, @pytest.mark.integration) Shared Fixtures: - Create conftest.py with SQLite engine (for unit tests) - Add PostgreSQL session fixture with transaction rollback - Add TestClient fixture for API tests Configuration: - Update pyproject.toml with asyncio_mode=auto - Add test markers and default addopts - Add aiosqlite dependency for SQLite support E2E Testing: - Initialize Playwright in e2e/ directory - Add playwright.config.ts - Create login flow E2E test Build: - Add test-unit, test-integration, test-system, test-e2e to Makefile - Update test target to run all categories - Add testing documentation to README Note: Some tests have import issues due to missing python-jose package in dev environment. This needs to be addressed separately.
1.2 KiB
1.2 KiB
ADDED Requirements
Requirement: Test Directory Structure
The system SHALL organize tests into unit, integration, and system directories.
Scenario: Directory layout
- GIVEN the backend test suite
- THEN
apps/api/tests/SHALL contain:unit/- Pure logic tests with no external dependenciesintegration/- API endpoint tests with databasesystem/- Full stack tests with external services
Scenario: Running selective tests
- GIVEN the test suite is organized
- WHEN running
pytest -m unit - THEN only unit tests SHALL execute
- AND WHEN running
pytest -m integration - THEN only integration tests SHALL execute
Requirement: Test Markers
The system SHALL provide pytest markers for each test category.
Scenario: Marker registration
- GIVEN pytest configuration
- THEN
pyproject.tomlSHALL register markers:unit- Fast tests with no external dependenciesintegration- Tests with database and external servicessystem- End-to-end tests of the full stack
Scenario: Marker usage
- GIVEN a test file
- THEN unit tests SHALL be marked with
@pytest.mark.unit - AND integration tests SHALL be marked with
@pytest.mark.integration - AND system tests SHALL be marked with
@pytest.mark.system