Rostest not showing existing failures and errors

asked 2019-05-25 12:10:45 -0500

minennick gravatar image

Hey guys, i have a problem with rostest not showing existing failures, but only succeding tests. I'm working on Kinetic and ROS 1.12.14

For this testfile:

#!/usr/bin/env python
PKG = 'bobtimus_lane_detection'

import sys
import unittest
import rostest


## A sample python unit test
class TestCareBones(unittest.TestCase):
    ## test 1 == 1
    def test_one_equals_one(self): # here's the failure
        self.assertTrue(1 == 2)
    def test_two_equals_two(self):
        self.assertEqual(2, 2, "2!=2")


if __name__ == '__main__':
    rostest.rosrun(PKG, 'test_care_bones', TestCareBones)

and this simple launchfile:

<launch>
  <test test-name="test_lane_detection" pkg="bobtimus_lane_detection" type="lane_detection_test.py" />
</launch>

i get this output:

[ROSUNIT] Outputting test results to /home/niklas/.ros/test_results/bobtimus_lane_detection/rostest- 
 launch_lane_detection.xml
[Testcase: testtest_lane_detection] ... ok

[ROSTEST]-----------------------------------------------------------------------


SUMMARY
 * RESULT: SUCCESS
 * TESTS: 0
 * ERRORS: 0
 * FAILURES: 0

looking into the the given results file (rostest- launch_lane_detection.xml) i can see this warning probably causing the error:

WARN: test result file is empty [/home/niklas/.ros/test_results/bobtimus_lane_detection/rosunit-test_lane_detection.xml]

If i correct the false test above everything works fine and the results get written in the file. So why is this happening and how can it be fixed? Thanks for your help :)

edit retag flag offensive close merge delete