Running Junit tests in Rosjava using Catkin

asked 2015-11-25 08:50:46 -0500

Ernesto Corbellini gravatar image

Hi all, I'm trying to run Junit tests with a rosjava application using catkin but it's not working. It doesn't find the tests. It does work using gradle though. I've pasted the outputs and the config file below. Any ideas of how to get this working with Catkin?

Output of running catkin:

$ catkin_make test
Base path: /home/ecorbellini/repos/ernesto/rosjava_actionlib
Source space: /home/ecorbellini/repos/ernesto/rosjava_actionlib/src
Build space: /home/ecorbellini/repos/ernesto/rosjava_actionlib/build
Devel space: /home/ecorbellini/repos/ernesto/rosjava_actionlib/devel
Install space: /home/ecorbellini/repos/ernesto/rosjava_actionlib/install
####
#### Running command: "make cmake_check_build_system" in "/home/ecorbellini/repos/ernesto/rosjava_actionlib/build"
####
####
#### Running command: "make test -j4 -l4" in "/home/ecorbellini/repos/ernesto/rosjava_actionlib/build"
####
Running tests...
Test project /home/ecorbellini/repos/ernesto/rosjava_actionlib/build
No tests were found!!!

Output of running gradlew:

$ ./gradlew test
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:rosjava_actionlib:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: /home/ecorbellini/repos/ernesto/rosjava_actionlib/src/rosjava_actionlib/rosjava_actionlib/src/main/java/com/github/ekumen/rosjava_actionlib/CommStateMachine.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
:rosjava_actionlib:processResources UP-TO-DATE
:rosjava_actionlib:classes
:rosjava_actionlib:compileTestJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning
:rosjava_actionlib:processTestResources UP-TO-DATE
:rosjava_actionlib:testClasses
:rosjava_actionlib:test

TestCommStateMachine > test FAILED
    java.lang.AssertionError at TestCommStateMachine.java:18

1 test completed, 1 failed
:rosjava_actionlib:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':rosjava_actionlib:test'.
> There were failing tests. See the report at: file:///home/ecorbellini/repos/ernesto/rosjava_actionlib/src/rosjava_actionlib/rosjava_actionlib/build/reports/tests/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.849 secs

This is the project's build.gradle:

apply plugin: 'application'
mainClassName = 'org.ros.RosRun'

dependencies {
  compile 'org.ros.rosjava_core:rosjava:[0.2,0.3)'
  testCompile 'junit:junit:4.12'
}
edit retag flag offensive close merge delete

Comments

There needs to be a target which tells catkin to invoke the java tests. Can you edit to show the contents of your CMakeLists.txt too? I'm guessing we might need to extend catkin to detect the java unit tests like python: catkin_add_nosetests @dirk-thomas

tfoote gravatar image tfoote  ( 2015-11-30 15:40:01 -0500 )edit

Since ROS doesn't support Java out-of-the-box I don't think catkin should be extended with Java-specific features. Instead rosjava_core should provide a CMake function to provide similar functionality as catkin_add_nosetests.

Dirk Thomas gravatar image Dirk Thomas  ( 2015-11-30 15:58:16 -0500 )edit