Skip to main content

Automated Verification & Testing Suites

📌 What is this for? (Quick Summary)​

In simple words: Before pushing any code change to production or putting new software onto the pod, you must run our automated test suites. We have 23 Python tests for the pod's onboard computer and 33 Vitest tests for the web dashboard. If every test turns green (PASS), your code is safe to deploy!


1. Edge Verification Suite (Pytest: 23 Tests)​

Located in Edge Device/RPi-Package/tests/. Runs against Python 3.11+.

cd "Edge Device/RPi-Package"
python -m pytest tests/ -v -s

Module Breakdown:​

  • test_camera_fallback.py (3 tests):
    • TEST CAM-4.1: RTSP socket probe accurately distinguishes between offline camera and available stream.
    • TEST CAM-4.2: Autonomous fallback cutover spawns synthetic SMPTE pattern when physical camera drops.
    • TEST CAM-4.3: Automatic cutback restores physical RTSP forwarding when camera is plugged back in.
  • test_can_binary_framing.py (6 tests):
    • TEST CAN-1.1..1.6: Exact byte serialization and Big-Endian float unpacking for CAN IDs 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, and 0x21.
  • test_fault_scenarios.py (6 tests):
    • TEST FLT-3.1..3.6: Gate faults (Gate A, Gate B, Gate C), Global Safety Trip line, and automated systemd recovery.
  • test_pod_trajectory.py (6 tests):
    • TEST TRJ-2.1..2.6: Validates the 126-second, 600m forward and 600m return trajectory chronology, velocity profile sanity, and falling-edge auto-stop.
  • test_system_integration.py (2 tests):
    • TEST SYS-5.1..5.2: End-to-end integration between emulator socket client and go_server.

2. Frontend Operations Suite (Vitest: 33 Tests)​

Located in Client Dashboard/Dashboard/src/__tests__/. Powered by Vitest 5.0.5 and Mock Service Worker (MSW).

cd "Client Dashboard/Dashboard"
npm run test

Module Breakdown:​

  • config_schema.test.jsx (Module 1): Physical range sanity, warning thresholds lower than emergency shutoff, thermal hysteresis margin validation.
  • auth_rbac.test.jsx (Module 2): Cognito session registration, MANAGER control lockout (canControl === false), ADMIN/ENGINEER physical authorization (canControl === true), and single-device session takeover (401 SESSION_SUPERSEDED).
  • camera_stream.test.jsx (Module 3): WebRTC WHEP connection negotiation, SDP offer/answer exchange, offline stream error handling, and PIP window positioning.
  • safety_interlocks.test.jsx (Module 4): Closed-loop contactor verification (364V output voltage verified), contactor timeout fault recovery, thermal shutdown lockout.
  • controls_execution.test.jsx (Module 5): SEND_CONTROL battery toggle, launch trigger, and emergency stop countdown.
  • audio_visual_alerts.test.jsx (Module 6): Voice phrase synthesis dictionary matching, emergency alert queue preemption.
  • telemetry_pipeline.test.jsx (Module 7): Polling cadence (1 Hz), stale telemetry detection (>3s delay), InfluxDB state parsing.
  • resilience_chaos.test.jsx (Module 8): Network disconnection recovery, 500 server error exponential backoff, token refresh.