dimanche 16 décembre 2018

Test node does not exist error in GTest / ROSTest

I am testing a ROS project using catkin_make and make. But I am having trouble finding my test node through my CMakeLists.txt and launch file. My test cases never run because of this issue.

The following is the section relevant to google testing in my CMakeLists.txt. Assume all other aspects (not shown here) of my project in CMakeLists.txt are perfect.

if(CATKIN_ENABLE_TESTING)
  find_package(rostest REQUIRED)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage")
  add_rostest_gtest(tinynomadTest test/tinynomadTest.launch     test/tinynomadTest.cpp test/NavigationTest.cpp 
                    test/VisionTest.cpp test/TurtlebotTest.cpp src/Navigation.cpp  
                    src/Vision.cpp src/Turtlebot.cpp)
  target_link_libraries(tinynomadTest ${catkin_LIBRARIES} ${GTEST_LIBRARIES} pthread)
  add_dependencies(tinynomadTest ${catkin_EXPORTED_TARGETS})
  set_target_properties(tinynomadTest PROPERTIES LINKER_LANGUAGE CXX)
endif()

The following is my launch file tinynomadTest.launch :

<launch>
 <node name="tinynomad" pkg="tinynomad" type="tinynomad" output="screen"/>
 <test pkg="tinynomad" test-name="tinynomadTest" type="tinynomadTest" />
</launch>

This is my project structure :

Project Structure

[ 20%] Built target sensor_msgs_generate_messages_eus
[100%] Built target tinynomadTest
[100%] Built target tests
Removing test result files from '/home/arun/Documents/catkin_ws/build    /test_results/tinynomad'
- removing '/home/arun/Documents/catkin_ws/build/test_results/tinynomad    /rostest-test_tinynomadTest.xml'
[100%] Built target clean_test_results_tinynomad
-- run_tests.py: execute commands
  /opt/ros/kinetic/share/rostest/cmake/../../../bin/rostest --pkgdir=/home/arun/Documents/catkin_ws/src/TinyNomad --package=tinynomad --results-    filename test_tinynomadTest.xml --results-base-dir "/home/arun/Documents/catkin_ws/build/test_results" /home/arun/Documents/catkin_ws/src/TinyNomad    /test/tinynomadTest.launch 
... logging to /home/arun/.ros/log/rostest-arun-Ubuntu-6036.log
 [ROSUNIT] Outputting test results to /home/arun/Documents/catkin_ws/build/test_results/tinynomad/rostest-test_tinynomadTest.xml
[Testcase: testtinynomadGTest] ... FAILURE!
FAILURE: Test node [tinynomad/tinynomadGTest] does not exist or is not executable
  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 93, in fn
self.fail(message)
  File "/usr/lib/python2.7/unittest/case.py", line 410, in fail
raise self.failureException(msg)
----------------------------------------------------------------------------    ----

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

[testtinynomadGTest][failed]

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

ERROR: The following tests failed to run:
 * testtinynomadGTest

rostest log file is in /home/arun/.ros/log/rostest-arun-Ubuntu-6036.log
-- run_tests.py: verify result "/home/arun/Documents/catkin_ws/build    /test_results/tinynomad/rostest-test_tinynomadTest.xml"
[100%] Built target _run_tests_tinynomad_rostest_test_tinynomadTest.launch
[100%] Built target _run_tests_tinynomad_rostest
[100%] Built target _run_tests_tinynomad
[100%] Built target run_tests

Would you enlighten me what is wrong ?

Aucun commentaire:

Enregistrer un commentaire