How can I grey-box test a ROS node?

asked 2017-10-27 12:30:54 -0600

thinwybk gravatar image

Consider the following situation:

One has blackbox tested a ROS node, in the following "node under test" or short NUT. Means one has created fake node(s) to generate input data for the NUT (e.g. publish messages to a topic the NUT depends on) and one has created test node(s) which assert if the expected output of the NUT is not like expected (e.g. message values of a topic published by the NUT).

As usual the NUT library level code has been unit tested with the unittest framework corresponding to the client library (e.g. unittest for Python, gtest for C++) way before it has been blackbox tested.

Now consider the following situation:

One would like to grey-box test the NUT. Means one would like to generate input data on the ROS node level as usual. But instead of verifying with asserts in test nodes one would like to mock functions of the NUT library level code and assert if e.g. a function of interest has not been called with the expected arguments.

I have not find an example of this scenario so far. Could you guide me to an example or explain me how to do that?

edit retag flag offensive close merge delete