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

Why isn't Rostest running my gtests in catkin?

asked 2013-07-28 17:00:38 -0500

Toletum gravatar image

updated 2014-01-28 17:17:27 -0500

ngrennan gravatar image

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.

edit retag flag offensive close merge delete

Comments

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).

Dirk Thomas gravatar image Dirk Thomas  ( 2013-07-29 07:15:46 -0500 )edit

Are gtests still intended to be used with rostests? Otherwise, what IS the point of rostest?

Toletum gravatar image Toletum  ( 2013-07-29 11:49:29 -0500 )edit

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.

William gravatar image William  ( 2013-07-29 11:57:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-07-29 15:11:09 -0500

joq gravatar image

See this related question.

The catkin documentation is here. It does not directly address the combination of gtest and rostest.

The camera_info_manager tests do something similar. You can compare that package.xml and CMakeLists.txt to yours.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-07-28 17:00:38 -0500

Seen: 1,130 times

Last updated: Jul 29 '13