rostest only reports one test case result [closed]

asked 2012-11-17 03:55:45 -0600

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.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-08-31 21:10:55.489851

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.

Victor Gonzalez-Pacheco gravatar image Victor Gonzalez-Pacheco  ( 2014-01-27 21:32:06 -0600 )edit

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

Jon Stephan gravatar image Jon Stephan  ( 2014-02-01 01:46:02 -0600 )edit