rostest include ros node as dependency
How do you include a ros node in your ROS_WS/src directory into your rostest unit tests? project_i_depend_on
is just a simple ros node I wrote to reuse test fixture code in multiple projects, but I can only reference it if I include it as a relative directory which is super hacky:
#include "../../project_i_depend_on/include/project_i_depend_on/stuff.h"
Here's my rostest cmake:
if(CATKIN_ENABLE_TESTING)
# find_package(rostest REQUIRED)
find_package(catkin REQUIRED COMPONENTS rostest project_i_depend_on)
add_rostest_gtest(
${PROJECT_NAME}_tests
# TODO: why cant we file glob here to get test sources?
test/${PROJECT_NAME}_tests.launch
test/my_tests.cpp
src/my_source.cpp
)
# inject the test/resources directory into the header template, producing a reference for it the tests can use
include_directories(${CMAKE_BINARY_DIR})
target_link_libraries(
${PROJECT_NAME}_tests
${catkin_LIBRARIES}
${OpenCV_LIBS}
)
add_dependencies(
${PROJECT_NAME}_tests
${PROJECT_NAME}
${catkin_EXPORTED_TARGETS}
)
endif()
and my package.xml just has rostest as a test_depend. I've added the other project as a test_depend and regular depend but neither works.