Grey-box node/nodelet unit testing with ROS2

Is it possible to implement grey-box unit tests for nodes/nodelets with the built-in test infrastructure of ROS2?

A grey-box test is a mixture of a black-box and a white-box test. I would consider e.g. supplying a node with input data via its interface (actions, services, topics, parameters) and assert something in the nodes library level (e.g. if mocked functions in the nodes library level have been called) as node grey-box test. (In a black-box node test the output data is captured via the nodes interface only and asserted in test nodes. In a white-box node test the nodes library level code is verified separate from the nodes interface.)

I am not sure I understand your use case and “grey-box tests” enough. In order to use mock functions I assume you will compile a custom version of component. You should then be able to use that in test however you like.

It would probably best if you try to implement a simple test as you have it in mind using the ROS 2 tools. If you run into problems please don’t hesitate to ask and we are happy to help.