Robotics StackExchange | Archived questions

What is the difference between rosunit and rostest?

About rostest: Integration test suite based on roslaunch

About rosunit: an internal tool for running unit tests within ROS

But then there is an example of unit test being run by rostest.

#!/usr/bin/env python
PKG = 'test_roslaunch'
import roslib; roslib.load_manifest(PKG)  # This line is not needed with Catkin.

import sys
import unittest

## A sample python unit test
class TestBareBones(unittest.TestCase):
    ## test 1 == 1
    def test_one_equals_one(self): # only functions with 'test_'-prefix will be run!
        self.assertEquals(1, 1, "1!=1")

if __name__ == '__main__':
    import rostest
    rostest.rosrun(PKG, 'test_bare_bones', TestBareBones)

I'm confused. What are the differences between rosunit and rostest? What are usecases for each of them?

Asked by kump on 2018-11-13 04:42:07 UTC

Comments

Perhaps wiki/Quality/Tutorials/UnitTesting can provide some insight.

Asked by gvdhoorn on 2018-11-13 04:45:09 UTC

@gvdhoorn This article doesn't mention rosunit at all.

Asked by kump on 2018-11-13 05:32:21 UTC

And that's why I didn't post it as an answer. The reference was meant to provide you with some more context in which these tools are being used.

Asked by gvdhoorn on 2018-11-13 05:34:50 UTC

Judging by the numerous references to rosbuild, a deprecated build system, on the rosunit page, I'm assuming that rostest is the preferred way to test.

Asked by BryceWilley on 2019-08-20 10:20:32 UTC

Answers

From the rosunit wiki page.

"Unit-testing package for ROS. This is a lower-level library for rostest and handles unit tests, whereas rostest handles integration tests."

Asked by Raivias on 2022-06-14 15:53:55 UTC

Comments