camera

Testing and Coverage

build Coverage license Current Version

This project has unit tests for the hub backend, firmware, and (in the future) UI.

✈️ Table of Pages

Below is a quick reference table of the main documentation pages.

Page Description
What Sets it Apart Why you should just do it yourself and the cost
MVP High level project goals and summary
Status Tracker Feature progress table
Unit Testing Test and coverage instructions
Build It Yourself Clone & Docker setup guide
Firmware Firmware API reference
Hub Guide Hub API reference
Communication Methods Communication and architecture

What the tests cover

Hub

Firmware

UI

Running the tests

# hub
cd pi
pip install -r requirements.txt
pytest --cov=pi --cov-report=term-missing --cov-report=html

# firmware
cd ../esp/esp32-cammycam
bash ../../tools/pio_coverage.sh

# ui
cd ../../ui
npm ci
npm run test
npm run test:coverage

The goal is to maintain at least 69.42% overall coverage across the project.

Viewing Coverage Reports

After running the commands above each component will generate an HTML report:

Keep the overall score above 69.42% to match the badge in the project README.

Test Workflow Diagram

requirementDiagram
    requirement Hub {
        id: HUB_TESTS
        text: pytest with coverage
        risk: medium
        verify: test
    }

    requirement Firmware {
        id: FW_TESTS
        text: PlatformIO unit tests
        risk: medium
        verify: test
    }

    requirement UI {
        id: UI_TESTS
        text: Vitest suite
        risk: low
        verify: test
    }

    testSuite overall {
        requirement Hub
        requirement Firmware
        requirement UI
    }