ROS 2 Testing Beyond Flaky CI: Replay Tests, rtest Mocks and Model Checking

A concept guide to ROS 2 testing layers: bag-based replay tests, build-time rclcpp mocks for deterministic unit tests, and statistical model checking, with limits and when to use each.

In this article

  • Rebuilding the pyramid
  • Layer 1: replay tests for node-level behavior
  • Layer 2: unit tests without middleware: rtest
  • Layer 3: model checking behavior trees
  • Which tool for which question
  • Our take: where this fits
  • A practical order of adoption
  • Further reading