Documentation Index
Fetch the complete documentation index at: https://docs.roboticks.io/llms.txt
Use this file to discover all available pages before exploring further.
Writing tests in C++
For C++ packages, Roboticks shipsroboticks_cpp: a header-only ament_cmake INTERFACE library that adds a single macro on top of gtest, plus a thread-safe registry that records which requirements each test confirms.
v0.1 is registry-only. The C++ side records confirms IDs; a small downstream stitcher merges them into the JUnit XML that gtest emits. Phase 11 will add a native JUnit reporter so the macro writes properties directly. The wire shape on the platform side is identical either way.
Install the package
In yourpackage.xml:
CMakeLists.txt:
roboticks_cpp::roboticks_cpp is an INTERFACE target — no objects to compile, just headers and one inline registry definition.
The ROBOTICKS_CONFIRMS macro
The macro takes a SuiteName_TestName token and a comma-separated list of requirement IDs. Place it at the top of the test body so the registration happens before any assertion fires:
SuiteName_TestName so the stitcher can join macro entries to gtest’s JUnit <testcase name="..." classname="..."> rows.
The ConfirmsRegistry
ROBOTICKS_CONFIRMS calls ConfirmsRegistry::instance().add(token, req_ids). The registry:
- Lives in a single translation unit (defined in the
INTERFACElibrary’s one.cppcompanion). - Is thread-safe — guarded by a
std::mutexso parallel test executors don’t race. - Exposes
add(token, ids),dump(path)to write JSON, andclear()for in-process re-use.
main dumps the registry on exit:
ament_cmake_gtest provides this main for you when you don’t override it; the registry hook lives in the bundled roboticks_cpp_gtest_main target if you’d rather link that instead:
Stitching confirms into JUnit
ament_cmake_gtest writes test_results/<package>/<test>.gtest.xml. The stitcher (shipped as roboticks-stitch-cpp-junit, installed by pip install roboticks) merges confirms.json into the XML:
rbtk test cloud or the GitHub App, the platform reads the stitched XML directly.
Gtest assertion helpers
roboticks_cpp ships rclcpp-aware helpers that mirror the Python ones:
FAIL() macros on timeout so failures slot into the standard gtest summary.
A full example
Next
C++ reference
Full
ConfirmsRegistry API, macro semantics, threading guarantees.Wire contract
The JUnit-with-confirms schema both stitchers target.
Pytest tests
The Python-side equivalent, for mixed-language packages.
Coverage
Wire gcov/lcov so coverage shows up next to the matrix.