How to run multiple tests in parallel with colcon test?

I am currently engaged in a ROS2 project aimed at optimizing our testing processes by enabling concurrent execution of tests within a single package using colcon test.

Initially, I attempted to utilize the --parallel-workers flag. However, this approach did not resolve the issue as intended. It facilitates parallel execution across multiple packages, but intra-package test execution remains sequential.

Each test is implemented using the launch_testing framework and integrated into colcon via the add_launch_test macro within the CMakeLists.txt file.

Key specifics include:

  • ROS2 version: Humble
  • Operating System: Ubuntu 22.04
  • Test execution command: colcon test

I am seeking guidance or practical examples that outline best practices for achieving concurrent test execution at the ROS2 package level.

In case what I am asking turned out to be not supported, I suggest to add it to the list of desired features to be implemented. Thank you in advance!

The question was answered here:

1 Like