Why isn't Rostest running my gtests in catkin?
I am trying to run a rostest that subscribes to topics of the node it tests. It is made with gtests. Currently, I'm trying to make the rostest deliberately fail using assert_true(false), etc.
However, no matter what I do, running rostest my_package CLASStester.test
returns success with absolutely no information. I've checked the xml log files and there's also no trace of test information (also, I can never seem to get "cout" statements in the CLASStester.cpp file to print anything in the terminal).
The following shows...roughly...what I believe are the relevant sections from my CMakeLists.txt.
add_library(CLASSForTesting src/CLASS.cpp include/mypackage/CLASS.h)
target_link_libraries(CLASS ${catkin_LIBRARIES})
catkin_add_gtest(CLASSTester include/mypackage/test/CLASSTester.h src/test/CLASSTester.cpp include/mypackage/CLASS.h include/mypackage/CLASS.h)
target_link_libraries(CLASSTester ${catkin_LIBRARIES} CLASSForTesting)
set_target_properties(CLASSTester PROPERTIES OUTPUT_NAME CLASSTester)
add_rostest(test/CLASSTester.test)
add_dependencies(CLASSTester ${PROJECT_NAME}_gencpp)
There doesn't seem to be much documentation on using rostest with catkin. Let me know if there's anything else you need. Thank you.
First you need to decide if your test is actually a GTest or a rostest. You registered both which is very likely wrong. For a more detailed answer please provide more information about your files (e.g. a repo containing the code in question).
Are gtests still intended to be used with rostests? Otherwise, what IS the point of rostest?
A GTest tends to be a standalone executable which does unit testing (tests individual functions in the component being tested). rostest allows you to do integration testing, by setting up a launch file which starts a roscore, and potentially several nodes and asserts things about the ROS interface of those nodes.