Running tests through `add_rostest_gtest` cannot find test executable

asked 2019-12-04 05:35:17 -0500

tobyhijzen gravatar image

updated 2019-12-04 05:36:29 -0500

I'm trying to run some integrations tests on my node. I have added the following to my CMakeLists.txt :

if(CATKIN_ENABLE_TESTING)
  find_package(rostest REQUIRED)

  add_rostest_gtest(
    wepods_rtllc_bridge_integration_test
    test/rtllc_bridge.test
    src/test/test_rtllc_bridge_node.cpp)

  target_link_libraries(wepods_rtllc_bridge_integration_test ${catkin_LIBRARIES} ${GTEST_LIBRARIES} nanobp_msgs yaml-cpp)
endif()

The rtllc_bridge.test looks as follows:

<launch>
  <node pkg="wepods_rtllc_bridge" type="wepods_rtllc_bridge" name="rtllc" required="true" output="screen" clear_params="false">
    <rosparam file="$(find wepods_rtllc_bridge)/params/test/wepods_rtllc_bridge.yaml" command="load" />
  </node>
  <test test-name="TestRtllcCommunicationNode" pkg="wepods_rtllc_bridge" type="wepods_rtllc_bridge_integration_test" time-limit="30.0"/>
</launch>

I build the package first, then I run: catkin build wepods_rtllc_bridge -v --no-deps --no-install --catkin-make-args run_tests. However it does not seem to be able to find the test:

[Testcase: testTestRtllcCommunicationNode] ... FAILURE!
FAILURE: test [TestRtllcCommunicationNode] did not generate test results
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rostest/runner.py", line 164, in fn
    self.assert_(os.path.isfile(test_file), "test [%s] did not generate test results"%test_name)
  File "/usr/lib/python2.7/unittest/case.py", line 422, in assertTrue
    raise self.failureException(msg)
--------------------------------------------------------------------------------

[ROSTEST]-----------------------------------------------------------------------

[testTestRtllcCommunicationNode][failed]

SUMMARY
 * RESULT: FAIL
 * TESTS: 0
 * ERRORS: 0
 * FAILURES: 1

ERROR: The following tests failed to run:
 * testTestRtllcCommunicationNode

The test does seem to be build as it exists in the following locations: ./devel/.private/wepods_rtllc_bridge/lib/wepods_rtllc_bridge/wepods_rtllc_bridge_integration_test and ./devel/lib/wepods_rtllc_bridge/wepods_rtllc_bridge_integration_test.

edit retag flag offensive close merge delete