[ros-users] rosjava test

Ken Conley kwc at willowgarage.com
Tue Jul 6 20:28:26 UTC 2010

In order to integrate with rostest, you just need to redirect the test
output to the value specified at the command line:


As you can tell, the option is inherited from the gtest framework.

Hope this helps,
 - Ken

On Tue, Jul 6, 2010 at 1:20 PM, Aaron Holroyd <aholroyd at wpi.edu> wrote:
> I'll take a look at how to add Java JUnit testing to the rosbuild cmake
> files first.  Whether I get it to work or not, I'll let you know how it
> goes.
> As for rostest, I had seen this, but I noticed that it is for C++ and Python
> only.  Once I get CMake JUnit testing  to work the rostest should be fairly
> straight forward.
> Aaron Holroyd
> B.S. Computer Science and Robotics Engineering
> WPI M.S. CS 2011
> http://users.wpi.edu/~aholroyd
> On Tue, Jul 6, 2010 at 14:04, Brian Gerkey <gerkey at willowgarage.com> wrote:
>> 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.
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users

More information about the ros-users mailing list