ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rostest not finding the actual test

asked 2014-11-13 08:35:12 -0600

etsardou gravatar image

updated 2014-11-14 01:38:12 -0600


I am trying to create a functional test. My node is a C++ ROS node for face detection which works independently. My test file ( follows:

#!/usr/bin/env python

import sys
import unittest
import rospy
from rapp_platform_ros_communications.srv import *

class FaceDetFunc(unittest.TestCase):

    def faceDetectionFunctionalTest(self):
        fd_service = rospy.ServiceProxy('ric/face_detection_service', FaceDetectionRosSrv)
        req = FaceDetectionRosSrv.Request
        req.imageFilename = "/home/etsardou/rapp_platform_catkin_ws/src/rapp-platform/ric/test_auxiliary_files/Lenna.png"
        response = fd_service(req)
        faces_num = len(response.faces_up_left)
        self.assertEqual( faces_num, 1, "Face detection ok")

if __name__ == '__main__':
    import rosunit
    rosunit.unitrun(PKG, 'FaceDetFunc', FaceDetFunc)

My launch file for the functional test is:

   <node type="face_detection_ros_node" pkg="ros_nodes" name="ros_nodes"/> 
   <test time-limit="10" test-name="face_detection_functional" pkg="ros_nodes" type="" /> 

The CMake:


The output I get is:

$ catkin_make run_tests_ros_nodes_rostest_test_face_detection_functional_tests.launch 
Base path: /home/etsardou/rapp_platform_catkin_ws
Source space: /home/etsardou/rapp_platform_catkin_ws/src
Build space: /home/etsardou/rapp_platform_catkin_ws/build
Devel space: /home/etsardou/rapp_platform_catkin_ws/devel
Install space: /home/etsardou/rapp_platform_catkin_ws/install
#### Running command: "make cmake_check_build_system" in "/home/etsardou/rapp_platform_catkin_ws/build"
#### Running command: "make run_tests_ros_nodes_rostest_test_face_detection_functional_tests.launch -j2 -l2" in "/home/etsardou/rapp_platform_catkin_ws/build"
Scanning dependencies of target run_tests_ros_nodes_rostest_test_face_detection_functional_tests.launch
-- execute commands
  /home/etsardou/rosjava/src/ros_comm/tools/rostest/scripts/rostest --pkgdir=/home/etsardou/rapp_platform_catkin_ws/src/rapp-platform/ric/ros_nodes --package=ros_nodes --results-filename test_face_detection_functional_tests.xml /home/etsardou/rapp_platform_catkin_ws/src/rapp-platform/ric/ros_nodes/test/face_detection/functional_tests.launch 
... logging to /home/etsardou/.ros/log/rostest-iason-24881.log
[ROSUNIT] Outputting test results to /home/etsardou/rapp_platform_catkin_ws/build/test_results/ros_nodes/rostest-test_face_detection_functional_tests.xml
libdc1394 error: Failed to initialize libdc1394
testface_detection_functional ... ok


 * TESTS: 0
 * ERRORS: 0

rostest log file is in /home/etsardou/.ros/log/rostest-iason-24881.log
-- verify result "/home/etsardou/rapp_platform_catkin_ws/build/test_results/ros_nodes/rostest-test_face_detection_functional_tests.xml"
Built target run_tests_ros_nodes_rostest_test_face_detection_functional_tests.launch

Thus, my test is not found. Btw I am running another test from the same ws and it runs correctly (the files are almost the same).

Edit: A part of the log file that does not have an error or something..:

[rostest][INFO] 2014-11-14 09:30:03,872: process[face_detection_functional-3]: started with pid [9818]
[roslaunch][INFO] 2014-11-14 09:30:03,874: ... successfully launched [face_detection_functional-3]
[rostest][INFO] 2014-11-14 09:30:04,403: [face_detection_functional-3] process has finished cleanly
log file: /home/etsardou/.ros/log/0c6ea6a8-6bd0-11e4-8c35-9a10b4a777d2/face_detection_functional-3*.log
[roslaunch.pmon][INFO] 2014-11-14 09:30:04,403: ProcessMonitor.unregister[face_detection_functional-3] starting
[roslaunch.pmon][INFO] 2014-11-14 09:30:04,404: ProcessMonitor.unregister[face_detection_functional-3] complete
[rostest][INFO] 2014-11-14 09:30:04,477: test [face_detection_functional] finished
[rostest][INFO] 2014-11-14 09:30:04,477: test [face_detection_functional] results are in [/home/etsardou/rapp_platform_catkin_ws/build/test_results/ros_nodes/rosunit-face_detection_functional.xml]
[rostest][INFO] 2014-11-14 09:30:04,480: test [face_detection_functional] results summary: 0 errors, 0 failures, 0 tests
[rostest][INFO] 2014-11-14 09:30:04,481: [ROSTEST] test [face_detection_functional] done
edit retag flag offensive close merge delete


Did you look in the rostest log file? Also the error libdc1394 error: Failed to initialize libdc1394 might be related?

Dirk Thomas gravatar image Dirk Thomas  ( 2014-11-13 12:17:10 -0600 )edit

The log file did not have any errors.. (I edited the initial message by adding a small portion of the log file).

Also the libdc1394 has to do with OpenCV and not with ROS Check here.

etsardou gravatar image etsardou  ( 2014-11-14 01:40:21 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-15 12:10:39 -0600

Tsirif gravatar image

Rename the test suite method into: test_faceDetectionFunctional. Unittest needs the test suites to be named like test_something.

If this doesn't suffice, switch to rostest instead of rosunit.

then your main should look like:
rostest.rosrun(PKG, NAME, FaceDecFunc, sys.argv)

PKG = 'ros_nodes' and NAME whatever this test is named.

edit flag offensive delete link more


The rename has hone it! Thnx ;)

etsardou gravatar image etsardou  ( 2014-11-15 12:15:03 -0600 )edit

Question Tools

1 follower


Asked: 2014-11-13 08:35:12 -0600

Seen: 2,597 times

Last updated: Nov 15 '14