[ros-users] rosjava test
Aaron Holroyd
aholroyd at WPI.EDU
Tue Jul 13 20:53:37 UTC 2010
That's what I was thinking when I was done. Thanks for confirmation.
Aaron Holroyd
B.S. Computer Science and Robotics Engineering
WPI M.S. CS 2011
http://users.wpi.edu/~aholroyd
On Tue, Jul 13, 2010 at 16:47, Ken Conley <kwc at willowgarage.com> wrote:
> Any new cmake macros should definitely go with rosjava.cmake and not
> into rosbuild. I imagine you can submit those as patches to Nicholas.
>
> regards,
> Ken
>
> On Tue, Jul 13, 2010 at 1:00 PM, Aaron Holroyd <aholroyd at wpi.edu> wrote:
> > Alright, so being completely honest, I first looked at what you sent and
> > thought it was nuts. However, after getting it to work, it's a much
> nicer
> > solution (although it may not look it).
> > So, back to my original question, where should I be putting the cmake
> > macros? For now, until I hear better, I'll put them in the
> > rosjava/cmake/rosjava.cmake file on my computer. If they should go
> > somewhere else, let me know, but since Java isn't fully supported, I
> figured
> > it would be better to keep them out of public and private cmake in
> rosbuild.
> > If / When I get this to work with ros, I will send out my solution. For
> > now, if anyone else wants this, to get JUnit to work from the command
> line I
> > just executed the following script:
> > #!/bin/bash
> > #Usage: junit.sh <class path> <test case class file>
> > if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then
> > if [ -d /usr/share/ant ] ; then
> > ANT_HOME=/usr/share/ant
> > fi
> > fi
> > # set ANT_LIB location
> > ANT_LIB="${ANT_HOME}/lib"
> > # set the classes for the test case runner and xml format
> > RUNNER=org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner
> >
> FORMAT=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter
> > # make sure rosjava is on the classpath
> > ROS_JAVA=`rospack find rosjava`/bin
> > # the class path requires the ant jar for exceptions
> > export
> >
> CLASSPATH=$CLASSPATH:$ROS_JAVA:$ANT_LIB/ant.jar:$ANT_LIB/ant-junit.jar:$ANT_LIB/junit4.jar:$1
> > java $RUNNER $2 formatter=$FORMAT
> >
> > As an example, one could execute: ./junit.sh .
> pkg.to.class.ClassNameTest
> > Aaron Holroyd
> > B.S. Computer Science and Robotics Engineering
> > WPI M.S. CS 2011
> > http://users.wpi.edu/~aholroyd
> >
> >
> > On Tue, Jul 13, 2010 at 14:19, Ken Conley <kwc at willowgarage.com> wrote:
> >>
> >> You shouldn't have to use the ant command-line tool. Instead, you
> >> should just be able to use Ant's classes to generate the XML files
> >> (the XML format is actually an Ant Junit format).
> >>
> >> The class you probably want is:
> >>
> >> org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter
> >>
> >> You can probably plug this in as a formatter of:
> >>
> >> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner
> >>
> >> though that's just from scanning the source code; I haven't tried this
> >> myself yet.
> >>
> >> Both JUnit and Ant are open-source projects, so it should be fairly
> >> easy to orchestrate the desired behavior.
> >>
> >> Hope this helps,
> >> Ken
> >>
> >> On Tue, Jul 13, 2010 at 9:09 AM, Aaron Holroyd <aholroyd at wpi.edu>
> wrote:
> >> > Hi again,
> >> > I have some updates about the JUnit testing from below.
> >> > After some searching, and talking to someone who works closely with
> >> > JUnit,
> >> > I've found that I can not export an XML report directly from a JUnit
> >> > call.
> >> > Instead I have to call ant and export it from there.
> >> > This gives me 2 questions:
> >> > 1) In order to write this I would have to invoke ant with a premade
> ant
> >> > file
> >> > which takes as arguments the classes to test. This itself is not
> hard,
> >> > but
> >> > does this sound like a good solution? I would just have to add an ant
> >> > build
> >> > file to a known directory.
> >> > 2) If I write this and create a patch, is it ok to add ant to the
> >> > dependencies list for ros, or just for rosjava, or where would this
> go?
> >> > Which leads to should this be written in the rosjava CMake file, or
> in
> >> > the
> >> > main public / private cmake files in rosbuild?
> >> > I also, probably, will need help eventually with the CMake files, but
> >> > I'll
> >> > try them on my own first. I simply have never written CMake, before I
> >> > started using ROS.
> >> > Thanks again,
> >> > 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 16:20, 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
> >> >
> >> >
> >> _______________________________________________
> >> ros-users mailing list
> >> ros-users at code.ros.org
> >> https://code.ros.org/mailman/listinfo/ros-users
> >
> >
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100713/14710df0/attachment-0003.html>
More information about the ros-users
mailing list