Robotics StackExchange | Archived questions

rostest only reports one test case result

I think this may be related to this question.

When I try to run 2 test cases, rostest seems to only report the results of one of them. Here's the simplest example:

#!/usr/bin/env python
PKG = 'test_knex_ros'
import roslib; roslib.load_manifest(PKG)

import sys
import unittest
from optparse import OptionParser
import rospy


class TestDiffTfValid(unittest.TestCase):

    def test_one_equals_one(self):
        rospy.loginfo("-D- test_one_equals_one")
        self.assertEquals(1, 1, "1!=1")

class TestDiffTfInValid(unittest.TestCase):

    def test_one_equals_one_invalid(self):
        rospy.loginfo("-D- test_one_equals_one_invalid")
        self.assertEquals(1, 1, "1!=1")

if __name__ == '__main__':
    import rostest
    rospy.loginfo("-I- test_diff_tf started")
    rostest.rosrun(PKG, 'test_range_filter_valid', TestDiffTfValid, sys.argv) 
    rostest.rosrun(PKG, 'test_range_filter_invalid', TestDiffTfInValid, sys.argv) 

And the output:

[jfstepha@ubuntu-nw nodes]$ rostest test_knex_ros diff_tf.test 
... logging to /home/jfstepha/.ros/log/rostest-ubuntu-nw-32479.log
[ROSUNIT] Outputting test results to /home/jfstepha/.ros/test_results/test_knex_ros/TEST-rostest__launch_diff_tf.xml
testtest_diff_tf ... ok

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

[test_knex_ros.test_diff_tf/test_one_equals_one_invalid][passed]

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

rostest log file is in /home/jfstepha/.ros/log/rostest-ubuntu-nw-32479.log

If I run with --text, it does give the output from both the test cases.

Asked by Jon Stephan on 2012-11-17 04:55:45 UTC

Comments

Did you manage to solve this issue? I am having the same problem, but I do not want to call my tests with --text, since it is much more verbose and slows down testing.

Asked by Victor Gonzalez-Pacheco on 2014-01-27 22:32:06 UTC

I don't think I ever did solve it. I gave up on python unit testing a long time ago.

Asked by Jon Stephan on 2014-02-01 02:46:02 UTC

Answers