Skip to main content

Launch testing

launch_testing is the ROS2 standard for system tests — tests that bring up real nodes, real topics, real lifecycle transitions, and assert on the outside-the-box behaviour. The Roboticks SDK ships three thin helpers to make the boilerplate tolerable.
Use pytest with rclpy helpers for unit and integration tests. Use launch_testing when the thing under test is a graph of nodes and you need to assert across their boundaries.

The three helpers

Imports:
Full signatures in the SDK module map.

Integration vs system tests

The cost is real: system tests start at ~3 s overhead per test. Reserve them for behaviour that only manifests across process boundaries — IPC failure, lifecycle ordering, parameter propagation under a real launch file.

A complete example: navigation stack handshake

This test brings up the planner and controller, sends a goal, and asserts the controller publishes /cmd_vel within 5 seconds.

Why the helpers exist

Vanilla launch_testing makes you assemble four things every test:
  1. A LaunchDescription of Node actions.
  2. A ReadyToTest() sentinel.
  3. A pytest_marker hook.
  4. A return (description, context_dict) tuple.
generate_test_description() collapses that into one call. make_node_action() collapses the per-node arg-soup. spin_node() saves you re-typing the rclpy executor dance in post_shutdown.

post_shutdown assertions

For checks that need the nodes gone (clean shutdown, log content, no orphaned processes), use launch_testing.post_shutdown_test():

Routing to a runner

A launch_testing test ID is <file>::generate_test_description::<TestClass>::<test_method>. The Roboticks scheduler treats it like any other pytest test for routing — @requires_sim on the class (or the function) tells the job router to land on a sim runner. See Sim runners.

Next

Fault injection

Inject faults into the running system from inside a launch test.

MCAP capture

Record the launched graph for replay during failure triage.

Sim runners

Pick Gazebo Harmonic or Webots; control hosted vs self-hosted GPU pools.

Pytest tests

For the simpler in-process case.