ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

What is the difference between rosunit and rostest?

asked 2018-11-13 03:42:07 -0600

kump gravatar image

updated 2018-11-13 03:42:27 -0600

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?

edit retag flag offensive close merge delete


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

gvdhoorn gravatar image gvdhoorn  ( 2018-11-13 03:45:09 -0600 )edit

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

kump gravatar image kump  ( 2018-11-13 04:32:21 -0600 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-13 04:34:50 -0600 )edit

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.

BryceWilley gravatar image BryceWilley  ( 2019-08-20 10:20:32 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-06-14 15:53:55 -0600

Raivias gravatar image

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."

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-11-13 03:42:07 -0600

Seen: 1,991 times

Last updated: Nov 13 '18