[ros-users] rosjava test

Brian Gerkey gerkey at willowgarage.com
Tue Jul 6 18:04:14 UTC 2010


On Tue, Jul 6, 2010 at 7:12 AM, Aaron Holroyd <aholroyd at wpi.edu> wrote:
> I would like to start writing some test cases for rosjava code I have
> written.  Unfortunately, I can't seem to figure out how this should be done
> with ROS.
> I've been using Eclipse for my development, and I could continue to just use
> it's built in testing environment.  The only problem with this is that when
> the code is released, the test cases won't work.  Are there any other
> suggestions, or a preferred way to do this?

hi Aaron,

I don't know enough about Eclipse to give a recommendation there, but
there are two ways that you can test your code at the command-line:

(1) Use rostest (http://www.ros.org/wiki/rostest).  It allows you to
bring up a ROS network, then use a program to run tests against that
network.

(2) Write standalone unit tests.  The ROS build system has support for
running C/C++ (gtest) and Python (pyunit) tests.  We don't yet have
support for Java, which I guess would use JUnit.  It should be easy to
add support.  Look in rosbuild/public.cmake and rosbuild/private.cmake
for how it's done for the other languages.  Essentially, you need to
know the command-line that's required to invoke your compiled test
program, including redirection of test results to a particular
location.  I can help with the CMake integration if you want.

Note that, for (1), if you want to write the test program itself in
Java, then you'll also need the new JUnit support described in (2)
(you could write test programs in Python or C++ using the current
infrastructure).

	brian.



More information about the ros-users mailing list