<font size="2"><font face="georgia,serif">That's what I was thinking when I was done.  Thanks for confirmation.</font></font><div><font size="2"><font face="georgia,serif"><br clear="all"></font></font>Aaron Holroyd<br>

B.S. Computer Science and Robotics Engineering<br>WPI M.S. CS 2011<br><a href="http://users.wpi.edu/~aholroyd">http://users.wpi.edu/~aholroyd</a><br>
<br><br><div class="gmail_quote">On Tue, Jul 13, 2010 at 16:47, Ken Conley <span dir="ltr"><<a href="mailto:kwc@willowgarage.com">kwc@willowgarage.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Any new cmake macros should definitely go with rosjava.cmake and not<br>
into rosbuild. I imagine you can submit those as patches to Nicholas.<br>
<br>
regards,<br>
<font color="#888888">Ken<br>
</font><div><div></div><div class="h5"><br>
On Tue, Jul 13, 2010 at 1:00 PM, Aaron Holroyd <<a href="mailto:aholroyd@wpi.edu">aholroyd@wpi.edu</a>> wrote:<br>
> Alright, so being completely honest, I first looked at what you sent and<br>
> thought it was nuts.  However, after getting it to work, it's a much nicer<br>
> solution (although it may not look it).<br>
> So, back to my original question, where should I be putting the cmake<br>
> macros?  For now, until I hear better, I'll put them in the<br>
> rosjava/cmake/rosjava.cmake file on my computer.  If they should go<br>
> somewhere else, let me know, but since Java isn't fully supported, I figured<br>
> it would be better to keep them out of public and private cmake in rosbuild.<br>
> If / When I get this to work with ros, I will send out my solution.  For<br>
> now, if anyone else wants this, to get JUnit to work from the command line I<br>
> just executed the following script:<br>
> #!/bin/bash<br>
> #Usage: junit.sh <class path> <test case class file><br>
> if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then<br>
>   if [ -d /usr/share/ant ] ; then<br>
>      ANT_HOME=/usr/share/ant<br>
>   fi<br>
> fi<br>
> # set ANT_LIB location<br>
> ANT_LIB="${ANT_HOME}/lib"<br>
> # set the classes for the test case runner and xml format<br>
> RUNNER=org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner<br>
> FORMAT=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter<br>
> # make sure rosjava is on the classpath<br>
> ROS_JAVA=`rospack find rosjava`/bin<br>
> # the class path requires the ant jar for exceptions<br>
> export<br>
> CLASSPATH=$CLASSPATH:$ROS_JAVA:$ANT_LIB/ant.jar:$ANT_LIB/ant-junit.jar:$ANT_LIB/junit4.jar:$1<br>
> java $RUNNER $2 formatter=$FORMAT<br>
><br>
> As an example, one could execute:   ./junit.sh . pkg.to.class.ClassNameTest<br>
> Aaron Holroyd<br>
> B.S. Computer Science and Robotics Engineering<br>
> WPI M.S. CS 2011<br>
> <a href="http://users.wpi.edu/~aholroyd" target="_blank">http://users.wpi.edu/~aholroyd</a><br>
><br>
><br>
> On Tue, Jul 13, 2010 at 14:19, Ken Conley <<a href="mailto:kwc@willowgarage.com">kwc@willowgarage.com</a>> wrote:<br>
>><br>
>> You shouldn't have to use the ant command-line tool. Instead, you<br>
>> should just be able to use Ant's classes to generate the XML files<br>
>> (the XML format is actually an Ant Junit format).<br>
>><br>
>> The class you probably want is:<br>
>><br>
>> org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter<br>
>><br>
>> You can probably plug this in as a formatter of:<br>
>><br>
>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner<br>
>><br>
>> though that's just from scanning the source code; I haven't tried this<br>
>> myself yet.<br>
>><br>
>> Both JUnit and Ant are open-source projects, so it should be fairly<br>
>> easy to orchestrate the desired behavior.<br>
>><br>
>> Hope this helps,<br>
>> Ken<br>
>><br>
>> On Tue, Jul 13, 2010 at 9:09 AM, Aaron Holroyd <<a href="mailto:aholroyd@wpi.edu">aholroyd@wpi.edu</a>> wrote:<br>
>> > Hi again,<br>
>> > I have some updates about the JUnit testing from below.<br>
>> > After some searching, and talking to someone who works closely with<br>
>> > JUnit,<br>
>> > I've found that I can not export an XML report directly from a JUnit<br>
>> > call.<br>
>> >  Instead I have to call ant and export it from there.<br>
>> > This gives me 2 questions:<br>
>> > 1) In order to write this I would have to invoke ant with a premade ant<br>
>> > file<br>
>> > which takes as arguments the classes to test.  This itself is not hard,<br>
>> > but<br>
>> > does this sound like a good solution? I would just have to add an ant<br>
>> > build<br>
>> > file to a known directory.<br>
>> > 2) If I write this and create a patch, is it ok to add ant to the<br>
>> > dependencies list for ros, or just for rosjava, or where would this go?<br>
>> >  Which leads to  should this be written in the rosjava CMake file, or in<br>
>> > the<br>
>> > main public / private cmake files in rosbuild?<br>
>> > I also, probably, will need help eventually with the CMake files, but<br>
>> > I'll<br>
>> > try them on my own first.  I simply have never written CMake, before I<br>
>> > started using ROS.<br>
>> > Thanks again,<br>
>> > Aaron Holroyd<br>
>> > B.S. Computer Science and Robotics Engineering<br>
>> > WPI M.S. CS 2011<br>
>> > <a href="http://users.wpi.edu/~aholroyd" target="_blank">http://users.wpi.edu/~aholroyd</a><br>
>> ><br>
>> ><br>
>> > On Tue, Jul 6, 2010 at 16:20, Aaron Holroyd <<a href="mailto:aholroyd@wpi.edu">aholroyd@wpi.edu</a>> wrote:<br>
>> >><br>
>> >> I'll take a look at how to add Java JUnit testing to the rosbuild cmake<br>
>> >> files first.  Whether I get it to work or not, I'll let you know how it<br>
>> >> goes.<br>
>> >><br>
>> >> As for rostest, I had seen this, but I noticed that it is for C++ and<br>
>> >> Python only.  Once I get CMake JUnit testing  to work the rostest<br>
>> >> should be<br>
>> >> fairly straight forward.<br>
>> >> Aaron Holroyd<br>
>> >> B.S. Computer Science and Robotics Engineering<br>
>> >> WPI M.S. CS 2011<br>
>> >> <a href="http://users.wpi.edu/~aholroyd" target="_blank">http://users.wpi.edu/~aholroyd</a><br>
>> >><br>
>> >><br>
>> >> On Tue, Jul 6, 2010 at 14:04, Brian Gerkey <<a href="mailto:gerkey@willowgarage.com">gerkey@willowgarage.com</a>><br>
>> >> wrote:<br>
>> >>><br>
>> >>> On Tue, Jul 6, 2010 at 7:12 AM, Aaron Holroyd <<a href="mailto:aholroyd@wpi.edu">aholroyd@wpi.edu</a>><br>
>> >>> wrote:<br>
>> >>> > I would like to start writing some test cases for rosjava code I<br>
>> >>> > have<br>
>> >>> > written.  Unfortunately, I can't seem to figure out how this should<br>
>> >>> > be<br>
>> >>> > done<br>
>> >>> > with ROS.<br>
>> >>> > I've been using Eclipse for my development, and I could continue to<br>
>> >>> > just use<br>
>> >>> > it's built in testing environment.  The only problem with this is<br>
>> >>> > that<br>
>> >>> > when<br>
>> >>> > the code is released, the test cases won't work.  Are there any<br>
>> >>> > other<br>
>> >>> > suggestions, or a preferred way to do this?<br>
>> >>><br>
>> >>> hi Aaron,<br>
>> >>><br>
>> >>> I don't know enough about Eclipse to give a recommendation there, but<br>
>> >>> there are two ways that you can test your code at the command-line:<br>
>> >>><br>
>> >>> (1) Use rostest (<a href="http://www.ros.org/wiki/rostest" target="_blank">http://www.ros.org/wiki/rostest</a>).  It allows you to<br>
>> >>> bring up a ROS network, then use a program to run tests against that<br>
>> >>> network.<br>
>> >>><br>
>> >>> (2) Write standalone unit tests.  The ROS build system has support for<br>
>> >>> running C/C++ (gtest) and Python (pyunit) tests.  We don't yet have<br>
>> >>> support for Java, which I guess would use JUnit.  It should be easy to<br>
>> >>> add support.  Look in rosbuild/public.cmake and rosbuild/private.cmake<br>
>> >>> for how it's done for the other languages.  Essentially, you need to<br>
>> >>> know the command-line that's required to invoke your compiled test<br>
>> >>> program, including redirection of test results to a particular<br>
>> >>> location.  I can help with the CMake integration if you want.<br>
>> >>><br>
>> >>> Note that, for (1), if you want to write the test program itself in<br>
>> >>> Java, then you'll also need the new JUnit support described in (2)<br>
>> >>> (you could write test programs in Python or C++ using the current<br>
>> >>> infrastructure).<br>
>> >>><br>
>> >>>        brian.<br>
>> >><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > ros-users mailing list<br>
>> > <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
>> > <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
>> ><br>
>> ><br>
>> _______________________________________________<br>
>> ros-users mailing list<br>
>> <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
>> <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
><br>
><br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</div></div></blockquote></div><br></div>