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

Revision history [back]

click to hide/show revision 1
initial version

I think you should look into using add_rostest_gtest to run your ROS related unit tests

if (CATKIN_ENABLE_TESTING)

    # set up includes
    include_directories(${catkin_INCLUDE_DIRS}
        include/
        test/include/
    )

    # find rostest package
    find_package(rostest REQUIRED)

    # set up the rostest
    set(TALKER_ROS_TEST talker_rostest)
    add_rostest_gtest(${TALKER_ROS_TEST}
            test/detection_test.test
            test/test_talker.cpp.cpp
    )

    # link relevant libraries
    target_link_libraries(${TALKER_ROS_TEST}
        gtest
        gtest_main
        ${catkin_LIBRARIES}
        ${PROJECT_NAME}
    )

endif()

This links the source gtest file to your .test file, and should solve your problem.

I think you should look into using add_rostest_gtest to run your ROS related unit tests

if (CATKIN_ENABLE_TESTING)

    # set up includes
    include_directories(${catkin_INCLUDE_DIRS}
        include/
        test/include/
    )

    # find rostest package
    find_package(rostest REQUIRED)

    # set up the rostest
    set(TALKER_ROS_TEST talker_rostest)
    add_rostest_gtest(${TALKER_ROS_TEST}
         test/detection_test.test
         test/test_talker.cpp.cpp
    )

    # link relevant libraries
    target_link_libraries(${TALKER_ROS_TEST}
        gtest
        gtest_main
        ${catkin_LIBRARIES}
        ${PROJECT_NAME}
    )

endif()

This links the source gtest file to your .test file, and should solve your problem.