[Documentation] [TitleIndex] [WordIndex

New in Diamondback


rosunit is an internal tool for running unit tests within ROS. While it can be run by a regular user, most users will generally use rosunit indirectly via rosbuild test macros. The main feature that rosunit provides is terminating a unit test based on a timeout and generating an appropriate test failure. The rosbuild system uses this feature to ensure that unit tests properly terminate.

rosunit currently supports:

The library that comes with rosunit can be used as described at unittest#Code-level_Python_Unit_Tests


$ rosrun rosunit rosunit -h

Usage: rosunit [options] <file> [test args...]

  -h, --help            show this help message and exit
  -t, --text            Run with stdout output instead of XML output
                        Set time limit for test
  --name=TEST_NAME      Test name

Helper Scripts

These helper scripts are intended for use only by the rosbuild and test reporting infrastructure.


check_test_ran.py <test-file.xml>

check_test_ran.py --rostest <pkg-name> <test-file.xml>

summarize_results.py <package>




Historically, rosunit is based on a refactoring of rostest. It provides the unit-test infrastructure and rostest provides the integration test infrastructure. rostest is also allowed to interact with a running ROS graph.

The initial separation was not perfect. There is more room to migrate more code from rostest into rosunit. Similarly, there is code within rosunit that would be better supported by a graph-less version of roslaunch, i.e. a process monitor unattached to a ROS master. Until that happens, rosunit contains code that is a copy of internal libraries within roslaunch.

2024-07-20 14:45