Skip to content

Testing

FireBreak follows a comprehensive testing strategy with Test-Driven Development (TDD) at its core.

Testing Philosophy

  1. Write Tests First: Tests define specifications before implementation
  2. 100% Coverage Goal: Aim for complete code coverage
  3. Fast Feedback: Tests run in seconds, not minutes
  4. Reliable: Tests are deterministic and repeatable
  5. 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

  • 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

  1. Read TDD Workflow to understand the development process
  2. Explore QA Harness to learn the test runner
  3. Review Test Data for fixtures and mocks
  4. Check specific test type guides for detailed examples

Additional Resources