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

How to run tests in a ROS package?

asked 2018-03-08 16:47:43 -0500

Cerin gravatar image

I've written a ROS package, containing some nodes/scripts/messages etc, all laid out using the recommended folder structure. I'm not trying to execute some tests using the standard catkin_make run_tests and I'm getting the error:

The specified base path "my_ros_package" contains a package but "catkin_make" must be invoked in the root of workspace

If I'm reading this correctly, it's saying I need to create a ROS workspace...just to run tests? This seems a little strange to me. I've written a ton of unittests for Python packages, mostly using the Tox tool, and this handles creating a virtualenv, installing all your dependencies, and then running your tests, all from your Python package. I've never had to create a second Python package just to run my first package's tests.

If you've created a ROS project in a git repo, how are you supposed to test it? Create another git repo containing a "test" ROS workspace...which then clones your first repo? That seems redundant.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-03-08 21:03:19 -0500

smartbot gravatar image

Be sure you’re not in “src” directory. You should be in your “~/catkin_ws” directory and then run this command in terminal: catkin_make

edit flag offensive delete link more


Yes, I know. Why would I pollute my catkin_ws directory by running unittests in it?

Cerin gravatar image Cerin  ( 2018-03-10 12:27:30 -0500 )edit

I don't understand what do you mean by polluting your workspace directory. Anyways, my answer was depending on the error you getting as you have an issue with workspace structure.

smartbot gravatar image smartbot  ( 2018-03-11 19:57:50 -0500 )edit
smartbot gravatar image smartbot  ( 2018-03-11 19:58:10 -0500 )edit

Question Tools



Asked: 2018-03-08 16:47:43 -0500

Seen: 582 times

Last updated: Mar 08 '18