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.
C++ reference
roboticks_cpp is a header-only ament_cmake INTERFACE library. It ships:
- The
ROBOTICKS_CONFIRMSmacro. - A thread-safe
ConfirmsRegistry. - gtest-compatible rclcpp assertion helpers.
- An optional
gtest_maintarget that wires the registry dump into the standard gtest exit.
CMake
The package exports two targets viaament_cmake:
| Target | Use when |
|---|---|
roboticks_cpp::roboticks_cpp | Header-only — you provide your own gtest_main |
roboticks_cpp::gtest_main | Header + a main() that dumps ConfirmsRegistry at exit |
ROBOTICKS_CONFIRMS
| Argument | Description |
|---|---|
token | Identifier matching SuiteName_TestName from the surrounding TEST(...) / TEST_F(...). |
... | Comma-separated string literals of requirement IDs. |
ConfirmsRegistry::instance().add(...) call. It must appear inside a gtest test body. Place it as the first statement so the registry record is created before any assertion can short-circuit:
(token, [req_ids...], file, line) — file and line are captured via __FILE__ and __LINE__.
ConfirmsRegistry
Methods
| Method | Behaviour |
|---|---|
instance() | Returns the process-wide singleton. Thread-safe (Meyers singleton, C++11 magic statics). |
add(token, ids, file, line) | Appends a record. Acquires the internal std::mutex. Idempotent: same token twice unions the requirement sets. |
clear() | Empties the registry. Used by long-lived test processes between test sessions. |
dump(path) | Writes the registry as JSON to path. Returns false on I/O error. |
size() | Number of distinct tokens recorded. |
Thread safety
All mutating methods are guarded by an internalstd::mutex. instance() is safe under C++11 magic statics. Read methods (size, dump) take a shared view under the same lock — concurrent dumps and adds serialise but don’t deadlock.
JSON dump shape
Assertion helpers
Templated free functions inroboticks_cpp:::
FAIL() macro so they appear in the standard gtest summary and stop the current test. Timeouts surface as FAIL() << "timed out waiting for ...";.
Example
Stitching into JUnit
ament_cmake_gtest writes per-test JUnit XML at test_results/<package>/<test>.gtest.xml. The Python-side stitcher merges confirms.json from the registry dump:
SuiteName.TestName (gtest format) ↔ SuiteName_TestName (registry token). When you use colcon test --event-handlers roboticks+, this happens automatically.
v0.1 is registry-only. The C++ side records confirms IDs; the stitcher merges them into JUnit. Phase 11 will ship a native JUnit reporter so the macro writes properties directly — wire shape unchanged.
Manual registry dump
If you bring your ownmain():
Linking with colcon test
roboticks+ event handler ships in roboticks_cpp and:
- Locates the JUnit XML colcon wrote.
- Locates the
confirms.jsonthe test binary dumped. - Stitches and writes a side-by-side
*.junit.xmlfor upload.
Headers
| Header | Provides |
|---|---|
<roboticks_cpp/confirms.hpp> | ROBOTICKS_CONFIRMS, ConfirmsRegistry |
<roboticks_cpp/assertions.hpp> | assert_topic_published, assert_service_response, assert_action_result |
<roboticks_cpp/version.hpp> | ROBOTICKS_CPP_VERSION_MAJOR/MINOR/PATCH |
Next
Writing tests in C++
Tutorial with full examples.
Wire contract
The schema the stitcher targets.
Pytest plugin
The Python-side equivalent.
Coverage
gcov/lcov wiring inside colcon.