ros2_medkit_integration_tests
This section contains design documentation for the ros2_medkit_integration_tests package.
Overview
The integration tests package validates the ros2_medkit system end-to-end by launching real ROS 2 nodes and exercising the gateway’s HTTP API. Tests are split into two categories:
Feature tests validate individual API capabilities in isolation
Scenario tests exercise multi-step workflows that cross multiple features
A shared Python library (ros2_medkit_test_utils) provides a base test case,
launch description factories, and assertion helpers.
Architecture
The following diagram shows the test infrastructure and how it relates to the system under test.
Integration Test Architecture
Test Categories
Feature Tests
Feature tests (test/features/) validate individual API capabilities. Each test file
focuses on one area of functionality and launches only the nodes it needs.
Test File |
Description |
|---|---|
|
GET /data endpoints for topic sampling |
|
PUT /data endpoints for publishing to topics |
|
Service and action operation discovery |
|
Fault listing, filtering, and deletion |
|
Entity collection endpoints (areas, components, apps) |
|
Nested entity routing (areas/components/apps) |
|
HATEOAS links and capabilities |
|
ROS 2 parameter read/write via REST |
|
Server-Sent Events fault stream |
|
Health check endpoint |
|
CORS header handling |
|
JWT authentication and RBAC |
|
HTTPS/TLS endpoint |
|
Bulk data upload/download |
|
Rosbag snapshot capture |
|
Heuristic app naming from node graph |
Scenario Tests
Scenario tests (test/scenarios/) exercise end-to-end workflows. Tests within a
scenario are numbered (test_01_, test_02_, …) and execute in order.
Test File |
Description |
|---|---|
|
Create, poll, cancel, list action executions |
|
Fault appearance, bulk delete, single delete |
|
Fault details, snapshots, rosbag download |
|
Hybrid discovery mode with manifest + runtime |
|
Manifest-only discovery mode validation |
|
Parameter read/write/restore workflow |
|
Publish data and verify topic updates |
|
Cyclic subscription CRUD and SSE delivery |
|
Upload file, list, download, delete |
|
Rosbag snapshot download workflow |
Demo Nodes
Nine automotive-themed C++ demo nodes simulate a vehicle system. They are launched
by the test infrastructure and also available for manual testing via
ros2 launch ros2_medkit_integration_tests demo_nodes.launch.py.
Nodes use standard ROS 2 patterns: publishers with wall timers, service servers, and action servers. All timer-based nodes cancel their timers in the destructor to ensure clean shutdown.
Design Decisions
Test Split: Features vs Scenarios
Tests are split into features (isolated, parallel-safe) and scenarios (ordered, workflow-driven) to enable faster CI runs for focused feature validation while still exercising realistic end-to-end workflows.
Self-Contained Scenario Steps
Each scenario test step creates its own resources (goals, faults, subscriptions) rather than sharing state between tests. This eliminates race conditions like the concurrent-goal issue in the original monolithic test file (GitHub #222).