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.
53 lines
1.9 KiB
Markdown
53 lines
1.9 KiB
Markdown
## 1. Restructure backend tests
|
|
|
|
- [x] 1.1 Create `apps/api/tests/unit/` directory and move pure logic tests
|
|
- [x] 1.2 Create `apps/api/tests/integration/` directory and move API tests
|
|
- [x] 1.3 Create `apps/api/tests/system/` directory for full stack tests
|
|
- [x] 1.4 Update `pytest.ini` or `pyproject.toml` with test markers
|
|
|
|
## 2. Create shared fixtures
|
|
|
|
- [x] 2.1 Create `apps/api/tests/conftest.py` with shared fixtures
|
|
- [x] 2.2 Implement SQLite in-memory engine fixture for unit tests
|
|
- [x] 2.3 Implement PostgreSQL session fixture with transaction rollback
|
|
- [x] 2.4 Implement authenticated TestClient fixture
|
|
- [ ] 2.5 Remove duplicate fixture code from existing test files
|
|
|
|
## 3. Add SQLite support for unit tests
|
|
|
|
- [x] 3.1 Add `aiosqlite` dependency to `pyproject.toml`
|
|
- [ ] 3.2 Update SQLAlchemy configuration to support SQLite
|
|
- [ ] 3.3 Verify unit tests run without PostgreSQL
|
|
|
|
## 4. Update dependencies and configuration
|
|
|
|
- [x] 4.1 Add missing test dependencies (`python-jose[cryptography]`)
|
|
- [x] 4.2 Configure `pytest-asyncio` with `asyncio_mode=auto`
|
|
- [x] 4.3 Add `addopts = -m "not system"` to default test run
|
|
|
|
## 5. Create E2E test setup
|
|
|
|
- [x] 5.1 Initialize Playwright in `e2e/` directory
|
|
- [x] 5.2 Add Playwright configuration (`playwright.config.ts`)
|
|
- [x] 5.3 Create first E2E test (login flow)
|
|
- [x] 5.4 Add `make test-e2e` target to Makefile
|
|
|
|
## 6. Update Makefile
|
|
|
|
- [x] 6.1 Add `test-unit` target
|
|
- [x] 6.2 Add `test-integration` target
|
|
- [x] 6.3 Add `test-system` target
|
|
- [x] 6.4 Update `test` target to run all categories
|
|
|
|
## 7. Migrate existing tests as examples
|
|
|
|
- [x] 7.1 Migrate `test_config.py` to `tests/unit/`
|
|
- [x] 7.2 Migrate `test_auth_api.py` to `tests/integration/`
|
|
- [ ] 7.3 Verify migrated tests still pass
|
|
|
|
## 8. Documentation
|
|
|
|
- [ ] 8.1 Update README with testing strategy
|
|
- [ ] 8.2 Document how to run specific test categories
|
|
- [ ] 8.3 Document fixture usage patterns
|