Testing¶
FireBreak follows a comprehensive testing strategy with Test-Driven Development (TDD) at its core.
Testing Philosophy¶
- Write Tests First: Tests define specifications before implementation
- 100% Coverage Goal: Aim for complete code coverage
- Fast Feedback: Tests run in seconds, not minutes
- Reliable: Tests are deterministic and repeatable
- Maintainable: Tests are easy to understand and update
Test Types¶
-
Unit Tests
Test individual functions and classes in isolation
See: Unit Tests
-
Integration Tests
Test module interactions and API contracts
See: Integration Tests
-
E2E Tests
Test complete user workflows end-to-end
See: E2E Tests
-
Load Tests
Test performance under load
See: Load Testing
Quick Start¶
Run All Tests¶
# Backend tests
cd backend
pytest tests/ -v
# Frontend tests
cd frontend/core
npm test
# E2E tests
cd qa
npx playwright test
# Full QA harness
python harness/runner.py --env local --suite full
Run Specific Test Types¶
# Unit tests only
pytest tests/unit/ -v
# Integration tests only
pytest tests/integration/ -v
# Smoke tests (fast)
pytest -m smoke -v
# Slow tests (skip for quick iterations)
pytest -m "not slow" -v
Test Coverage¶
Current coverage status:
| Component | Coverage | Target | Status |
|---|---|---|---|
| Backend Unit | 95% | 100% | 🟡 |
| Backend Integration | 90% | 95% | 🟡 |
| Frontend Components | 85% | 95% | 🟡 |
| E2E Critical Paths | 100% | 100% | ✅ |
| API Endpoints | 100% | 100% | ✅ |
Generate coverage reports:
# Backend coverage
cd backend
pytest --cov=src --cov-report=html tests/
open htmlcov/index.html
# Frontend coverage
cd frontend/core
npm test -- --coverage
open coverage/index.html
Testing Resources¶
Documentation¶
- QA Harness - Unified test runner and framework
- TDD Workflow - Test-Driven Development guide
- Test Data - Test fixtures and mock data
Quick Links¶
- TESTING.md - Complete testing guide (root level)
- Backend Tests:
/backend/tests/ - Frontend Tests:
/frontend/core/tests/ - QA Tests:
/qa/
Test Organization¶
tests/
├── unit/ # Unit tests
│ ├── test_handlers.py
│ ├── test_services.py
│ └── test_utils.py
├── integration/ # Integration tests
│ ├── test_api.py
│ ├── test_database.py
│ └── test_storage.py
├── e2e/ # End-to-end tests
│ ├── test_upload_flow.py
│ ├── test_analysis_flow.py
│ └── test_report_generation.py
├── performance/ # Load/performance tests
│ └── test_api_load.py
├── fixtures/ # Test data
│ ├── images/
│ ├── videos/
│ └── mock_data.json
└── conftest.py # Shared fixtures
CI/CD Integration¶
Tests run automatically on:
- Pull Requests: Smoke suite (5 min)
- Push to develop: Regression suite (30 min)
- Push to main: Full suite (60 min)
- Nightly: Full suite + load tests (90 min)
See CI/CD Setup for details.
Next Steps¶
- Read TDD Workflow to understand the development process
- Explore QA Harness to learn the test runner
- Review Test Data for fixtures and mocks
- Check specific test type guides for detailed examples