Running rostest manually from the command-line

The rostest tool lets you manually run rostest files. NOTE: you can also run rostest files inside of roslaunch -- roslaunch will run everything except for the test nodes.


rostest <package-name> <test-filename> [args]

  • Launch <test-filename> located in <package-name>, e.g.:

    $ rostest test_rospy rospy.test

    rostest will find a file with the matching name inside the specified package and run it.

rostest <test-file-path> [args]

  • Launch the file specified by the file path, e.g.

    $ rostest test_rospy/test/rospy.test
  • --reuse-master (new in kinetic)

    • Connect to an existing ROS master instead of spawning a new ROS master on a custom port


    • Sends console output to screen instead XML test result file. IMPORTANT: when you run this option, the XML test result file will not be produced, so this is for command-line debugging only.

    --bare (DEPRECATED)

    • Run rostest on a bare, gtest-compatible executable. Executable is not run within a ROS graph.

    --bare-name (DEPRECATED)

    • Set test name of --bare test. Test name defaults to name of executable. This option should be set when running wrapped tests, e.g. with python.

    --bare-limit (DEPRECATED)

    • Time limit for --bare executable.

XML output

By default all console output from your test node is routed to a specially-formatted XML file, which can be parsed by automated build and test systems. When developing a test, you may want to see this output to help understand what's going on. You have two options:

  1. Look at the XML file after running the test. If the pkg is mypkg and the test-name is mytest, then your output will be in $ROS_ROOT/test/test_results/mypkg/TEST-mytest.xml.

  2. Run rostest in text mode, via the ---text option, e.g.:

    rostest --text mytest.test
    You'll get console output on the screen.

Wiki: rostest/Commandline (last edited 2021-09-09 19:43:28 by IsaacSaito)