Skip to main content

Vision QA & Testing Strategy

This section outlines the testing strategy, workflows, and technologies used in the firstbreath-vision repository, which contains the AI and computer vision microservices.

πŸ›  Technology Stack​

  • Language: Python 3.11
  • Frameworks: PyTorch, OpenCV, Ultralytics YOLO
  • Architecture: Microservices
    • camera-manager: Handling RTSP streams and camera logic.
    • batch-inference: Running AI models on video frames.
    • redis-worker: Asynchronous task processing.
  • Testing Framework: pytest
  • Linting & Formatting: Black, Flake8, Safety

πŸ§ͺ Testing Strategy​

We use pytest for unit and integration testing across all services.

Test Structure​

Each service has its own tests/ directory:

  • services/camera-manager/tests/
  • services/batch-inference/tests/
  • services/redis-worker/tests/

Running Tests Locally​

To run tests for a specific service:

cd services/camera-manager
python -m pytest tests/

πŸ”„ CI/CD Workflows​

1. CI Pipeline (ci.yml)​

Triggers on push and pull_request to main and dev.

Stages:

  1. Quality Gates:

    • Formatting: Checks code style with black.
    • Linting: Runs flake8 to catch syntax errors and undefined names.
    • Security: Runs safety check on requirements.txt files to identify vulnerable dependencies.
  2. Testing:

    • Installs dependencies (using CPU-only versions of PyTorch for speed).
    • Runs pytest with coverage (--cov) for each service (camera-manager, batch-inference, redis-worker).
  3. SonarQube Analysis (integrated in CI):

    • Scans code and reports coverage and quality metrics to SonarQube.
    • Enforces Quality Gate checks.

2. Docker Build (docker-build-and-push.yml)​

  • Builds Docker images for the services.
  • Pushes images to the container registry (if configured).

β™Ώ Accessibility​

Not applicable for these backend/AI services.