docs: add testing documentation to README and RUNNING.md
- Add Testing section to README with: - How to run tests - Test structure overview - Key edge cases covered - Test configuration notes - Add Running Tests section to RUNNING.md - Document the 46 unit tests available
This commit is contained in:
parent
83ac67fea2
commit
85978a710f
2 changed files with 56 additions and 13 deletions
45
README.md
45
README.md
|
|
@ -155,16 +155,47 @@ To backup your data:
|
|||
cp tablets.db tablets_backup_$(date +%Y%m%d).db
|
||||
```
|
||||
|
||||
## Version Control
|
||||
## Testing
|
||||
|
||||
This project uses Git for version control with the following structure:
|
||||
The project includes a comprehensive unit test suite with **46 tests** covering core functionality and edge cases.
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Install test dependencies (if not already installed)
|
||||
source .venv/bin/activate
|
||||
uv pip install pytest pytest-cov
|
||||
|
||||
# Run all tests
|
||||
python3 -m pytest tests/ -v
|
||||
|
||||
# Run with coverage report
|
||||
python3 -m pytest tests/ --cov=./ --cov-report=term-missing
|
||||
```
|
||||
|
||||
### Test Structure
|
||||
|
||||
| File | Tests | Coverage |
|
||||
|------|-------|----------|
|
||||
| `tests/test_core.py` | 21 | Core operations (tablet, user, loan CRUD) |
|
||||
| `tests/test_edge_cases.py` | 14 | Edge cases (duplicates, invalid IDs, etc.) |
|
||||
| `tests/test_minimal_app.py` | 11 | Application function tests |
|
||||
|
||||
### Key Edge Cases Covered
|
||||
|
||||
- Loan a device that's already loaned (prevents double-loaning)
|
||||
- Return a non-existent loan (handles gracefully)
|
||||
- Duplicate serial numbers (rejected at database level)
|
||||
- Duplicate user identifications (rejected at database level)
|
||||
- Invalid tablet/user IDs (validated before operations)
|
||||
- Multiple loans per user (one-to-many relationship)
|
||||
- Loan-return-loan sequence (device lifecycle)
|
||||
|
||||
### Test Configuration
|
||||
|
||||
Tests use isolated temporary databases and automatically clean up after each test run. No impact on production data.
|
||||
|
||||
- `master` - Production-ready releases
|
||||
- `develop` - Integration branch for features
|
||||
- `feature/*` - Individual feature branches
|
||||
- `hotfix/*` - Urgent bug fixes
|
||||
|
||||
See `CONTRIBUTING.md` for detailed workflow and commit conventions.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue