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

Revision history [back]

Good question!

I didn't know either, but I did some digging, and here's what I found:

catkin_make run_tests_packageName
catkin_make run_tests_packageName_gtest_testTarget

Read on for more details...

As documented here,

Catkin packages use macros that define make targets prefixed with run-tests. They can be run by invoking catkin_make run_tests[_...] or just using make run_tests[_...].

Given this clue, I googled for a command to list all defined make targets, and found this:

make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'

When I run that in my catkin workspace, I get the following targets (among others):

run_tests_my_package
run_tests_my_package_gtest
run_tests_my_package_gtest_my_tests

These targets correspond to the following lines in my CMakeLists.txt file:

project(my_package)
catkin_add_gtest(my_tests test/my_tests.cpp)

I would assume there are similar targets defined for rostest tests, but I have not looked for these yet.