0
$\begingroup$

I have a project in ROS, which has multiple sub-parts and all of them has tests. I'm not really experienced so when I googled how to make tests in ROS, I found that you should put a condition in the CMakeLists.txt, so the tests only build when wanted. I have this part in all of them (this is one specific):

if(CATKIN_ENABLE_TESTING)
  find_package(rostest REQUIRED)
  add_rostest_gtest(game_logic_test
    launch/gtest.test
    src/main_test.cpp
    src/paddle_solver_test.cpp
  )
  target_link_libraries(game_logic_test ${catkin_LIBRARIES} GTest::gtest_main game_logic_lib nlopt ball_lib)
endif()

This works perfectly when I run

catkin_make run_tests

but there are times when I don't want to run all of the tests, just for one of the packages. So I tried to build the project with

catkin_make -DCATKIN_ENABLE_TESTING=1

but when I ran

rostest game_logic_test gtest.test --text

The new parts weren't present in the test. These were logging parts, so it was easy to see.

Why is this happening? How can I build in a way that the tests also compiles?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.