Testing Strategy
Testing¶
The project includes a comprehensive test suite to ensure code quality and reliability.
Running Tests¶
Quick Test (Recommended):
python run_tests.py
Run with Coverage:
python run_tests.py --coverage
Run Only Unit Tests:
python run_tests.py --unit
Run Only Integration Tests:
python run_tests.py --integration
Run Tests in Parallel:
python run_tests.py --parallel
Manual Testing¶
For manual testing, you can use the provided test script:
./test_branch.sh
Test Structure¶
- Unit Tests: Mock external dependencies for fast execution
- Integration Tests: Test the full application flow
- Error Handling: Comprehensive error scenario testing
- Performance: Response time and resource usage testing
GitHub Actions & CI/CD¶
This project includes comprehensive GitHub Actions workflows for continuous integration and deployment with push protection.
Available Workflows¶
- Python CI with UV (
.github/workflows/python-tests.yml
) - Runs tests on Python 3.12
- Includes security scanning and linting
- Generates coverage reports
-
Uses UV for fast dependency management
-
Branch Protection Enforcement (
.github/workflows/branch-protection.yml
) - Monitors direct pushes to protected branches
- Validates pull request requirements
- Provides push protection
Setting Up GitHub Actions¶
The workflows are automatically triggered on: - Push to main
, development
, and feature/*
branches - Pull requests targeting main
or development
- Weekly schedule (Sunday at midnight UTC)
Branch Protection Setup¶
To enable full push protection, configure branch protection rules in your repository settings:
- Go to Settings → Branches
- Add branch protection rule for
main
branch - Enable the following:
- ✅ Require pull request reviews before merging
- ✅ Require approvals (1)
- ✅ Require status checks to pass:
Test Python 3.12 on ubuntu-latest
Security Scan
Lint and Code Quality
- ✅ Require branches to be up to date before merging
- ✅ Require linear history
- ✅ Include administrators
See Branch Protection Guide for detailed configuration instructions.