Dealing with sleeps in rostest
I am trying to use rostest (coupled with gtest) to do some black box testing of our ROS nodes. So, naturally, if I am to test some node, the launch file for rostest will look like this:
<launch>
<node (start the node under test here) ... ></node>
<test (start the node, that will call the other node's public interfaces) ...></test>
</launch>
Naturally, the node under test might have some sleeps in it. After all, most of the time you only have to do things at some predefined rate. Of course, waiting for those sleeps to pass will introduce delays in the test. Those delays might contribute significantly to the total running time of the test suite. Unless something is done.
Is there any universal approach to this problem? One thing I can think of is using /use_sim_time
parameter in the launch file and writing my own "time server" (should be trivial), that publishes "accelerated time" to the /clock
topic. This might help with the delays a bit, but it will, obviously, not eliminate them completely.
Any other ideas? This seems like a fairly common problem one might encounter while performing black box testing.
I'm not sure that is such a universally true statement in an event-based, asynchronous publish-subscribe robotics framework ..