ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

build and run only one rostest

asked 2015-10-28 07:01:09 -0600

Dimitri Schachmann gravatar image

updated 2015-10-28 07:02:33 -0600

I have

add_rostest_gtest(TestClassA test/ClassA.test src/test/TestClassA.cpp)
add_rostest_gtest(TestClassB test/ClassB.test src/test/TestClassB.cpp)

and I want to build and execute just TestClassB and nothing else. I already know how to limit this to only that package:

catkin run_tests --no-deps my_package

But this still builds all the unit tests in my_package. Also every other time I get:

IOError: cannot create test results directory [/home/.../my_package]. Please check permissions.

So is there a way to build the tests but not to run them, and is there a way to build just one test?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-10-28 09:10:21 -0600

joq gravatar image

updated 2015-10-28 10:46:10 -0600

The answer to this question tells how to do it using catkin_make:

In summary, the necessary targets are: tests, run_tests and run_tests_PACKAGENAME.

catkin_tools can probably build and run those same targets, but I am not sure of the exact syntax.

UPDATE: To get the exact target names for package foo:

cd build/foo
make run_tests<TAB><TAB>
edit flag offensive delete link more



True, so catkin tests just builds the tests and catkin tests PACKAGENAME builds just that package. Still it builds all the tests in that package and I don't know how to figure out the specific test target names. What I do now: I just commt out the other tests in CMakeLists.txt. works for me.

Dimitri Schachmann gravatar image Dimitri Schachmann  ( 2015-10-28 09:48:53 -0600 )edit

answered 2021-01-18 09:11:33 -0600

wmmc88 gravatar image

updated 2021-01-18 09:12:29 -0600

You can build all the tests for a specific package using:

catkin build <package_name> --no-deps --catkin-make-args tests

Then you can use the rostest cli to choose a specific test to run:

rostest <package_name> <testname.test>

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-10-28 07:01:09 -0600

Seen: 1,727 times

Last updated: Jan 18 '21