ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

If I understand your situation, it shouldn't be too hard to have a single .test file and single gtest binary, and then pass in different sets of parameters using soemthing like add_rostest(check_thing.test ARGS case:=foo), where your check_thing.test file is something like (and you've compile the check_thing binary separately using add_executable):

<launch> <arg name="case"/> <test test-name="check_thing_case_$(arg case)" pkg="my_fancy_package" type="check_thing"> <rosparam command="load" file="$(find my_fancy_package)/test/$(arg case).yaml"/> </test> </launch>

However, this does incur the time cost of starting and stopping ROS for each case. If you don't actually need a fresh slate each time, it might make more sense to just build these different cases into your GTest binary— basically, use the ros::NodeHandle::setParam API to set the parameters you need for your different cases and invoke the tests. Or, even easier, load all sets of parameters in different namespaces, and then when you go to test your object, pass it NodeHandle instances pointing at the different namespaces so that it will see different sets of parameters when it goes to initialize itself.

If I understand your situation, it shouldn't be too hard to have a single .test file and single gtest binary, and then pass in different sets of parameters using soemthing like add_rostest(check_thing.test ARGS case:=foo), where your check_thing.test file is something like (and you've compile the check_thing binary separately using add_executable):

<launch>
   <arg name="case"/>
    name="case" />
  <test test-name="check_thing_case_$(arg case)" pkg="my_fancy_package" type="check_thing">
     <rosparam command="load" file="$(find my_fancy_package)/test/$(arg case).yaml"/>
    case).yaml" />
  </test>
    </launch>

</launch>

However, this does incur the time cost of starting and stopping ROS for each case. If you don't actually need a fresh slate each time, it might make more sense to just build these different cases into your GTest binary— basically, use the ros::NodeHandle::setParam API to set the parameters you need for your different cases and invoke the tests. Or, even easier, load all sets of parameters in different namespaces, and then when you go to test your object, pass it NodeHandle instances pointing at the different namespaces so that it will see different sets of parameters when it goes to initialize itself.

If I understand your situation, it shouldn't be too hard to have a single .test file and single gtest binary, and then pass in different sets of parameters using soemthing something like add_rostest(check_thing.test ARGS case:=foo), where your check_thing.test file is something like (and you've compile compiled the check_thing binary separately using add_executable):

<launch>
  <arg name="case" />
  <test test-name="check_thing_case_$(arg case)" pkg="my_fancy_package" type="check_thing">
    <rosparam command="load" file="$(find my_fancy_package)/test/$(arg case).yaml" />
  </test>
</launch>

However, this does incur the time cost of starting and stopping ROS for each case. If you don't actually need a fresh slate each time, it might make more sense to just build these different cases into your GTest binary— basically, use the ros::NodeHandle::setParam API to set the parameters you need for your different cases and invoke the tests. Or, even easier, load all sets of parameters in different namespaces, and then when you go to test your object, pass it NodeHandle instances pointing at the different namespaces so that it will see different sets of parameters when it goes to initialize itself.