Restart node on each test case

asked 2019-06-25 04:16:28 -0500

Rufus gravatar image

An important aspect of unit test is that each test should be independent of the other. However, when I launch a unit test with

<launch>
    <node name="node_to_be_tested" pkg="my_package" type="node_to_be_tested">
    </node>
    <test test-name="test" pkg="my_package" type="test_node"/>
</launch>

the node_to_be_tested is not restarted on each test case. If there are any persistent states stored inside node_to_be_tested, those states will persist across different test cases.

How should I set up the test so that test cases can be independent of each other?

edit retag flag offensive close merge delete