rostest: specifying a single test case

asked 2018-03-12 11:52:10 -0500

knxa gravatar image

updated 2018-03-13 05:22:29 -0500

How do I tell rostest to only run a single specific test method in a python unittest.TestCase class? I can execute the full test suite with:

rostest foo foo.test

The tests are defined in a file test/, how do I run only the test method test_a in class TestFoo? Any command line arguments to rostest?

My test classes are looking like this:

#!/usr/bin/env python

import rospy
import unittest

class TestFoo(unittest.TestCase):

    def test_a(self):
        self.assertEqual(2+3, 5)

if __name__ == '__main__':
    import rostest
    rospy.init_node('TestFoo', anonymous=True)
    rostest.rosrun('foo', 'TestFoo', TestFoo)
edit retag flag offensive close merge delete