ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
launch_test
is a command that is provided by the launch_testing
package. It can be used to run tests that are described/set up using a launch file in a specific way, e.g.
$ launch_test path/to/my_launch_test.py
The Python launch file must define a generate_test_description()
function that returns a LaunchDescription
. I don't think this file needs to be part of a package; it might be able to just be a standalone file. For example:
def generate_test_description():
return launch.LaunchDescription([
launch.actions.ExecuteProcess(
cmd=[path_to_process],
),
# Start tests right away - no need to wait for anything in this example.
# In a more complicated launch description, we might want this action happen
# once some process starts or once some other event happens
launch_testing.actions.ReadyToTest()
])
See this README: https://github.com/ros2/launch/blob/3a5c9df2e384271637ac029f48f020b7916498d6/launch_testing/README.md.
colcon test
is a command that runs all tests for a given package (or given packages): C++ tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_gtest(...)
), or Python tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_pytest_test(...)
or just a Python file under a test/
directory in a pure Python package). E.g.
$ colcon test --packages-select my_package
Some of those Python test files can be launch tests similar to the example above, but the generate_test_description()
function has to be annotated with @pytest.mark.launch_test
for the test file to be run properly. I think in this case the same file can also be run using launch_test
.
In general, you can simply just use colcon test
to run your tests.
2 | No.2 Revision |
launch_test
is a command that is provided by the launch_testing
package. package. It can be used to run tests that are described/set up using a launch file in a specific way, e.g.
$ launch_test path/to/my_launch_test.py
The Python launch file must define a generate_test_description()
function that returns a LaunchDescription
. I don't think this file needs to be part of a package; it might be able to just be a standalone file. For example:
def generate_test_description():
return launch.LaunchDescription([
launch.actions.ExecuteProcess(
cmd=[path_to_process],
),
# Start tests right away - no need to wait for anything in this example.
# In a more complicated launch description, we might want this action happen
# once some process starts or once some other event happens
launch_testing.actions.ReadyToTest()
])
See this README: https://github.com/ros2/launch/blob/3a5c9df2e384271637ac029f48f020b7916498d6/launch_testing/README.md.
colcon test
is a command that runs all tests for a given package (or given packages): C++ tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_gtest(...)
), or Python tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_pytest_test(...)
or just a Python file under a test/
directory in a pure Python package). E.g.
$ colcon test --packages-select my_package
Some of those Python test files can be launch tests similar to the example above, but the generate_test_description()
function has to be annotated with @pytest.mark.launch_test
for the test file to be run properly. I think in this case the same file can also be run using launch_test
.
In general, you can simply just use colcon test
to run your tests.
3 | No.3 Revision |
launch_test
is a command that is provided by the launch_testing
package. It can be used to run tests that are described/set up using a launch file in a specific way, file, e.g.
$ launch_test path/to/my_launch_test.py
The test must be set up in a very specific way. The Python launch file must define a generate_test_description()
function that returns a LaunchDescription
. I don't think this file needs to be part of a package; it might be able to just be a standalone file. For example:
def generate_test_description():
return launch.LaunchDescription([
launch.actions.ExecuteProcess(
cmd=[path_to_process],
),
# Start tests right away - no need to wait for anything in this example.
# In a more complicated launch description, we might want this action happen
# once some process starts or once some other event happens
launch_testing.actions.ReadyToTest()
])
See this README: https://github.com/ros2/launch/blob/3a5c9df2e384271637ac029f48f020b7916498d6/launch_testing/README.md.
colcon test
is a command that runs all tests for a given package (or given packages): C++ tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_gtest(...)
), or Python tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_pytest_test(...)
or just a Python file under a test/
directory in a pure Python package). E.g.
$ colcon test --packages-select my_package
Some of those Python test files can be launch tests similar to the example above, but the generate_test_description()
function has to be annotated with @pytest.mark.launch_test
for the test file to be run properly. I think in this case the same file can also be run using launch_test
.
In general, you can simply just use colcon test
to run your tests.
4 | No.4 Revision |
launch_test
is a command that is provided by the launch_testing
package. It can be used to run tests that are described/set up using a launch file, e.g.
$ launch_test path/to/my_launch_test.py
The test must be set up in a very specific way. The Python launch file must define a generate_test_description()
function that returns a LaunchDescription
. I don't think this file needs to be part of a package; it might be able to just be a standalone file. For example:
def generate_test_description():
return launch.LaunchDescription([
launch.actions.ExecuteProcess(
cmd=[path_to_process],
),
# Start tests right away - no need to wait for anything in this example.
# In a more complicated launch description, we might want this action happen
# once some process starts or once some other event happens
launch_testing.actions.ReadyToTest()
])
See this README: https://github.com/ros2/launch/blob/3a5c9df2e384271637ac029f48f020b7916498d6/launch_testing/README.md.
colcon test
is a command command that runs all tests for a given package (or given packages): C++ tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_gtest(...)
), or Python tests (e.g. defined as a CMake test in a CMakeLists.txt
using ament_add_pytest_test(...)
or just a Python file under a test/
directory in a pure Python package). E.g.
$ colcon test --packages-select my_package
Some of those Python test files can be launch tests similar to the example above, but the generate_test_description()
function has to be annotated with @pytest.mark.launch_test
for the test file to be run properly. I think in this case the same file can also be run using launch_test
.
In general, you can simply just use colcon test
to run your tests.