Skip to main content
🤖AI-generated documentation curatedAI Generated
This page was drafted by an AI assistant and may contain inaccuracies.
About content generation types
🤖
AI GeneratedPage drafted entirely by AI from codebase or prompt instructions.
(e.g., docs generated from codebase analysis)
← this page
✋→🤖
AI TransformattedHuman provided raw material; AI restructured it into a different format.
(e.g., livestream → blog post, meeting notes → docs)
Human GeneratedPage written entirely by a human author.
(e.g., hand-written tutorial)
More info about content generation types ↗

Testing

FreeMoCap uses a multi-layered testing strategy spanning the Python backend, React frontend, and end-to-end integration.

Test Layers

LayerToolScopeWhen to run
Backend unitpytestIndividual functions, models, utilitiesEvery commit
Backend integrationpytest + httpxREST endpoints, WebSocket, pipeline startupBefore PR
Frontend unitVitest (via Vite)Components, hooks, Redux slicesEvery commit
E2EPlaywrightFull app (Electron + backend)Before release
Multi-PythonnoxTests against Python 3.11, 3.12, 3.13Before release

Running Tests

Backend (Python)

# Run all backend tests
uv run poe test

# Run specific test categories
uv run poe test-schema # Pydantic schema validation
uv run poe test-settings # Configuration tests
uv run poe test-http # REST endpoint tests
uv run poe test-ws # WebSocket tests
uv run poe test-sync # Synchronization tests
uv run poe test-calibration # Calibration pipeline tests
uv run poe test-e2e # End-to-end pipeline tests

# Run with nox (tests across Python versions)
nox -s test_all

Frontend (TypeScript)

cd freemocap-ui

# Run frontend tests
npm test

# Run E2E tests (requires Playwright)
npm run e2e

# E2E setup (first time)
npm run pree2e

Linting & Type Checking

# Backend linting (ruff)
uv run poe lint

# Backend type checking (pyright)
uv run poe tc-check

# Auto-fix type-only imports
uv run poe tc-fix

Test File Conventions

Backend

Tests live in freemocap/tests/ mirroring the source structure:

freemocap/tests/
├── test_binary_keypoints_protocol.py
├── test_e2e_pipeline.py
├── calibration/
│ └── test_*.py
└── triangulation/
└── test_*.py

Frontend

Tests co-locate with source files:

freemocap-ui/src/
├── components/
│ └── playback/
│ └── SyncedVideoPlayer.test.tsx
└── store/
└── slices/
└── cameras/
└── cameras-slice.test.ts

E2E Testing

E2E tests use Playwright to drive the full Electron application against a running Python backend. They cover:

  • Camera detection and connection
  • Recording start/stop lifecycle
  • Calibration workflow
  • Mocap processing pipeline
  • Blender export