New in Diamondback
Unit-testing package for ROS. This is a lower-level library for rostest and handles unit tests, whereas rostest handles integration tests.
- Author: Ken Conley
- License: BSD
- Repository: ros
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:
Python unittest (via rostest wrappers)
$ rosrun rosunit rosunit -h Usage: rosunit [options] <file> [test args...] Options: -h, --help show this help message and exit -t, --text Run with stdout output instead of XML output --time-limit=TIME_LIMIT Set time limit for test --name=TEST_NAME Test name
- Runs a gtest-compatible executable inside of a process monitor. If the test does not succeed within the time limit (default 1 minute), the test is killed and marked as a failure. Executable is not run within a ROS graph.
Set test name. Test name defaults to name of executable. This option should be set when running wrapped tests, e.g. with python.
- Time limit for test.
These helper scripts are intended for use only by the rosbuild and test reporting infrastructure.
Aggregate test results in test_results/_hudson, stripping any characters that cause Hudson trouble.
check_test_ran.py --rostest <pkg-name> <test-file.xml>
Look for test results file. If none exists, write new test results file that indicates test failure. If the --rostest option is passed in, it will use rostest's filename-generation scheme to look or the correct test file.
- Summarize test results for a single package.
- Print the directory that test results are written to.
Generate HTML versions of coverage.py test results.
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.